forked from phoenix/litellm-mirror
fix(langfuse.py): remove print statements
This commit is contained in:
parent
bdfb74f8a5
commit
3b803b09d9
1 changed files with 3 additions and 6 deletions
|
@ -161,7 +161,7 @@ class LangFuseLogger:
|
||||||
verbose_logger.info(f"Langfuse Layer Logging - logging success")
|
verbose_logger.info(f"Langfuse Layer Logging - logging success")
|
||||||
except:
|
except:
|
||||||
traceback.print_exc()
|
traceback.print_exc()
|
||||||
print(f"Langfuse Layer Error - {traceback.format_exc()}")
|
verbose_logger.debug(f"Langfuse Layer Error - {traceback.format_exc()}")
|
||||||
pass
|
pass
|
||||||
|
|
||||||
async def _async_log_event(
|
async def _async_log_event(
|
||||||
|
@ -190,7 +190,7 @@ class LangFuseLogger:
|
||||||
):
|
):
|
||||||
from langfuse.model import CreateTrace, CreateGeneration
|
from langfuse.model import CreateTrace, CreateGeneration
|
||||||
|
|
||||||
print(
|
verbose_logger.warning(
|
||||||
"Please upgrade langfuse to v2.0.0 or higher: https://github.com/langfuse/langfuse-python/releases/tag/v2.0.1"
|
"Please upgrade langfuse to v2.0.0 or higher: https://github.com/langfuse/langfuse-python/releases/tag/v2.0.1"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -247,7 +247,6 @@ class LangFuseLogger:
|
||||||
|
|
||||||
print_verbose(f"Langfuse Layer Logging - logging to langfuse v2 ")
|
print_verbose(f"Langfuse Layer Logging - logging to langfuse v2 ")
|
||||||
|
|
||||||
print(f"response_obj: {response_obj}")
|
|
||||||
if supports_tags:
|
if supports_tags:
|
||||||
metadata_tags = metadata.get("tags", [])
|
metadata_tags = metadata.get("tags", [])
|
||||||
tags = metadata_tags
|
tags = metadata_tags
|
||||||
|
@ -312,13 +311,11 @@ class LangFuseLogger:
|
||||||
usage = None
|
usage = None
|
||||||
if response_obj is not None and response_obj.get("id", None) is not None:
|
if response_obj is not None and response_obj.get("id", None) is not None:
|
||||||
generation_id = litellm.utils.get_logging_id(start_time, response_obj)
|
generation_id = litellm.utils.get_logging_id(start_time, response_obj)
|
||||||
print(f"getting usage, cost={cost}")
|
|
||||||
usage = {
|
usage = {
|
||||||
"prompt_tokens": response_obj["usage"]["prompt_tokens"],
|
"prompt_tokens": response_obj["usage"]["prompt_tokens"],
|
||||||
"completion_tokens": response_obj["usage"]["completion_tokens"],
|
"completion_tokens": response_obj["usage"]["completion_tokens"],
|
||||||
"total_cost": cost if supports_costs else None,
|
"total_cost": cost if supports_costs else None,
|
||||||
}
|
}
|
||||||
print(f"constructed usage - {usage}")
|
|
||||||
generation_name = metadata.get("generation_name", None)
|
generation_name = metadata.get("generation_name", None)
|
||||||
if generation_name is None:
|
if generation_name is None:
|
||||||
# just log `litellm-{call_type}` as the generation name
|
# just log `litellm-{call_type}` as the generation name
|
||||||
|
@ -351,4 +348,4 @@ class LangFuseLogger:
|
||||||
|
|
||||||
trace.generation(**generation_params)
|
trace.generation(**generation_params)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"Langfuse Layer Error - {traceback.format_exc()}")
|
verbose_logger.debug(f"Langfuse Layer Error - {traceback.format_exc()}")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue