agentnet 0.1.7 → 0.1.10
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-
|
|
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
|
@@ -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/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, 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,10 @@ 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) {
|
|
153
153
|
// Handle simple text response
|
|
154
|
-
|
|
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) ) {
|
|
155
156
|
logger.debug('Gemini response contains text, returning directly');
|
|
156
157
|
|
|
157
158
|
if (conversation instanceof Conversation) {
|