agentnet 0.1.13 → 0.1.15
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/package.json +1 -1
- package/src/agent/executor.js +1 -1
- package/src/llm/gemini.js +9 -12
- package/src/llm/gpt.js +1 -1
package/package.json
CHANGED
package/src/agent/executor.js
CHANGED
|
@@ -267,7 +267,7 @@ export async function build(
|
|
|
267
267
|
logger.debug(`LLM response received for agent ${agentName}`);
|
|
268
268
|
|
|
269
269
|
// Process the response
|
|
270
|
-
const finished = await api.onResponse(state, contents, toolsAndHandoffsMap, response
|
|
270
|
+
const finished = await api.onResponse(state, contents, toolsAndHandoffsMap, response);
|
|
271
271
|
|
|
272
272
|
// If not finished, continue with the next run
|
|
273
273
|
if (finished == null) {
|
package/src/llm/gemini.js
CHANGED
|
@@ -66,7 +66,7 @@ class GeminiLLM extends BaseLLM {
|
|
|
66
66
|
|
|
67
67
|
try {
|
|
68
68
|
const res = await client.models.generateContent(input);
|
|
69
|
-
|
|
69
|
+
logger.debug('Gemini response', res)
|
|
70
70
|
logger.debug('Gemini response received', {
|
|
71
71
|
responseType: res.response?.candidates ? 'candidates' : 'unknown',
|
|
72
72
|
hasContent: !!res.response?.candidates?.[0]?.content
|
|
@@ -74,7 +74,7 @@ class GeminiLLM extends BaseLLM {
|
|
|
74
74
|
|
|
75
75
|
return res;
|
|
76
76
|
} catch (error) {
|
|
77
|
-
console.log(error)
|
|
77
|
+
console.log(new Date().toISOString(), error)
|
|
78
78
|
logger.error('Gemini API error', {
|
|
79
79
|
error,
|
|
80
80
|
modelName: input.model
|
|
@@ -150,17 +150,11 @@ class GeminiLLM extends BaseLLM {
|
|
|
150
150
|
* @param {Object} response - The model response to process
|
|
151
151
|
* @returns {Promise<string|null>} Text response or null if processing tool calls
|
|
152
152
|
*/
|
|
153
|
-
async onResponse(state, conversation, toolsAndHandoffsMap, response
|
|
153
|
+
async onResponse(state, conversation, toolsAndHandoffsMap, response) {
|
|
154
154
|
// Handle simple text response
|
|
155
|
-
logger.info('Gemini onResponse', {text: response.text !== undefined, functionCalls: response.functionCalls?.length
|
|
155
|
+
logger.info('Gemini onResponse', {text: response.text !== undefined, functionCalls: response.functionCalls?.length });
|
|
156
156
|
|
|
157
|
-
if (
|
|
158
|
-
console.log(JSON.stringify(response, null, 2))
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
if (response.text !== undefined && (response.functionCalls === undefined || response.functionCalls.length === 0 || run >= maxRuns - 1) ) {
|
|
162
|
-
logger.debug('Gemini response contains text, returning directly');
|
|
163
|
-
|
|
157
|
+
if (response.text !== undefined) {
|
|
164
158
|
if (conversation instanceof Conversation) {
|
|
165
159
|
const modelResponse = {
|
|
166
160
|
role: 'model',
|
|
@@ -168,7 +162,10 @@ class GeminiLLM extends BaseLLM {
|
|
|
168
162
|
};
|
|
169
163
|
conversation.addModelResponse(modelResponse);
|
|
170
164
|
}
|
|
171
|
-
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
if (response.text !== undefined && (response.functionCalls === undefined || response.functionCalls.length === 0)) {
|
|
168
|
+
logger.debug('Gemini response contains text, returning directly');
|
|
172
169
|
return response.text;
|
|
173
170
|
}
|
|
174
171
|
|
package/src/llm/gpt.js
CHANGED
|
@@ -156,7 +156,7 @@ class OpenAILLM extends BaseLLM {
|
|
|
156
156
|
* @param {Object} response - The model response to process
|
|
157
157
|
* @returns {Promise<string|null>} Text response or null if processing tool calls
|
|
158
158
|
*/
|
|
159
|
-
async onResponse(state, conversation, toolsAndHandoffsMap, response
|
|
159
|
+
async onResponse(state, conversation, toolsAndHandoffsMap, response) { // TODO verify run and tool calls like gemini
|
|
160
160
|
if (response.output_text !== undefined && response.output_text.length > 0 ) {
|
|
161
161
|
logger.debug('OpenAI response contains text, returning directly');
|
|
162
162
|
|