-
Notifications
You must be signed in to change notification settings - Fork 207
Open
Labels
Description
export const createGetActionLogsAgent = (
model: Model,
adminApiToolkit: AdminApiToolkit,
) =>
new Agent({
name: 'get_action_logs',
instructions: buildInstruction(),
model: model,
tools: [
createGetActionLogsFiltersTool(),
createQueryActionLogsTool(adminApiToolkit),
],
toolUseBehavior: { stopAtToolNames: ['query_action_logs'] },
});
const actionLogsAgent = createGetActionLogsAgent(model, adminApiToolkit);
const tools = [
actionLogsAgent.asTool({
toolName: 'get_action_logs',
toolDescription: GET_ACTION_LOGS_TOOL_DESCRIPTION,
// in theory should not be needed, but without it the content is '', might be a bug in the library
customOutputExtractor: (output: RunResult<any, any>) => {
return output.finalOutput;
},
}),
I would expect to not have to write this customOutputExtractor. queryActionLogs returns a very long string in case it matters.
I also have an extra question, is there an easy way to unit tests the tools?
describe('createGetActionLogsFiltersTool', () => {
const tool = createGetActionLogsFiltersTool();
test('should have correct name and description', () => {
expect(tool.name).toBe('get_action_logs_filters');
expect(tool.description).toBe(
'Generate valid filters for action logs query.',
);
});
});
});
Basically how can I call the tool.execute method. I found a function (forgot the name) but requires passing contexts, etc.