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]

fix test_completion_vllm

Ishaan Jaffa420c5ba6e78
diff --git a/litellm/tests/test_text_completion.py b/litellm/tests/test_text_completion.py
index 618a6095f03..70325c44e22 100644
--- a/litellm/tests/test_text_completion.py
+++ b/litellm/tests/test_text_completion.py
@@ -4199,7 +4199,7 @@ def mock_post(*args, **kwargs):
mock_response = MagicMock()
mock_response.status_code = 200
mock_response.headers = {"Content-Type": "application/json"}
- mock_response.model_dump.return_value = {
+ mock_response.parse.return_value.model_dump.return_value = {
"id": "cmpl-7a59383dd4234092b9e5d652a7ab8143",
"object": "text_completion",
"created": 1718824735,
@@ -4226,11 +4226,13 @@ def test_completion_vllm():
client = OpenAI(api_key="my-fake-key")
- with patch.object(client.completions, "create", side_effect=mock_post) as mock_call:
+ with patch.object(
+ client.completions.with_raw_response, "create", side_effect=mock_post
+ ) as mock_call:
response = text_completion(
model="openai/gemini-1.5-flash", prompt="ping", client=client, hello="world"
)
- print(response)
+ print("raw response", response)
assert response.usage.prompt_tokens == 2