wirejs-resources 0.1.166 → 0.1.167
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/dist/services/llm.d.ts +5 -6
- package/dist/services/llm.js +5 -6
- package/package.json +1 -1
package/dist/services/llm.d.ts
CHANGED
|
@@ -30,12 +30,11 @@ export type AssistantMessage = {
|
|
|
30
30
|
export type ToolMessage = {
|
|
31
31
|
/** Always 'tool' for tool execution results */
|
|
32
32
|
role: 'tool';
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
tool_call_id: string;
|
|
33
|
+
content: {
|
|
34
|
+
id: string;
|
|
35
|
+
content: string;
|
|
36
|
+
isError?: boolean;
|
|
37
|
+
}[];
|
|
39
38
|
};
|
|
40
39
|
/** Union of all possible message types in conversation history */
|
|
41
40
|
export type LLMMessage = UserMessage | AssistantMessage | ToolMessage;
|
package/dist/services/llm.js
CHANGED
|
@@ -141,7 +141,10 @@ export class LLM extends Resource {
|
|
|
141
141
|
content: finalSystemPrompt
|
|
142
142
|
}
|
|
143
143
|
] : []),
|
|
144
|
-
...history
|
|
144
|
+
...history.map(m => m.role === 'tool' ? {
|
|
145
|
+
role: 'tool',
|
|
146
|
+
content: JSON.stringify(m.content, null, 2)
|
|
147
|
+
} : m)
|
|
145
148
|
],
|
|
146
149
|
stream,
|
|
147
150
|
...(ollamaTools.length > 0 ? { tools: ollamaTools } : {}),
|
|
@@ -166,11 +169,7 @@ export class LLM extends Resource {
|
|
|
166
169
|
return message;
|
|
167
170
|
}
|
|
168
171
|
else {
|
|
169
|
-
|
|
170
|
-
return {
|
|
171
|
-
role: 'assistant',
|
|
172
|
-
content: message.content
|
|
173
|
-
};
|
|
172
|
+
throw new Error(`Unexpected message format: ${message}`);
|
|
174
173
|
}
|
|
175
174
|
}
|
|
176
175
|
}
|