Files
zeekay d094a8b481 rebrand: rename litellm module to llm — complete purge
All imports, test files, docs, and config references updated.
import litellm → import llm across entire codebase.
2026-02-25 15:13:14 -08:00

49 lines
1.4 KiB
Python

"""E2E integration tests for LLM providers.
These tests require real API keys and make actual API calls.
Only run in CI with proper secrets configured.
"""
import os
import llm
import pytest
@pytest.mark.skipif(
not os.environ.get("OPENAI_API_KEY"),
reason="OPENAI_API_KEY environment variable not set",
)
@pytest.mark.asyncio
async def test_llm_openai_provider_integration():
"""Integration test: LLM with real OpenAI provider."""
messages = [{"role": "user", "content": "Hello, how are you?"}]
try:
response = llm.completion(
model="openai/gpt-3.5-turbo",
messages=messages,
)
assert response.choices[0].message.content is not None
except Exception as e:
pytest.skip(f"OpenAI API connection failed: {type(e).__name__} - {str(e)}")
@pytest.mark.skipif(
not os.environ.get("ANTHROPIC_API_KEY"),
reason="ANTHROPIC_API_KEY environment variable not set",
)
@pytest.mark.asyncio
async def test_llm_anthropic_provider_integration():
"""Integration test: LLM with real Anthropic provider."""
messages = [{"role": "user", "content": "Hello, how are you?"}]
try:
response = llm.completion(
model="anthropic/claude-3-haiku-20240307",
messages=messages,
)
assert response.choices[0].message.content is not None
except Exception as e:
pytest.skip(f"Anthropic API connection failed: {type(e).__name__} - {str(e)}")