core[patch]: support bedrock converse -> openai tool (#27754)

This commit is contained in:
Bagatur
2024-10-30 12:20:39 -07:00
committed by GitHub
parent 3dfdb3e6fb
commit 94ea950c6c
2 changed files with 39 additions and 2 deletions

View File

@@ -230,6 +230,30 @@ def anthropic_tool() -> dict:
}
@pytest.fixture()
def bedrock_converse_tool() -> dict:
return {
"toolSpec": {
"name": "dummy_function",
"description": "dummy function",
"inputSchema": {
"json": {
"type": "object",
"properties": {
"arg1": {"description": "foo", "type": "integer"},
"arg2": {
"description": "one of 'bar', 'baz'",
"enum": ["bar", "baz"],
"type": "string",
},
},
"required": ["arg1", "arg2"],
}
},
}
}
class Dummy:
def dummy_function(self, arg1: int, arg2: Literal["bar", "baz"]) -> None:
"""dummy function
@@ -258,6 +282,7 @@ def test_convert_to_openai_function(
dummy_tool: BaseTool,
json_schema: dict,
anthropic_tool: dict,
bedrock_converse_tool: dict,
annotated_function: Callable,
dummy_pydantic: type[BaseModel],
runnable: Runnable,
@@ -290,6 +315,7 @@ def test_convert_to_openai_function(
dummy_tool,
json_schema,
anthropic_tool,
bedrock_converse_tool,
expected,
Dummy.dummy_function,
DummyWithClassMethod.dummy_function,