symposium 0.5.5 → 0.5.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/models/AnthropicModel.js +17 -1
- package/models/OpenAIModel.js +1 -1
- package/package.json +2 -2
package/models/AnthropicModel.js
CHANGED
|
@@ -4,7 +4,7 @@ import Message from "../Message.js";
|
|
|
4
4
|
|
|
5
5
|
export default class AnthropicModel extends Model {
|
|
6
6
|
anthropic;
|
|
7
|
-
supports_functions =
|
|
7
|
+
supports_functions = true;
|
|
8
8
|
|
|
9
9
|
getAnthropic() {
|
|
10
10
|
if (!this.anthropic)
|
|
@@ -28,6 +28,12 @@ export default class AnthropicModel extends Model {
|
|
|
28
28
|
system,
|
|
29
29
|
max_tokens: 4096,
|
|
30
30
|
messages,
|
|
31
|
+
tools: functions.map(f => ({
|
|
32
|
+
name: f.name,
|
|
33
|
+
description: f.description,
|
|
34
|
+
input_schema: f.parameters,
|
|
35
|
+
required: f.required || undefined,
|
|
36
|
+
})),
|
|
31
37
|
...payload,
|
|
32
38
|
};
|
|
33
39
|
|
|
@@ -41,6 +47,16 @@ export default class AnthropicModel extends Model {
|
|
|
41
47
|
message_content.push({type: 'text', content: m.text});
|
|
42
48
|
break;
|
|
43
49
|
|
|
50
|
+
case 'tool_use':
|
|
51
|
+
message_content.push({
|
|
52
|
+
type: 'function',
|
|
53
|
+
content: {
|
|
54
|
+
name: m.name,
|
|
55
|
+
arguments: m.input,
|
|
56
|
+
},
|
|
57
|
+
});
|
|
58
|
+
break;
|
|
59
|
+
|
|
44
60
|
default:
|
|
45
61
|
throw new Error('Unrecognized message type in Anthropic response');
|
|
46
62
|
}
|
package/models/OpenAIModel.js
CHANGED
|
@@ -20,7 +20,7 @@ export default class OpenAIModel extends Model {
|
|
|
20
20
|
|
|
21
21
|
if (functions.length && !this.supports_functions) {
|
|
22
22
|
// Se il modello non supporta nativamente le funzioni, inserisco il prompt ad hoc come ultimo messaggio di sistema
|
|
23
|
-
const functions_prompt = this.promptFromFunctions(functions);
|
|
23
|
+
const functions_prompt = this.promptFromFunctions(payload, functions);
|
|
24
24
|
let system_messages = [], other_messages = [], first_found = false;
|
|
25
25
|
for (let message of messages) {
|
|
26
26
|
if (!first_found && message.role !== 'system')
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"type": "module",
|
|
3
3
|
"name": "symposium",
|
|
4
|
-
"version": "0.5.
|
|
4
|
+
"version": "0.5.7",
|
|
5
5
|
"description": "Agents",
|
|
6
6
|
"main": "index.js",
|
|
7
7
|
"author": "Domenico Giambra",
|
|
8
8
|
"license": "ISC",
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"@anthropic-ai/sdk": "^0.
|
|
10
|
+
"@anthropic-ai/sdk": "^0.20.0",
|
|
11
11
|
"@travio/redis": "^2.0.0",
|
|
12
12
|
"openai": "^4.12.1",
|
|
13
13
|
"tiktoken": "^1.0.10"
|