Skip to content

Commit

Permalink
bug fix - tool parameters missing (opensearch-project#1911) (opensear…
Browse files Browse the repository at this point in the history
…ch-project#2032)

* bug fix - tool parameters missing



* address comments



---------

Signed-off-by: Jing Zhang <[email protected]>
  • Loading branch information
jngz-es authored Feb 6, 2024
1 parent b7c60ce commit de0fd99
Showing 1 changed file with 32 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -336,8 +336,18 @@ public void testParsingJsonBlockFromResponse4() {
@Test
public void testRunWithIncludeOutputNotSet() {
LLMSpec llmSpec = LLMSpec.builder().modelId("MODEL_ID").build();
MLToolSpec firstToolSpec = MLToolSpec.builder().name(FIRST_TOOL).type(FIRST_TOOL).build();
MLToolSpec secondToolSpec = MLToolSpec.builder().name(SECOND_TOOL).type(SECOND_TOOL).build();
MLToolSpec firstToolSpec = MLToolSpec
.builder()
.name(FIRST_TOOL)
.type(FIRST_TOOL)
.parameters(ImmutableMap.of("key1", "value1", "key2", "value2"))
.build();
MLToolSpec secondToolSpec = MLToolSpec
.builder()
.name(SECOND_TOOL)
.type(SECOND_TOOL)
.parameters(ImmutableMap.of("key1", "value1", "key2", "value2"))
.build();
final MLAgent mlAgent = MLAgent
.builder()
.name("TestAgent")
Expand Down Expand Up @@ -386,8 +396,20 @@ public void testRunWithIncludeOutputMLModel() {
@Test
public void testRunWithIncludeOutputSet() {
LLMSpec llmSpec = LLMSpec.builder().modelId("MODEL_ID").build();
MLToolSpec firstToolSpec = MLToolSpec.builder().name(FIRST_TOOL).type(FIRST_TOOL).includeOutputInAgentResponse(false).build();
MLToolSpec secondToolSpec = MLToolSpec.builder().name(SECOND_TOOL).type(SECOND_TOOL).includeOutputInAgentResponse(true).build();
MLToolSpec firstToolSpec = MLToolSpec
.builder()
.name(FIRST_TOOL)
.type(FIRST_TOOL)
.includeOutputInAgentResponse(false)
.parameters(ImmutableMap.of("key1", "value1", "key2", "value2"))
.build();
MLToolSpec secondToolSpec = MLToolSpec
.builder()
.name(SECOND_TOOL)
.type(SECOND_TOOL)
.includeOutputInAgentResponse(true)
.parameters(ImmutableMap.of("key1", "value1", "key2", "value2"))
.build();
final MLAgent mlAgent = MLAgent
.builder()
.name("TestAgent")
Expand Down Expand Up @@ -728,7 +750,12 @@ public void testSaveLastTraceFailure() {
// Helper methods to create MLAgent and parameters
private MLAgent createMLAgentWithTools() {
LLMSpec llmSpec = LLMSpec.builder().modelId("MODEL_ID").build();
MLToolSpec firstToolSpec = MLToolSpec.builder().name(FIRST_TOOL).type(FIRST_TOOL).build();
MLToolSpec firstToolSpec = MLToolSpec
.builder()
.name(FIRST_TOOL)
.type(FIRST_TOOL)
.parameters(ImmutableMap.of("key1", "value1", "key2", "value2"))
.build();
return MLAgent.builder().name("TestAgent").tools(Arrays.asList(firstToolSpec)).memory(mlMemorySpec).llm(llmSpec).build();
}

Expand Down

0 comments on commit de0fd99

Please sign in to comment.