Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Langfuse integration support for parent_observation_id parameter #3559

Open
wants to merge 15 commits into
base: main
Choose a base branch
from

Conversation

hburrichter
Copy link

@hburrichter hburrichter commented May 10, 2024

Title

Langfuse integration support for parent_observation_id parameter

Relevant issues

Fixes #3558
Related to #1832

Type

🆕 New Feature
📖 Documentation

Changes

LangFuseLogger now receives the parent_observation_id metadata value and passes it along to the Langfuse generation object.

Testing

Notes

Pre-Submission Checklist (optional but appreciated):

  • I have included relevant documentation updates (stored in /docs/my-website)

OS Tests (optional but appreciated):

  • Tested on Windows
  • Tested on MacOS
  • Tested on Linux

Copy link

vercel bot commented May 10, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
litellm ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 21, 2024 4:48pm

Copy link
Contributor

@krrishdholakia krrishdholakia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hburrichter thanks for the PR - please attach a screenshot of it passing 'test_alangfuse.py'

cd litellm/litellm/tests
pytest test_alangfuse.py -x -vv

@@ -437,6 +437,7 @@ def _log_langfuse_v2(
generation_params = {
"name": generation_name,
"id": clean_metadata.pop("generation_id", generation_id),
"parent_observation_id": metadata.get("parent_observation_id"),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this would raise an error if the value is None i believe, as the dictionary would now contain a 'None' object

can you instead have this below in an if metadata.get('parent_observation_id') is not None statement

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have this PR branch in production in our application it does not raise an error.
But I will add it anyway to make sure, that future Langfuse updates do not potentially break this!

@Manouchehri
Copy link
Collaborator

Bump on this, I'd like to see this in prod soon :D

@krrishdholakia
Copy link
Contributor

@hburrichter is this ready for review?

@krrishdholakia
Copy link
Contributor

If you can share a screenshot of it passing test_alangfuse.py, that should be sufficient

cd litellm/litellm
pytest test_alangfuse.py -x -vv

@krrishdholakia
Copy link
Contributor

bump on this? @hburrichter

@hburrichter
Copy link
Author

@krrishdholakia @Manouchehri

Sorry, guys, I have been extremely busy the last 10 days and did not get the tests up and running on the first try. I will try again this evening or tomorrow.

@hburrichter
Copy link
Author

Got it!
The problem was, that the Langfuse keys were not read from the .env file. I pasted them manually in the test file in the langfuse_client() fixture and the tests then worked fine:

Screenshot 2024-05-21 at 18 44 44

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature]: Langfuse integration support for parent_observation_id parameter
3 participants