@wabot-dev/framework 0.1.0-beta.57 → 0.1.0-beta.58
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.
|
@@ -18,18 +18,14 @@ let GoogleChatAdapter = class GoogleChatAdapter {
|
|
|
18
18
|
}
|
|
19
19
|
async nextItem(req) {
|
|
20
20
|
const messages = [];
|
|
21
|
-
// Add system prompt as system message
|
|
22
21
|
messages.push({ role: 'system', content: req.systemPrompt });
|
|
23
|
-
// Add previous chat items
|
|
24
22
|
messages.push(...this.mapChatItems(req.prevItems));
|
|
25
23
|
const tools = req.tools.map((x) => this.mapTool(x));
|
|
26
24
|
const request = {
|
|
27
25
|
model: req.model,
|
|
28
26
|
messages,
|
|
29
|
-
tools
|
|
30
|
-
tool_choice: 'auto',
|
|
27
|
+
tools,
|
|
31
28
|
};
|
|
32
|
-
this.logger.debug(`Call Gemini API with Request: ${JSON.stringify(request)}`);
|
|
33
29
|
const response = await this.openai.chat.completions.create(request);
|
|
34
30
|
return this.mapResponse(response);
|
|
35
31
|
}
|
|
@@ -65,21 +61,8 @@ let GoogleChatAdapter = class GoogleChatAdapter {
|
|
|
65
61
|
mapFunctionCall(item) {
|
|
66
62
|
return [
|
|
67
63
|
{
|
|
68
|
-
role: '
|
|
69
|
-
|
|
70
|
-
{
|
|
71
|
-
id: item.id,
|
|
72
|
-
type: 'function',
|
|
73
|
-
function: {
|
|
74
|
-
name: item.name,
|
|
75
|
-
arguments: item.arguments || '{}',
|
|
76
|
-
},
|
|
77
|
-
},
|
|
78
|
-
],
|
|
79
|
-
},
|
|
80
|
-
{
|
|
81
|
-
role: 'tool',
|
|
82
|
-
tool_call_id: item.id,
|
|
64
|
+
role: 'function',
|
|
65
|
+
name: item.id,
|
|
83
66
|
content: item.result ?? 'No result',
|
|
84
67
|
},
|
|
85
68
|
];
|
|
@@ -94,12 +77,14 @@ let GoogleChatAdapter = class GoogleChatAdapter {
|
|
|
94
77
|
type: 'object',
|
|
95
78
|
properties: tool.parameters.reduce((prev, param) => ({
|
|
96
79
|
...prev,
|
|
97
|
-
[param.name]: {
|
|
80
|
+
[param.name]: {
|
|
81
|
+
type: param.type,
|
|
82
|
+
description: param.description,
|
|
83
|
+
},
|
|
98
84
|
}), {}),
|
|
99
85
|
required: tool.parameters.map((param) => param.name),
|
|
100
86
|
additionalProperties: false,
|
|
101
|
-
}
|
|
102
|
-
strict: true,
|
|
87
|
+
}
|
|
103
88
|
},
|
|
104
89
|
};
|
|
105
90
|
}
|