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]

Merge branch 'main' into litellm_anthropic_streaming_tool_call_fix

Krish Dholakia93d048b1dc55
diff --cc litellm/tests/test_completion.py
index 94b8b02c1ce,a07aac5bf10..fe644b08c30
--- a/litellm/tests/test_completion.py
+++ b/litellm/tests/test_completion.py
@@@ -892,49 -892,52 +892,53 @@@ def test_completion_claude_3_base64()
"model", ["gemini/gemini-1.5-flash"] # "claude-3-sonnet-20240229",
)
def test_completion_function_plus_image(model):
- litellm.set_verbose = True
+ try:
+ litellm.set_verbose = True
- image_content = [
- {"type": "text", "text": "What’s in this image?"},
- {
- "type": "image_url",
- "image_url": {
- "url": "https://litellm-listing.s3.amazonaws.com/litellm_logo.png"
+ image_content = [
+ {"type": "text", "text": "What’s in this image?"},
+ {
+ "type": "image_url",
+ "image_url": {
+ "url": "https://litellm-listing.s3.amazonaws.com/litellm_logo.png"
+ },
},
- },
- ]
- image_message = {"role": "user", "content": image_content}
+ ]
+ image_message = {"role": "user", "content": image_content}
- tools = [
- {
- "type": "function",
- "function": {
- "name": "get_current_weather",
- "description": "Get the current weather in a given location",
- "parameters": {
- "type": "object",
- "properties": {
- "location": {
- "type": "string",
- "description": "The city and state, e.g. San Francisco, CA",
+ tools = [
+ {
+ "type": "function",
+ "function": {
+ "name": "get_current_weather",
+ "description": "Get the current weather in a given location",
+ "parameters": {
+ "type": "object",
+ "properties": {
+ "location": {
+ "type": "string",
+ "description": "The city and state, e.g. San Francisco, CA",
+ },
+ "unit": {
+ "type": "string",
+ "enum": ["celsius", "fahrenheit"],
+ },
},
- "unit": {"type": "string", "enum": ["celsius", "fahrenheit"]},
+ "required": ["location"],
},
- "required": ["location"],
},
- },
- }
- ]
+ }
+ ]
- tool_choice = {"type": "function", "function": {"name": "get_current_weather"}}
- messages = [
- {
- "role": "user",
- "content": "What's the weather like in Boston today in Fahrenheit?",
- }
- ]
+ tool_choice = {"type": "function", "function": {"name": "get_current_weather"}}
+ messages = [
+ {
+ "role": "user",
+ "content": "What's the weather like in Boston today in Fahrenheit?",
+ }
+ ]
+ try:
response = completion(
model=model,
messages=[image_message],