mirror of
https://github.com/BerriAI/litellm.git
synced 2026-08-28 05:25:59 +00:00
Some checks failed
Unit Tests: Caching (Redis) / caching-redis (push) Has been cancelled
Unit Tests: Proxy DB Operations / assert-shard-coverage (push) Has been cancelled
Unit Tests: Security / security (push) Has been cancelled
Unit Tests: Proxy DB Operations / auth-checks (push) Has been cancelled
Unit Tests: Proxy DB Operations / budgets (push) Has been cancelled
Unit Tests: Proxy DB Operations / custom-logging (push) Has been cancelled
Unit Tests: Proxy DB Operations / db-and-spend (push) Has been cancelled
Unit Tests: Proxy DB Operations / proxy-runtime (push) Has been cancelled
Unit Tests: Proxy DB Operations / endpoints-and-responses (push) Has been cancelled
Unit Tests: Proxy DB Operations / guardrails-hooks (push) Has been cancelled
Unit Tests: Proxy DB Operations / jwt-and-keys (push) Has been cancelled
Unit Tests: Proxy DB Operations / key-generation (push) Has been cancelled
Unit Tests: Proxy DB Operations / logging-misc (push) Has been cancelled
Unit Tests: Proxy DB Operations / proxy-server-core (push) Has been cancelled
Unit Tests: Proxy DB Operations / schema-migration (push) Has been cancelled
Unit Tests: Proxy DB Operations / proxy-utils (push) Has been cancelled
47 lines
1.4 KiB
Python
47 lines
1.4 KiB
Python
import os
|
|
import sys
|
|
import pytest
|
|
|
|
sys.path.insert(
|
|
0, os.path.abspath("../..")
|
|
) # Adds the parent directory to the system paths
|
|
import litellm
|
|
|
|
|
|
def test_completion_openrouter_reasoning_content():
|
|
litellm._turn_on_debug()
|
|
resp = litellm.completion(
|
|
model="openrouter/anthropic/claude-sonnet-4",
|
|
messages=[{"role": "user", "content": "Hello world"}],
|
|
reasoning={"effort": "high"},
|
|
)
|
|
print(resp)
|
|
assert resp.choices[0].message.reasoning_content is not None
|
|
|
|
|
|
def test_completion_openrouter_image_generation():
|
|
litellm._turn_on_debug()
|
|
resp = litellm.completion(
|
|
model="openrouter/google/gemini-2.5-flash-image",
|
|
messages=[{"role": "user", "content": "Generate an image of a cat"}],
|
|
modalities=["image", "text"],
|
|
)
|
|
print(resp)
|
|
assert (
|
|
resp.choices[0].message.images[0]["image_url"]["url"].startswith("data:image/")
|
|
)
|
|
|
|
|
|
def test_openrouter_embedding():
|
|
"""Test OpenRouter embeddings support."""
|
|
litellm._turn_on_debug()
|
|
resp = litellm.embedding(
|
|
model="openrouter/openai/text-embedding-3-small",
|
|
input=["Hello world", "How are you?"],
|
|
)
|
|
print(resp)
|
|
assert resp is not None
|
|
assert len(resp.data) == 2
|
|
assert resp.data[0]["embedding"] is not None
|
|
assert isinstance(resp.data[0]["embedding"], list)
|
|
assert len(resp.data[0]["embedding"]) > 0
|