symposium 2.4.3 → 3.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.
package/Summarizer.js CHANGED
@@ -57,7 +57,7 @@ export default class Summarizer extends ContextHandler {
57
57
  async doSummarize(thread, maxLength) {
58
58
  thread.addMessage('system', 'Summarize the conversation up to this moment.');
59
59
  const summary = await this.agent.generateCompletion(thread, {
60
- functions: [
60
+ tools: [
61
61
  {
62
62
  name: 'summarize',
63
63
  description: 'Generate a summary of the conversation in ' + Math.round(maxLength / 2) + ' words at most, in a way that it is easy for you to keep track of the important info. Do not omit relevant information you need to remember in order to continue the conversation.',
@@ -72,7 +72,7 @@ export default class Summarizer extends ContextHandler {
72
72
  }
73
73
  },
74
74
  ],
75
- force_function: 'summarize',
75
+ force_tool: 'summarize',
76
76
  });
77
77
 
78
78
  if (!summary)
@@ -83,11 +83,11 @@ export default class Summarizer extends ContextHandler {
83
83
  if (message.role === 'system' && !message.tags.includes('summary')) {
84
84
  summarizedThread.messages.push(message);
85
85
  } else {
86
- const functionsResponse = Symposium.extractFunctionsFromResponse(summary);
87
- if (functionsResponse.length)
86
+ const toolCallsResponse = Symposium.extractToolCallsFromResponse(summary);
87
+ if (toolCallsResponse.length)
88
88
  throw new Error('Errore durante la generazione di un riassunto interno');
89
89
 
90
- summarizedThread.addMessage('system', "This is what happened until now:\n" + functionsResponse[0].summary, undefined, ['summary']);
90
+ summarizedThread.addMessage('system', "This is what happened until now:\n" + toolCallsResponse[0].summary, undefined, ['summary']);
91
91
  break;
92
92
  }
93
93
  }
package/Symposium.js CHANGED
@@ -56,19 +56,19 @@ export default class Symposium {
56
56
  return this.models.get(name);
57
57
  }
58
58
 
59
- static extractFunctionsFromResponse(messages) {
60
- const functions = [];
59
+ static extractToolCallsFromResponse(messages) {
60
+ const tool_calls = [];
61
61
  for (let message of messages) {
62
- const functionResponse = message.content.filter(c => c.type === 'function');
63
- if (functionResponse.length) {
64
- for (let f of functionResponse) {
65
- for (let r of f.content)
66
- functions.push(r.arguments);
62
+ const toolBlocks = message.content.filter(c => c.type === 'tool_call');
63
+ if (toolBlocks.length) {
64
+ for (let t of toolBlocks) {
65
+ for (let r of t.content)
66
+ tool_calls.push(r.arguments);
67
67
  }
68
68
  }
69
69
  }
70
70
 
71
- return functions;
71
+ return tool_calls;
72
72
  }
73
73
 
74
74
  static async transcribe(audio, prompt = null, model = null) {
@@ -138,9 +138,8 @@ export default class Symposium {
138
138
  static async prompt(system, prompt, options = {}) {
139
139
  const agent = new Agent(options.agent || {});
140
140
  agent.type = 'utility';
141
- agent.utility = options.response || {
142
- type: 'text',
143
- };
141
+ if (options.response_schema)
142
+ agent.response_schema = options.response_schema;
144
143
 
145
144
  agent.doInitThread = async thread => {
146
145
  if (options.model)
@@ -150,6 +149,7 @@ export default class Symposium {
150
149
 
151
150
  await agent.init();
152
151
  const thread = await agent.getThread();
153
- return agent.message(prompt, thread);
152
+
153
+ return await agent.message(prompt, thread);
154
154
  }
155
155
  }
@@ -1,15 +1,15 @@
1
- export default class Tool {
1
+ export default class Toolkit {
2
2
  name = '';
3
3
 
4
4
  async init(agent) {
5
5
  }
6
6
 
7
- async getFunctions() {
7
+ async getTools() {
8
8
  return [];
9
9
  }
10
10
 
11
- async callFunction(thread, name, payload) {
12
- return {error: 'callFunction is yet to be implemented'};
11
+ async callTool(thread, name, payload) {
12
+ return {error: 'callTool is yet to be implemented'};
13
13
  }
14
14
 
15
15
  async authorize(thread, name, payload) {
package/index.js CHANGED
@@ -3,7 +3,7 @@
3
3
  import Symposium from "./Symposium.js";
4
4
  import Agent from "./Agent.js";
5
5
  import Thread from "./Thread.js";
6
- import Tool from "./Tool.js";
6
+ import Toolkit from "./Toolkit.js";
7
7
  import Logger from "./Logger.js";
8
8
 
9
9
  import ContextHandler from "./ContextHandler.js";
@@ -12,16 +12,24 @@ import Summarizer from "./Summarizer.js";
12
12
  import Context from "./Context.js";
13
13
  import File from "./Contexts/File.js";
14
14
  import Text from "./Contexts/Text.js";
15
+ import MCPResource from "./Contexts/MCPResource.js";
16
+
17
+ import MCPServer from "./MCPServer.js";
18
+
19
+ import {createInputChannel} from "./InputChannel.js";
15
20
 
16
21
  export {
17
22
  Symposium,
18
23
  Agent,
19
24
  Thread,
20
- Tool,
25
+ Toolkit,
21
26
  Logger,
22
27
  ContextHandler,
23
28
  Summarizer,
24
29
  Context,
25
30
  File,
26
31
  Text,
32
+ MCPServer,
33
+ MCPResource,
34
+ createInputChannel,
27
35
  };
package/package.json CHANGED
@@ -1,17 +1,21 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "symposium",
4
- "version": "2.4.3",
4
+ "version": "3.0.0",
5
5
  "description": "Agents",
6
6
  "main": "index.js",
7
7
  "author": "Domenico Giambra",
8
8
  "license": "ISC",
9
+ "scripts": {
10
+ "test": "node --test \"test/**/*.test.js\""
11
+ },
9
12
  "dependencies": {
10
- "@anthropic-ai/sdk": "^0.79.0",
13
+ "@anthropic-ai/sdk": "^0.98.0",
14
+ "@modelcontextprotocol/sdk": "^1.29.0",
11
15
  "groq-sdk": "^1.0.0",
12
16
  "ollama": "^0.6.0",
13
17
  "openai": "^6.0.0",
14
18
  "tiktoken": "^1.0.10",
15
- "uuid": "^13.0.0"
19
+ "uuid": "^14.0.0"
16
20
  }
17
21
  }