agentnet 0.1.8 → 0.1.11

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.
@@ -54,7 +54,7 @@ await agentPricing.compile()
54
54
  await new Promise(resolve => setTimeout(resolve, 2000))
55
55
 
56
56
  // Agent client
57
- const sessionId = 'f3f4dfe9-3ca2-4e10-956f-e8d19ece5592' //uuidv4()
57
+ const sessionId = 'f3f4dfe9-3ca2-4e10-956f-e8d19ece5591' //uuidv4()
58
58
  const agentClient = AgentClient()
59
59
  const message = new Message({
60
60
  content: "What rooms do you have from 2025-05-25 to 2025-05-30 for 3 guests For the hotel Flora? Give me the review of the hotel Flora",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentnet",
3
- "version": "0.1.8",
3
+ "version": "0.1.11",
4
4
  "type": "module",
5
5
  "description": "Agent library used by Smartness",
6
6
  "main": "src/index.js",
@@ -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, run);
271
271
 
272
272
  // If not finished, continue with the next run
273
273
  if (finished == null) {
package/src/llm/gemini.js CHANGED
@@ -149,9 +149,12 @@ 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) {
152
+ async onResponse(state, conversation, toolsAndHandoffsMap, response, run, maxRuns) {
153
153
  // Handle simple text response
154
- if (response.text !== undefined && (response.functionCalls === undefined || response.functionCalls.length === 0) ) {
154
+ logger.info('Gemini onResponse', {text: response.text !== undefined, functionCalls: response.functionCalls?.length, run: run, maxRuns: maxRuns });
155
+
156
+
157
+ if (response.text !== undefined && (response.functionCalls === undefined || response.functionCalls.length === 0 || run >= maxRuns - 1) ) {
155
158
  logger.debug('Gemini response contains text, returning directly');
156
159
 
157
160
  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