fixes for assistans API tests

This commit is contained in:
Ishaan Jaff 2025-04-19 07:59:53 -07:00
parent 5bf76f0bb1
commit a62805f98f
2 changed files with 8 additions and 5 deletions

View file

@ -304,6 +304,11 @@ def create_assistants(
"response_format": response_format, "response_format": response_format,
} }
# only send params that are not None
create_assistant_data = {
k: v for k, v in create_assistant_data.items() if v is not None
}
response: Optional[Union[Coroutine[Any, Any, Assistant], Assistant]] = None response: Optional[Union[Coroutine[Any, Any, Assistant], Assistant]] = None
if custom_llm_provider == "openai": if custom_llm_provider == "openai":
api_base = ( api_base = (

View file

@ -74,9 +74,10 @@ async def test_get_assistants(provider, sync_mode):
@pytest.mark.flaky(retries=3, delay=1) @pytest.mark.flaky(retries=3, delay=1)
async def test_create_delete_assistants(provider, sync_mode): async def test_create_delete_assistants(provider, sync_mode):
litellm.ssl_verify = False litellm.ssl_verify = False
litellm._turn_on_debug()
data = { data = {
"custom_llm_provider": provider, "custom_llm_provider": provider,
"model": "gpt-4-turbo", "model": "gpt-4.5-preview",
"instructions": "You are a personal math tutor. When asked a question, write and run Python code to answer the question.", "instructions": "You are a personal math tutor. When asked a question, write and run Python code to answer the question.",
"name": "Math Tutor", "name": "Math Tutor",
"tools": [{"type": "code_interpreter"}], "tools": [{"type": "code_interpreter"}],
@ -106,10 +107,7 @@ async def test_create_delete_assistants(provider, sync_mode):
print("Response deleting assistant", response) print("Response deleting assistant", response)
assert response.id == assistant.id assert response.id == assistant.id
else: else:
assistant = await litellm.acreate_assistants( assistant = await litellm.acreate_assistants(**data)
custom_llm_provider=provider,
**data,
)
print("New assistants", assistant) print("New assistants", assistant)
assert isinstance(assistant, Assistant) assert isinstance(assistant, Assistant)
assert ( assert (