fix(main.py): init custom llm provider earlier

This commit is contained in:
Krrish Dholakia 2024-01-11 18:30:10 +05:30
parent bfa26dd5b3
commit 1378190dbf

View file

@ -232,6 +232,9 @@ async def acompletion(
"model_list": model_list,
"acompletion": True, # assuming this is a required parameter
}
_, custom_llm_provider, _, _ = get_llm_provider(
model=model, api_base=completion_kwargs.get("base_url", None)
)
try:
# Use a partial function to pass your keyword arguments
func = partial(completion, **completion_kwargs, **kwargs)
@ -240,10 +243,6 @@ async def acompletion(
ctx = contextvars.copy_context()
func_with_context = partial(ctx.run, func)
_, custom_llm_provider, _, _ = get_llm_provider(
model=model, api_base=completion_kwargs.get("base_url", None)
)
if (
custom_llm_provider == "openai"
or custom_llm_provider == "azure"