symposium 0.1.6 → 0.1.7
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.
- package/Agent.js +16 -2
- package/package.json +1 -1
package/Agent.js
CHANGED
|
@@ -105,7 +105,7 @@ class Agent {
|
|
|
105
105
|
|
|
106
106
|
async getDefaultState() {
|
|
107
107
|
return {
|
|
108
|
-
model: 'gpt-
|
|
108
|
+
model: 'gpt-4-1106-preview',
|
|
109
109
|
};
|
|
110
110
|
}
|
|
111
111
|
|
|
@@ -204,7 +204,13 @@ class Agent {
|
|
|
204
204
|
}
|
|
205
205
|
}
|
|
206
206
|
|
|
207
|
-
const
|
|
207
|
+
const completion_payload = {};
|
|
208
|
+
if (this.options.talking_function) {
|
|
209
|
+
completion_payload.functions = [this.options.talking_function];
|
|
210
|
+
completion_payload.function_call = {name: this.options.talking_function.name};
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
const completion = await this.generateCompletion(conversation, completion_payload);
|
|
208
214
|
|
|
209
215
|
await this.handleCompletion(conversation, completion);
|
|
210
216
|
|
|
@@ -266,6 +272,14 @@ class Agent {
|
|
|
266
272
|
}
|
|
267
273
|
|
|
268
274
|
async handleCompletion(conversation, completion) {
|
|
275
|
+
if (this.options.talking_function && completion.function_call) {
|
|
276
|
+
const text = completion.function_call.arguments[Object.keys(this.options.talking_function.parameters.properties)[0]];
|
|
277
|
+
conversation.addAssistantMessage(text);
|
|
278
|
+
await this.log('ai_message', text);
|
|
279
|
+
await conversation.reply(text);
|
|
280
|
+
return conversation.storeState()
|
|
281
|
+
}
|
|
282
|
+
|
|
269
283
|
conversation.addAssistantMessage(completion.content, completion.function_call ? {
|
|
270
284
|
...completion.function_call,
|
|
271
285
|
arguments: JSON.stringify(completion.function_call.arguments),
|