agentnet 0.1.10 → 0.1.12

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentnet",
3
- "version": "0.1.10",
3
+ "version": "0.1.12",
4
4
  "type": "module",
5
5
  "description": "Agent library used by Smartness",
6
6
  "main": "src/index.js",
package/src/llm/gemini.js CHANGED
@@ -149,10 +149,15 @@ class GeminiLLM extends BaseLLM {
149
149
  * @param {Object} response - The model response to process
150
150
  * @returns {Promise<string|null>} Text response or null if processing tool calls
151
151
  */
152
- async onResponse(state, conversation, toolsAndHandoffsMap, response, run) {
152
+ async onResponse(state, conversation, toolsAndHandoffsMap, response, run, maxRuns) {
153
153
  // Handle simple text response
154
- logger.info('Gemini onResponse', {text: response.text !== undefined, functionCalls: response.functionCalls?.length, run: run});
155
- if (response.text !== undefined && (response.functionCalls === undefined || response.functionCalls.length === 0 || run > 1) ) {
154
+ logger.info('Gemini onResponse', {text: response.text !== undefined, functionCalls: response.functionCalls?.length, run: run, maxRuns: maxRuns });
155
+
156
+ if (run > 4) {
157
+ console.log(JSON.stringify(response, null, 2))
158
+ }
159
+
160
+ if (response.text !== undefined && (response.functionCalls === undefined || response.functionCalls.length === 0 || run >= maxRuns - 1) ) {
156
161
  logger.debug('Gemini response contains text, returning directly');
157
162
 
158
163
  if (conversation instanceof Conversation) {
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, run) { // 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