refactor(main.py): trigger new build

This commit is contained in:
Krrish Dholakia 2024-05-11 22:53:09 -07:00
parent 99e8f0715e
commit 61143c8b45

View file

@ -14,6 +14,7 @@ import dotenv, traceback, random, asyncio, time, contextvars
from copy import deepcopy from copy import deepcopy
import httpx import httpx
import litellm import litellm
from ._logging import verbose_logger from ._logging import verbose_logger
from litellm import ( # type: ignore from litellm import ( # type: ignore
client, client,
@ -1213,11 +1214,12 @@ def completion(
) )
response = model_response response = model_response
elif ("clarifai" in model elif (
or custom_llm_provider == "clarifai" "clarifai" in model
or model in litellm.clarifai_models or custom_llm_provider == "clarifai"
): or model in litellm.clarifai_models
clarifai_key = None ):
clarifai_key = None
clarifai_key = ( clarifai_key = (
api_key api_key
or litellm.clarifai_key or litellm.clarifai_key
@ -1225,14 +1227,14 @@ def completion(
or get_secret("CLARIFAI_API_KEY") or get_secret("CLARIFAI_API_KEY")
or get_secret("CLARIFAI_API_TOKEN") or get_secret("CLARIFAI_API_TOKEN")
) )
api_base = ( api_base = (
api_base api_base
or litellm.api_base or litellm.api_base
or get_secret("CLARIFAI_API_BASE") or get_secret("CLARIFAI_API_BASE")
or "https://api.clarifai.com/v2" or "https://api.clarifai.com/v2"
) )
custom_prompt_dict = custom_prompt_dict or litellm.custom_prompt_dict custom_prompt_dict = custom_prompt_dict or litellm.custom_prompt_dict
model_response = clarifai.completion( model_response = clarifai.completion(
model=model, model=model,
@ -1249,7 +1251,7 @@ def completion(
logging_obj=logging, logging_obj=logging,
custom_prompt_dict=custom_prompt_dict, custom_prompt_dict=custom_prompt_dict,
) )
if "stream" in optional_params and optional_params["stream"] == True: if "stream" in optional_params and optional_params["stream"] == True:
# don't try to access stream object, # don't try to access stream object,
## LOGGING ## LOGGING
@ -1258,7 +1260,7 @@ def completion(
api_key=api_key, api_key=api_key,
original_response=model_response, original_response=model_response,
) )
if optional_params.get("stream", False) or acompletion == True: if optional_params.get("stream", False) or acompletion == True:
## LOGGING ## LOGGING
logging.post_call( logging.post_call(