-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: implement tests for search index tool #11
base: main
Are you sure you want to change the base?
feat: implement tests for search index tool #11
Conversation
Signed-off-by: yuye-aws <[email protected]>
Signed-off-by: yuye-aws <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good, minor comments. Seems this tool is not used by react agent directly? If it doesn't use any LLM or embeddings model then UT and IT should cover it, adding it here can be optional.
Also could you attach a flow template you used to create the agent? thanks
src/providers/factory/index.ts
Outdated
@@ -25,6 +25,11 @@ export class ApiProviderFactory { | |||
return new AgentFrameworkApiProvider(undefined, options.agentIdKey); | |||
return new OllyPPLGeneratorApiProvider(); | |||
|
|||
case PROVIDERS.SEARCH_INDEX_TOOL: | |||
if (process.env.API_PROVIDER === PROVIDERS.AGENT_FRAMEWORK) | |||
return new AgentFrameworkApiProvider(undefined, options.agentIdKey); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry i didn't realize options.agentIdKey
isn't passed when provider is agent_framework
could you revert this and change
return new AgentFrameworkApiProvider(); |
to
return new AgentFrameworkApiProvider(undefined, options.agentIdKey);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With this change, we no longer need a switch case for PROVIDERS.SEARCH_INDEX_TOOL
method: 'GET', | ||
path: index + '/_search', | ||
body: query, | ||
})) as ApiResponse<DSLResponse>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there's a search response interface provided import { SearchResponse } from '@opensearch-project/opensearch/api/types';
})) as ApiResponse<DSLResponse>; | |
})) as ApiResponse<SearchResponse>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for reminding me. I will change the type.
Can I test this tool with both flow agent and conversational agent? I think we can just add a new runner for search index tool. |
The flow template is:
In which file should I attach the flow template? |
Signed-off-by: yuye-aws <[email protected]>
Signed-off-by: yuye-aws <[email protected]>
Signed-off-by: yuye-aws <[email protected]>
thanks, i think flow agent case can be covered by unit tests, since there's no model logic involved. I don't mind this PR adding them here, but if this will be used by a conversational agent that uses LLM, it would be better to add those tests |
Description
Implement test script and runner for search index tool. You can run tests by
npm run test -- src/tests/search_index/search_index.test.ts
Remember to specify
SEARCH_INDEX_AGENT_ID
in.env
first.Issues Resolved
Implement test script and runner for search index tool.
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.