fix(main.py): cast to string only if var is not None

This commit is contained in:
Krrish Dholakia 2024-06-03 19:25:59 -07:00
parent 7163bce37b
commit 2e8f081a86
2 changed files with 24 additions and 12 deletions

View file

@ -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,

View file

@ -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