mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-26 11:14:04 +00:00
fix(langfuse.py): log litellm response cost as part of langfuse metadata
This commit is contained in:
parent
3ef3a7ba5f
commit
872cd2d8a0
3 changed files with 9 additions and 1 deletions
|
@ -215,7 +215,6 @@ add_function_to_prompt: bool = (
|
|||
)
|
||||
client_session: Optional[httpx.Client] = None
|
||||
aclient_session: Optional[httpx.AsyncClient] = None
|
||||
module_level_aclient = AsyncHTTPHandler()
|
||||
model_fallbacks: Optional[List] = None # Deprecated for 'litellm.fallbacks'
|
||||
model_cost_map_url: str = (
|
||||
"https://raw.githubusercontent.com/BerriAI/litellm/main/model_prices_and_context_window.json"
|
||||
|
@ -232,6 +231,7 @@ max_user_budget: Optional[float] = None
|
|||
max_end_user_budget: Optional[float] = None
|
||||
#### RELIABILITY ####
|
||||
request_timeout: float = 6000
|
||||
module_level_aclient = AsyncHTTPHandler(timeout=request_timeout)
|
||||
num_retries: Optional[int] = None # per model endpoint
|
||||
default_fallbacks: Optional[List] = None
|
||||
fallbacks: Optional[List] = None
|
||||
|
|
|
@ -396,6 +396,8 @@ class LangFuseLogger:
|
|||
cost = kwargs.get("response_cost", None)
|
||||
print_verbose(f"trace: {cost}")
|
||||
|
||||
clean_metadata["litellm_response_cost"] = cost
|
||||
|
||||
if (
|
||||
litellm._langfuse_default_tags is not None
|
||||
and isinstance(litellm._langfuse_default_tags, list)
|
||||
|
|
|
@ -29,6 +29,12 @@ model_list:
|
|||
- model_name: tts
|
||||
litellm_params:
|
||||
model: openai/tts-1
|
||||
- model_name: gpt-4-turbo-preview
|
||||
litellm_params:
|
||||
api_base: https://openai-france-1234.openai.azure.com
|
||||
api_key: os.environ/AZURE_FRANCE_API_KEY
|
||||
model: azure/gpt-turbo
|
||||
|
||||
router_settings:
|
||||
enable_pre_call_checks: true
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue