@sprucelabs/sprucebot-llm 9.0.136 → 10.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -85,11 +85,23 @@ class OpenAiMessageBuilder {
|
|
|
85
85
|
if (callback.parameters) {
|
|
86
86
|
let params = '<Parameters>';
|
|
87
87
|
for (const param of callback.parameters) {
|
|
88
|
+
let parameterChoices = '';
|
|
89
|
+
if (param.type === 'select') {
|
|
90
|
+
const choices = param.options
|
|
91
|
+
.choices;
|
|
92
|
+
parameterChoices = `<Choices>\n${choices
|
|
93
|
+
.map((c) => `
|
|
94
|
+
<Choice>
|
|
95
|
+
<Label>${c.label}</Label>
|
|
96
|
+
<Value>${c.value}</Value>
|
|
97
|
+
</Choice>`)
|
|
98
|
+
.join('\n')}\n</Choices>`;
|
|
99
|
+
}
|
|
88
100
|
params += `
|
|
89
101
|
<Parameter${param.isRequired ? ' required="true"' : ''}>
|
|
90
102
|
<Name>${param.name}</Name>
|
|
91
103
|
<Type>${param.type}</Type>
|
|
92
|
-
${param.description ? `<Description>${param.description}</Description>` : ''}
|
|
104
|
+
${param.description ? `<Description>${param.description}</Description>` : ''}${parameterChoices}
|
|
93
105
|
</Parameter>`;
|
|
94
106
|
}
|
|
95
107
|
params += '</Parameters>';
|
|
@@ -84,11 +84,23 @@ export default class OpenAiMessageBuilder {
|
|
|
84
84
|
if (callback.parameters) {
|
|
85
85
|
let params = '<Parameters>';
|
|
86
86
|
for (const param of callback.parameters) {
|
|
87
|
+
let parameterChoices = '';
|
|
88
|
+
if (param.type === 'select') {
|
|
89
|
+
const choices = param.options
|
|
90
|
+
.choices;
|
|
91
|
+
parameterChoices = `<Choices>\n${choices
|
|
92
|
+
.map((c) => `
|
|
93
|
+
<Choice>
|
|
94
|
+
<Label>${c.label}</Label>
|
|
95
|
+
<Value>${c.value}</Value>
|
|
96
|
+
</Choice>`)
|
|
97
|
+
.join('\n')}\n</Choices>`;
|
|
98
|
+
}
|
|
87
99
|
params += `
|
|
88
100
|
<Parameter${param.isRequired ? ' required="true"' : ''}>
|
|
89
101
|
<Name>${param.name}</Name>
|
|
90
102
|
<Type>${param.type}</Type>
|
|
91
|
-
${param.description ? `<Description>${param.description}</Description>` : ''}
|
|
103
|
+
${param.description ? `<Description>${param.description}</Description>` : ''}${parameterChoices}
|
|
92
104
|
</Parameter>`;
|
|
93
105
|
}
|
|
94
106
|
params += '</Parameters>';
|
package/build/esm/llm.types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { MercuryEventEmitter } from '@sprucelabs/mercury-types';
|
|
2
|
-
import { Schema, SchemaValues } from '@sprucelabs/schema';
|
|
2
|
+
import { Schema, SchemaValues, SelectFieldDefinition } from '@sprucelabs/schema';
|
|
3
3
|
export interface BotOptions<StateSchema extends Schema = Schema, State extends SchemaValues<StateSchema> = SchemaValues<StateSchema>> extends Omit<PromptOptions<StateSchema, State>, 'skill'> {
|
|
4
4
|
adapter: LlmAdapter;
|
|
5
5
|
Class?: new (...opts: any[]) => SprucebotLlmBot<Schema, State>;
|
|
@@ -66,12 +66,15 @@ export interface LlmCallback {
|
|
|
66
66
|
useThisWhenever: string;
|
|
67
67
|
parameters?: LlmCallbackParameter[];
|
|
68
68
|
}
|
|
69
|
-
export
|
|
69
|
+
export type LlmCallbackParameter = {
|
|
70
70
|
name: string;
|
|
71
|
-
type: ('
|
|
71
|
+
type: ('text' | 'number' | 'boolean' | 'dateMs' | 'dateTimeMs') | (string & {});
|
|
72
72
|
isRequired?: boolean;
|
|
73
73
|
description?: string;
|
|
74
|
-
}
|
|
74
|
+
} | (SelectFieldDefinition & {
|
|
75
|
+
name: string;
|
|
76
|
+
description?: string;
|
|
77
|
+
});
|
|
75
78
|
export type MessageResponseCallback = (message: string) => any;
|
|
76
79
|
export type SendMessage = string | SendMessageWithImage;
|
|
77
80
|
export interface SendMessageWithImage {
|
package/build/llm.types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { MercuryEventEmitter } from '@sprucelabs/mercury-types';
|
|
2
|
-
import { Schema, SchemaValues } from '@sprucelabs/schema';
|
|
2
|
+
import { Schema, SchemaValues, SelectFieldDefinition } from '@sprucelabs/schema';
|
|
3
3
|
export interface BotOptions<StateSchema extends Schema = Schema, State extends SchemaValues<StateSchema> = SchemaValues<StateSchema>> extends Omit<PromptOptions<StateSchema, State>, 'skill'> {
|
|
4
4
|
adapter: LlmAdapter;
|
|
5
5
|
Class?: new (...opts: any[]) => SprucebotLlmBot<Schema, State>;
|
|
@@ -66,12 +66,15 @@ export interface LlmCallback {
|
|
|
66
66
|
useThisWhenever: string;
|
|
67
67
|
parameters?: LlmCallbackParameter[];
|
|
68
68
|
}
|
|
69
|
-
export
|
|
69
|
+
export type LlmCallbackParameter = {
|
|
70
70
|
name: string;
|
|
71
|
-
type: ('
|
|
71
|
+
type: ('text' | 'number' | 'boolean' | 'dateMs' | 'dateTimeMs') | (string & {});
|
|
72
72
|
isRequired?: boolean;
|
|
73
73
|
description?: string;
|
|
74
|
-
}
|
|
74
|
+
} | (SelectFieldDefinition & {
|
|
75
|
+
name: string;
|
|
76
|
+
description?: string;
|
|
77
|
+
});
|
|
75
78
|
export type MessageResponseCallback = (message: string) => any;
|
|
76
79
|
export type SendMessage = string | SendMessageWithImage;
|
|
77
80
|
export interface SendMessageWithImage {
|