symposium 1.0.4 → 1.0.5

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
@@ -72,7 +72,10 @@ export default class Agent {
72
72
  async doInitThread(thread) {
73
73
  }
74
74
 
75
- async getThread(id) {
75
+ async getThread(id = null) {
76
+ if (id === null)
77
+ id = uuid();
78
+
76
79
  let thread = this.threads.get(id);
77
80
  if (!thread) {
78
81
  thread = new Thread(id, this);
@@ -1,4 +1,4 @@
1
- export default class MemoryHandler {
1
+ export default class ContextHandler {
2
2
  agent = null;
3
3
 
4
4
  setAgent(agent) {
package/README.md CHANGED
@@ -38,7 +38,7 @@ The framework is built around a few core components:
38
38
  - **`Thread`**: Represents a single conversation with an agent. It maintains the message history and the agent's state for that conversation. Each thread has a unique ID.
39
39
  - **`Tool`**: A base class for creating tools that an `Agent` can use. Tools expose functions that the LLM can call to interact with external APIs or data.
40
40
  - **`Message`**: A wrapper for messages within a `Thread`, containing the role (`user`, `assistant`, `system`, `tool`), content, and other metadata.
41
- - **`MemoryHandler`**: A class for managing an agent's long-term memory. It can be extended to create custom memory strategies.
41
+ - **`ContextHandler`**: A class for managing an agent's long contexts. It can be extended to create custom memory strategies.
42
42
  - **`Summarizer`**: A utility agent for summarizing text or conversations.
43
43
  - **`Logger`**: A simple logging utility that can be passed to an agent to log its activity.
44
44
 
@@ -338,7 +338,7 @@ This is a high-level overview. For details, please refer to the source code.
338
338
 
339
339
  ### Other Classes
340
340
 
341
- - **`MemoryHandler`**: Provides a base for implementing long-term memory for an agent.
341
+ - **`ContextHandler`**: Provides a base for managing long-term context. Can be extended for custom memory strategies.
342
342
  - **`Summarizer`**: A utility agent for text summarization.
343
343
  - **`Logger`**: A simple logger for agent activity.
344
344
 
package/Summarizer.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import Symposium from "./Symposium.js";
2
- import MemoryHandler from "./MemoryHandler.js";
2
+ import ContextHandler from "./ContextHandler.js";
3
3
 
4
- export default class Summarizer extends MemoryHandler {
4
+ export default class Summarizer extends ContextHandler {
5
5
  constructor(threshold = 0.7, summary_length = 0.5) {
6
6
  super();
7
7
  this.threshold = threshold;
package/Symposium.js CHANGED
@@ -2,6 +2,8 @@ import fs from 'fs';
2
2
  import path from 'path';
3
3
  import {fileURLToPath} from 'url';
4
4
 
5
+ import Agent from "./Agent.js";
6
+
5
7
  export default class Symposium {
6
8
  static models = new Map();
7
9
  static storage = null;
@@ -113,4 +115,19 @@ export default class Symposium {
113
115
 
114
116
  return mimeToExt[mime] || null;
115
117
  }
118
+
119
+ static async oneShot(system, prompt, options = {}) {
120
+ const agent = new Agent(options.agent || {});
121
+ agent.type = 'utility';
122
+ agent.utility = options.response || {
123
+ type: 'text',
124
+ };
125
+
126
+ agent.doInitThread = async thread => {
127
+ await thread.addMessage('system', system);
128
+ };
129
+
130
+ const thread = await agent.getThread();
131
+ return agent.message(prompt, thread);
132
+ }
116
133
  }
package/index.js CHANGED
@@ -5,7 +5,7 @@ import Agent from "./Agent.js";
5
5
  import Thread from "./Thread.js";
6
6
  import Tool from "./Tool.js";
7
7
  import Logger from "./Logger.js";
8
- import MemoryHandler from "./MemoryHandler.js";
8
+ import ContextHandler from "./ContextHandler.js";
9
9
  import Summarizer from "./Summarizer.js";
10
10
 
11
11
  export {
@@ -14,6 +14,6 @@ export {
14
14
  Thread,
15
15
  Tool,
16
16
  Logger,
17
- MemoryHandler,
17
+ ContextHandler,
18
18
  Summarizer,
19
19
  };
package/package.json CHANGED
@@ -1,16 +1,16 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "symposium",
4
- "version": "1.0.4",
4
+ "version": "1.0.5",
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.60.0",
11
- "groq-sdk": "^0.30.0",
10
+ "@anthropic-ai/sdk": "^0.64.0",
11
+ "groq-sdk": "^0.32.0",
12
12
  "openai": "^5.0.0",
13
13
  "tiktoken": "^1.0.10",
14
- "uuid": "^11.1.0"
14
+ "uuid": "^13.0.0"
15
15
  }
16
16
  }