symposium 1.4.1 → 1.4.3

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 CHANGED
@@ -65,12 +65,13 @@ export default class Agent {
65
65
  return {};
66
66
  }
67
67
 
68
- addTool(tool) {
68
+ async addTool(tool) {
69
69
  if (!(tool instanceof Tool) || !tool.name)
70
70
  throw new Error('Tool must be an instance of Tool class');
71
71
  if (this.tools.has(tool.name))
72
72
  throw new Error('Tool with name ' + tool.name + ' already exists in agent');
73
73
 
74
+ await tool.init(this);
74
75
  this.tools.set(tool.name, tool);
75
76
  }
76
77
 
@@ -120,7 +121,7 @@ export default class Agent {
120
121
  if (is_there_on_request) {
121
122
  context_string = '<important>Some of the context files are available to you immediately here, while longer texts may be available only on request; you are provided with a title and a description of these files. If you think it may be useful for your current task, you can request the text via the get_context tool - IMPORTANT: use the title of the file verbatim as it is provided</important>' + context_string;
122
123
  if (!this.tools.has('get_context'))
123
- this.addTool(new GetContextTool(this));
124
+ await this.addTool(new GetContextTool(this));
124
125
  }
125
126
  context_string = '\n<context_info>' + context_string + '</context_info>';
126
127
 
package/README.md CHANGED
@@ -218,7 +218,7 @@ import WeatherTool from './WeatherTool.js';
218
218
 
219
219
  // ... inside main()
220
220
  const agent = new MyChatAgent();
221
- agent.addTool(new WeatherTool());
221
+ await agent.addTool(new WeatherTool());
222
222
  await agent.init();
223
223
 
224
224
  const emitter = await agent.message("What's the weather like in Paris?");
package/Tool.js CHANGED
@@ -1,6 +1,9 @@
1
1
  export default class Tool {
2
2
  name = '';
3
3
 
4
+ async init(agent) {
5
+ }
6
+
4
7
  async getFunctions() {
5
8
  return [];
6
9
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "symposium",
4
- "version": "1.4.1",
4
+ "version": "1.4.3",
5
5
  "description": "Agents",
6
6
  "main": "index.js",
7
7
  "author": "Domenico Giambra",