Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

test_nova_optional_params_tool_choice

Ishaan Jaffef6bf02ac4ef
diff --git a/tests/llm_translation/test_bedrock_completion.py b/tests/llm_translation/test_bedrock_completion.py
index 917993a98c0..7afd817eb8f 100644
--- a/tests/llm_translation/test_bedrock_completion.py
+++ b/tests/llm_translation/test_bedrock_completion.py
@@ -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",
+ 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",
+ }
},
- "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",
+ "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",
},
- "required": [
- "competitve",
- "description",
- "name",
- "players_max",
- "players_min",
- "prompt",
- "turn_duration",
- ],
- "type": "object",
},
- },
- }
- ],
- tool_choice={"type": "function", "function": {"name": "GameDefinition"}},
- )
-
+ }
+ ],
+ tool_choice={"type": "function", "function": {"name": "GameDefinition"}},
+ )
+ except litellm.APIConnectionError:
+ pass
class TestBedrockEmbedding(BaseLLMEmbeddingTest):
def get_base_embedding_call_args(self) -> dict: