mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-24 18:24:20 +00:00
test for test_responses_api_routing_with_previous_response_id
This commit is contained in:
parent
10257426a2
commit
6783c9e618
1 changed files with 54 additions and 0 deletions
|
@ -29,3 +29,57 @@ class TestAzureResponsesAPITest(BaseResponsesAPITest):
|
|||
"api_key": os.getenv("AZURE_RESPONSES_OPENAI_API_KEY"),
|
||||
"api_version": os.getenv("AZURE_RESPONSES_OPENAI_API_VERSION"),
|
||||
}
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_responses_api_routing_with_previous_response_id():
|
||||
router = litellm.Router(
|
||||
model_list=[
|
||||
{
|
||||
"model_name": "azure-computer-use-preview",
|
||||
"litellm_params": {
|
||||
"model": "azure/computer-use-preview",
|
||||
"api_key": os.getenv("AZURE_RESPONSES_OPENAI_API_KEY"),
|
||||
"api_version": os.getenv("AZURE_RESPONSES_OPENAI_API_VERSION"),
|
||||
"api_base": os.getenv("AZURE_RESPONSES_OPENAI_ENDPOINT"),
|
||||
},
|
||||
},
|
||||
# {
|
||||
# "model_name": "azure-computer-use-preview",
|
||||
# "litellm_params": {
|
||||
# "model": "azure/computer-use-preview",
|
||||
# "api_key": os.getenv("AZURE_RESPONSES_OPENAI_API_KEY"),
|
||||
# "api_version": os.getenv("AZURE_RESPONSES_OPENAI_API_VERSION"),
|
||||
# "api_base": os.getenv("AZURE_RESPONSES_OPENAI_ENDPOINT_2"),
|
||||
# },
|
||||
# },
|
||||
],
|
||||
)
|
||||
MODEL = "azure-computer-use-preview"
|
||||
|
||||
litellm._turn_on_debug()
|
||||
response = await router.aresponses(
|
||||
model=MODEL,
|
||||
input="Hello, how are you?",
|
||||
truncation="auto",
|
||||
)
|
||||
|
||||
expected_model_id = response._hidden_params["model_id"]
|
||||
response_id = response.id
|
||||
|
||||
print("Response ID=", response_id, "came from model_id=", expected_model_id)
|
||||
|
||||
# make 3 other requests with previous_response_id
|
||||
# assert that this was sent to the same model_id
|
||||
for i in range(3):
|
||||
response = await router.aresponses(
|
||||
model=MODEL,
|
||||
input="Hello, how are you?",
|
||||
truncation="auto",
|
||||
previous_response_id=response_id,
|
||||
)
|
||||
|
||||
assert response._hidden_params["model_id"] == expected_model_id
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue