symposium 0.4.2 → 0.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 +4 -1
- package/Symposium.js +3 -3
- package/models/AnthropicModel.js +11 -1
- package/package.json +1 -1
package/Agent.js
CHANGED
|
@@ -149,8 +149,11 @@ export default class Agent {
|
|
|
149
149
|
}
|
|
150
150
|
|
|
151
151
|
async handleCompletion(thread, completion) {
|
|
152
|
-
for (let message of completion.messages)
|
|
152
|
+
for (let message of completion.messages) {
|
|
153
153
|
thread.addMessage(message);
|
|
154
|
+
await this.log('ai_message', message.text);
|
|
155
|
+
await thread.reply(message.text);
|
|
156
|
+
}
|
|
154
157
|
|
|
155
158
|
if (completion.function) {
|
|
156
159
|
thread.addAssistantMessage('', {
|
package/Symposium.js
CHANGED
|
@@ -4,9 +4,9 @@ import Gpt4 from "./models/Gpt4.js";
|
|
|
4
4
|
import Gpt4Turbo from "./models/Gpt4Turbo.js";
|
|
5
5
|
import Gpt4Vision from "./models/Gpt4Vision.js";
|
|
6
6
|
import Whisper from "./models/Whisper.js";
|
|
7
|
-
import Claude3Haiku from "
|
|
8
|
-
import Claude3Sonnet from "
|
|
9
|
-
import Claude3Opus from "
|
|
7
|
+
import Claude3Haiku from "./models/Claude3Haiku.js";
|
|
8
|
+
import Claude3Sonnet from "./models/Claude3Sonnet.js";
|
|
9
|
+
import Claude3Opus from "./models/Claude3Opus.js";
|
|
10
10
|
|
|
11
11
|
export default class Symposium {
|
|
12
12
|
static models = new Map();
|
package/models/AnthropicModel.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import Model from "../Model.js";
|
|
2
2
|
import Anthropic from '@anthropic-ai/sdk';
|
|
3
|
+
import Response from "../Response.js";
|
|
4
|
+
import Message from "../Message.js";
|
|
3
5
|
|
|
4
6
|
export default class AnthropicModel extends Model {
|
|
5
7
|
anthropic;
|
|
@@ -24,7 +26,15 @@ export default class AnthropicModel extends Model {
|
|
|
24
26
|
};
|
|
25
27
|
|
|
26
28
|
const message = await this.getAnthropic().messages.create(completion_payload);
|
|
27
|
-
|
|
29
|
+
|
|
30
|
+
const response = new Response;
|
|
31
|
+
if (message.content) {
|
|
32
|
+
for (let m of message.content)
|
|
33
|
+
// TODO: supporto ad altri tipi oltre a text (m.type)
|
|
34
|
+
response.messages.push(new Message('assistant', m.text));
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return response;
|
|
28
38
|
}
|
|
29
39
|
|
|
30
40
|
convertMessages(thread) {
|