agentnet 0.1.6 → 0.1.8

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.6",
3
+ "version": "0.1.8",
4
4
  "type": "module",
5
5
  "description": "Agent library used by Smartness",
6
6
  "main": "src/index.js",
@@ -123,6 +123,7 @@ async function processV1Alpha1Definition(definition, agentBuilder, bindings) {
123
123
  agentBuilder = configureStore(agentBuilder, spec.store, bindings);
124
124
  agentBuilder = await configureLLM(agentBuilder, spec.llm);
125
125
  agentBuilder = configureDiscoverySchemas(agentBuilder, spec.discoverySchemas);
126
+ agentBuilder = configureRunner(agentBuilder, spec.runner);
126
127
 
127
128
  // Set up tools
128
129
  const toolMap = configureTools(agentBuilder, spec.tools);
@@ -270,6 +271,25 @@ function configureTools(agentBuilder, toolsSpec) {
270
271
  return toolMap;
271
272
  }
272
273
 
274
+ /**
275
+ * Configures runner for an agent
276
+ * @param {object} agentBuilder - Agent builder instance
277
+ * @param {object} runnerSpec - Runner specification
278
+ * @returns {object} Updated agent builder
279
+ */
280
+ function configureRunner(agentBuilder, runnerSpec) {
281
+ if (!runnerSpec) {
282
+ return agentBuilder;
283
+ }
284
+
285
+ // Apply runner configuration to the agent's config
286
+ if (runnerSpec.maxRuns !== undefined) {
287
+ agentBuilder._config.runner.maxRuns = runnerSpec.maxRuns;
288
+ }
289
+
290
+ return agentBuilder;
291
+ }
292
+
273
293
  /**
274
294
  * Creates an agent interface
275
295
  * @param {object} agentBuilder - Agent builder instance
package/src/llm/gemini.js CHANGED
@@ -70,6 +70,7 @@ class GeminiLLM extends BaseLLM {
70
70
  responseType: res.response?.candidates ? 'candidates' : 'unknown',
71
71
  hasContent: !!res.response?.candidates?.[0]?.content
72
72
  });
73
+
73
74
  return res;
74
75
  } catch (error) {
75
76
  console.log(error)
@@ -150,7 +151,7 @@ class GeminiLLM extends BaseLLM {
150
151
  */
151
152
  async onResponse(state, conversation, toolsAndHandoffsMap, response) {
152
153
  // Handle simple text response
153
- if (response.text !== undefined) {
154
+ if (response.text !== undefined && (response.functionCalls === undefined || response.functionCalls.length === 0) ) {
154
155
  logger.debug('Gemini response contains text, returning directly');
155
156
 
156
157
  if (conversation instanceof Conversation) {
package/src/llm/gpt.js CHANGED
@@ -157,7 +157,7 @@ class OpenAILLM extends BaseLLM {
157
157
  * @returns {Promise<string|null>} Text response or null if processing tool calls
158
158
  */
159
159
  async onResponse(state, conversation, toolsAndHandoffsMap, response) {
160
- if (response.output_text !== undefined && response.output_text.length > 0) {
160
+ if (response.output_text !== undefined && response.output_text.length > 0 ) {
161
161
  logger.debug('OpenAI response contains text, returning directly');
162
162
 
163
163
  // Add model response to conversation if using Conversation object