From 2e8f081a86f2665529dedc41810739fcf9582b18 Mon Sep 17 00:00:00 2001 From: Krrish Dholakia Date: Mon, 3 Jun 2024 19:25:59 -0700 Subject: [PATCH] fix(main.py): cast to string only if var is not None --- litellm/assistants/main.py | 8 ++++---- litellm/llms/azure.py | 28 ++++++++++++++++++++-------- 2 files changed, 24 insertions(+), 12 deletions(-) diff --git a/litellm/assistants/main.py b/litellm/assistants/main.py index 131896f9e05..1486b898490 100644 --- a/litellm/assistants/main.py +++ b/litellm/assistants/main.py @@ -1011,10 +1011,10 @@ def run_thread( model=model, stream=stream, tools=tools, - api_base=str(api_base), - api_key=str(api_key), - api_version=str(api_version), - azure_ad_token=str(azure_ad_token), + api_base=str(api_base) if api_base is not None else None, + api_key=str(api_key) if api_key is not None else None, + api_version=str(api_version) if api_version is not None else None, + azure_ad_token=str(azure_ad_token) if azure_ad_token is not None else None, timeout=timeout, max_retries=optional_params.max_retries, client=client, diff --git a/litellm/llms/azure.py b/litellm/llms/azure.py index 095f55cefed..8f2c51a899b 100644 --- a/litellm/llms/azure.py +++ b/litellm/llms/azure.py @@ -1319,7 +1319,9 @@ class AzureAssistantsAPI(BaseLLM): data["azure_endpoint"] = v elif v is not None: data[k] = v - azure_openai_client = AsyncAzureOpenAI(**data) # type: ignore + + azure_openai_client = AsyncAzureOpenAI(**data) + # azure_openai_client = AsyncAzureOpenAI(**data) # type: ignore else: azure_openai_client = client @@ -1888,15 +1890,25 @@ class AzureAssistantsAPI(BaseLLM): ) response = await openai_client.beta.threads.runs.create_and_poll( # type: ignore - thread_id=thread_id, - assistant_id=assistant_id, - additional_instructions=additional_instructions, - instructions=instructions, - metadata=metadata, - model=model, - tools=tools, + thread_id="thread_OHLZkEj5xJLxdk0REZ4cl9sP", + assistant_id="asst_nIzr656D1GIVMLHOKD76bN2T", + additional_instructions=None, + instructions=None, + metadata=None, + model=None, + tools=None, ) + # response = await openai_client.beta.threads.runs.create_and_poll( # type: ignore + # thread_id=thread_id, + # assistant_id=assistant_id, + # additional_instructions=additional_instructions, + # instructions=instructions, + # metadata=metadata, + # model=model, + # tools=tools, + # ) + return response # fmt: off