mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-24 18:24:20 +00:00
test_nova_optional_params_tool_choice
This commit is contained in:
parent
4a4328b5bb
commit
ef6bf02ac4
1 changed files with 59 additions and 56 deletions
|
@ -2430,63 +2430,66 @@ def test_bedrock_process_empty_text_blocks():
|
|||
assert modified_message["content"][0]["text"] == "Please continue."
|
||||
|
||||
|
||||
def test_nova_optional_params_tool_choice():
|
||||
litellm.drop_params = True
|
||||
litellm.set_verbose = True
|
||||
litellm.completion(
|
||||
messages=[
|
||||
{"role": "user", "content": "A WWII competitive game for 4-8 players"}
|
||||
],
|
||||
model="bedrock/us.amazon.nova-pro-v1:0",
|
||||
temperature=0.3,
|
||||
tools=[
|
||||
{
|
||||
"type": "function",
|
||||
"function": {
|
||||
"name": "GameDefinition",
|
||||
"description": "Correctly extracted `GameDefinition` with all the required parameters with correct types",
|
||||
"parameters": {
|
||||
"$defs": {
|
||||
"TurnDurationEnum": {
|
||||
"enum": ["action", "encounter", "battle", "operation"],
|
||||
"title": "TurnDurationEnum",
|
||||
"type": "string",
|
||||
}
|
||||
},
|
||||
"properties": {
|
||||
"id": {
|
||||
"anyOf": [{"type": "integer"}, {"type": "null"}],
|
||||
"default": None,
|
||||
"title": "Id",
|
||||
},
|
||||
"prompt": {"title": "Prompt", "type": "string"},
|
||||
"name": {"title": "Name", "type": "string"},
|
||||
"description": {"title": "Description", "type": "string"},
|
||||
"competitve": {"title": "Competitve", "type": "boolean"},
|
||||
"players_min": {"title": "Players Min", "type": "integer"},
|
||||
"players_max": {"title": "Players Max", "type": "integer"},
|
||||
"turn_duration": {
|
||||
"$ref": "#/$defs/TurnDurationEnum",
|
||||
"description": "how long the passing of a turn should represent for a game at this scale",
|
||||
},
|
||||
},
|
||||
"required": [
|
||||
"competitve",
|
||||
"description",
|
||||
"name",
|
||||
"players_max",
|
||||
"players_min",
|
||||
"prompt",
|
||||
"turn_duration",
|
||||
],
|
||||
"type": "object",
|
||||
},
|
||||
},
|
||||
}
|
||||
],
|
||||
tool_choice={"type": "function", "function": {"name": "GameDefinition"}},
|
||||
)
|
||||
|
||||
def test_nova_optional_params_tool_choice():
|
||||
try:
|
||||
litellm.drop_params = True
|
||||
litellm.set_verbose = True
|
||||
litellm.completion(
|
||||
messages=[
|
||||
{"role": "user", "content": "A WWII competitive game for 4-8 players"}
|
||||
],
|
||||
model="bedrock/us.amazon.nova-pro-v1:0",
|
||||
temperature=0.3,
|
||||
tools=[
|
||||
{
|
||||
"type": "function",
|
||||
"function": {
|
||||
"name": "GameDefinition",
|
||||
"description": "Correctly extracted `GameDefinition` with all the required parameters with correct types",
|
||||
"parameters": {
|
||||
"$defs": {
|
||||
"TurnDurationEnum": {
|
||||
"enum": ["action", "encounter", "battle", "operation"],
|
||||
"title": "TurnDurationEnum",
|
||||
"type": "string",
|
||||
}
|
||||
},
|
||||
"properties": {
|
||||
"id": {
|
||||
"anyOf": [{"type": "integer"}, {"type": "null"}],
|
||||
"default": None,
|
||||
"title": "Id",
|
||||
},
|
||||
"prompt": {"title": "Prompt", "type": "string"},
|
||||
"name": {"title": "Name", "type": "string"},
|
||||
"description": {"title": "Description", "type": "string"},
|
||||
"competitve": {"title": "Competitve", "type": "boolean"},
|
||||
"players_min": {"title": "Players Min", "type": "integer"},
|
||||
"players_max": {"title": "Players Max", "type": "integer"},
|
||||
"turn_duration": {
|
||||
"$ref": "#/$defs/TurnDurationEnum",
|
||||
"description": "how long the passing of a turn should represent for a game at this scale",
|
||||
},
|
||||
},
|
||||
"required": [
|
||||
"competitve",
|
||||
"description",
|
||||
"name",
|
||||
"players_max",
|
||||
"players_min",
|
||||
"prompt",
|
||||
"turn_duration",
|
||||
],
|
||||
"type": "object",
|
||||
},
|
||||
},
|
||||
}
|
||||
],
|
||||
tool_choice={"type": "function", "function": {"name": "GameDefinition"}},
|
||||
)
|
||||
except litellm.APIConnectionError:
|
||||
pass
|
||||
|
||||
class TestBedrockEmbedding(BaseLLMEmbeddingTest):
|
||||
def get_base_embedding_call_args(self) -> dict:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue