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_completion_claude_3_function_call_with_otel

Ishaan Jaffer38ccfb4234d0
diff --git a/tests/logging_callback_tests/test_otel_logging.py b/tests/logging_callback_tests/test_otel_logging.py
index 8d1da0439d3..3350c6c2dbd 100644
--- a/tests/logging_callback_tests/test_otel_logging.py
+++ b/tests/logging_callback_tests/test_otel_logging.py
@@ -138,64 +138,6 @@ def validate_raw_gen_ai_request_openai_streaming(span):
assert span._attributes[attr] is not None, f"Attribute {attr} has None"
- "model",
- ["anthropic/claude-3-opus-20240229"],
-)
[email protected](retries=6, delay=2)
-def test_completion_claude_3_function_call_with_otel(model):
- litellm.set_verbose = True
-
- litellm.callbacks = [OpenTelemetry(config=OpenTelemetryConfig(exporter=exporter))]
- 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"]},
- },
- "required": ["location"],
- },
- },
- }
- ]
- messages = [
- {
- "role": "user",
- "content": "What's the weather like in Boston today in Fahrenheit?",
- }
- ]
- try:
- # test without max tokens
- response = litellm.completion(
- model=model,
- messages=messages,
- tools=tools,
- tool_choice={
- "type": "function",
- "function": {"name": "get_current_weather"},
- },
- drop_params=True,
- )
-
- print("response from LiteLLM", response)
- except litellm.InternalServerError:
- pass
- except Exception as e:
- pytest.fail(f"Error occurred: {e}")
- finally:
- # clear in memory exporter
- exporter.clear()
-
-
@pytest.mark.asyncio
@pytest.mark.parametrize("streaming", [True, False])
@pytest.mark.parametrize("global_redact", [True, False])