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(e2e): cover /v1/responses OpenAI vision and Anthropic basic (#33838)

devin-ai-integration[bot]4f8d83ca855f
diff --git a/tests/e2e/llm_translation/endpoints_client.py b/tests/e2e/llm_translation/endpoints_client.py
index f60e5e589ff..e901ff6c5d6 100644
--- a/tests/e2e/llm_translation/endpoints_client.py
+++ b/tests/e2e/llm_translation/endpoints_client.py
@@ -37,9 +37,30 @@ class ResponsesFunctionTool(BaseModel):
parameters: FunctionParameters
+class ResponsesInputTextPart(BaseModel):
+ type: Literal["input_text"] = "input_text"
+ text: str
+
+
+class ResponsesInputImagePart(BaseModel):
+ type: Literal["input_image"] = "input_image"
+ image_url: str
+
+
+ResponsesInputContentPart = ResponsesInputTextPart | ResponsesInputImagePart
+
+
+class ResponsesInputMessage(BaseModel):
+ role: Literal["user", "assistant", "system"] = "user"
+ content: list[ResponsesInputContentPart]
+
+
+ResponsesInput = str | list[ResponsesInputMessage]
+
+
class ResponsesRequest(BaseModel):
model: str
- input: str
+ input: ResponsesInput
instructions: str | None = None
stream: bool = False
tools: list[ResponsesFunctionTool] | None = None
@@ -236,6 +257,26 @@ class EndpointsClient:
stream=stream,
)
+ def responses_vision(
+ self, key: str, model: str, text: str, image_url: str
+ ) -> StreamingResponse:
+ return self._send(
+ "/v1/responses",
+ key,
+ ResponsesRequest(
+ model=model,
+ input=[
+ ResponsesInputMessage(
+ content=[
+ ResponsesInputTextPart(text=text),
+ ResponsesInputImagePart(image_url=image_url),
+ ]
+ )
+ ],
+ instructions="You are a helpful assistant",
+ ),
+ )
+
def responses_with_tools(
self, key: str, model: str, text: str, tools: list[ResponsesFunctionTool]
) -> StreamingResponse:
diff --git a/tests/e2e/llm_translation/test_responses_e2e.py b/tests/e2e/llm_translation/test_responses_e2e.py
index f02721f23b5..bd98f11c045 100644
--- a/tests/e2e/llm_translation/test_responses_e2e.py
+++ b/tests/e2e/llm_translation/test_responses_e2e.py
@@ -144,6 +144,52 @@ class TestResponses:
arguments = WeatherArguments.model_validate(raw_arguments)
assert arguments.location, f"function call arguments missing location: {function_call.arguments}"
+ @pytest.mark.covers("llm.responses.openai.vision.nonstream.works")
+ def test_responses_vision_describes_image(
+ self, endpoints_client: EndpointsClient, resources: ResourceManager
+ ) -> None:
+ model = f"e2e-responses-{unique_marker()}"
+ model_id = endpoints_client.create_model(
+ model,
+ LiteLLMParamsBody(model="openai/gpt-4o", api_key="os.environ/OPENAI_API_KEY"),
+ )
+ resources.defer(lambda: endpoints_client.delete_model(model_id))
+ key = resources.key()
+
+ result = endpoints_client.responses_vision(
+ key,
+ model,
+ "What animal is shown in this image? Answer in one word",
+ "https://upload.wikimedia.org/wikipedia/commons/3/3a/Cat03.jpg",
+ )
+ require_successful_call(result)
+ parsed = ResponsesResult.model_validate_json(result.body)
+ text = parsed.text.strip().lower()
+ assert text, f"/responses vision returned no output text: {result.body[:300]}"
+ assert any(
+ keyword in text
+ for keyword in ("cat", "feline")
+ ), f"vision response did not describe the image: {parsed.text[:300]}"
+
+ @pytest.mark.covers("llm.responses.anthropic.basic.nonstream.works")
+ def test_responses_anthropic_returns_completion(
+ self, endpoints_client: EndpointsClient, resources: ResourceManager
+ ) -> None:
+ model = f"e2e-responses-{unique_marker()}"
+ model_id = endpoints_client.create_model(
+ model,
+ LiteLLMParamsBody(
+ model="anthropic/claude-haiku-4-5", api_key="os.environ/ANTHROPIC_API_KEY"
+ ),
+ )
+ resources.defer(lambda: endpoints_client.delete_model(model_id))
+ key = resources.key()
+
+ result = endpoints_client.responses(key, model, "reply with one word")
+ require_successful_call(result)
+ parsed = ResponsesResult.model_validate_json(result.body)
+ assert parsed.text.strip(), f"/responses returned no output text: {result.body[:300]}"
+
def _parse_stream_event(
event: str,