(fix) Langfuse key based logging (#6372)

* langfuse use helper for get_langfuse_logging_config

* fix get_langfuse_logger_for_request

* fix import

* fix get_langfuse_logger_for_request

* test_get_langfuse_logger_for_request_with_dynamic_params

* unit testing for test_get_langfuse_logger_for_request_with_no_dynamic_params

* parameterized langfuse testing

* fix langfuse test

* fix langfuse logging

* fix test_aaalangfuse_logging_metadata

* fix langfuse log metadata test

* fix langfuse logger

* use create_langfuse_logger_from_credentials

* fix test_get_langfuse_logger_for_request_with_no_dynamic_params

* fix correct langfuse/ folder structure

* use static methods for langfuse logger

* add commment on langfuse handler

* fix linting error

* add unit testing for langfuse logging

* fix linting

* fix failure handler langfuse
This commit is contained in:
Ishaan Jaff 2024-10-23 18:24:22 +05:30 committed by GitHub
parent b70147f63b
commit 72a91ea9dd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 426 additions and 210 deletions

View file

@ -428,7 +428,7 @@ async def test_aaalangfuse_logging_metadata(langfuse_client):
await asyncio.sleep(2)
langfuse_client.flush()
# await asyncio.sleep(10)
await asyncio.sleep(4)
# Tests the metadata filtering and the override of the output to be the last generation
for trace_id, generation_ids in trace_identifiers.items():
@ -625,7 +625,7 @@ def test_aaalangfuse_existing_trace_id():
import datetime
import litellm
from litellm.integrations.langfuse import LangFuseLogger
from litellm.integrations.langfuse.langfuse import LangFuseLogger
langfuse_Logger = LangFuseLogger(
langfuse_public_key=os.getenv("LANGFUSE_PROJECT2_PUBLIC"),
@ -1125,7 +1125,7 @@ generation_params = {
)
def test_langfuse_prompt_type(prompt):
from litellm.integrations.langfuse import _add_prompt_to_generation_params
from litellm.integrations.langfuse.langfuse import _add_prompt_to_generation_params
clean_metadata = {
"prompt": {
@ -1232,7 +1232,7 @@ def test_langfuse_prompt_type(prompt):
def test_langfuse_logging_metadata():
from litellm.integrations.langfuse import log_requester_metadata
from litellm.integrations.langfuse.langfuse import log_requester_metadata
metadata = {"key": "value", "requester_metadata": {"key": "value"}}