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

[FEATURE] Set custom langfuse trace ID #2808

Open
danieldabate opened this issue Jul 16, 2024 · 3 comments
Open

[FEATURE] Set custom langfuse trace ID #2808

danieldabate opened this issue Jul 16, 2024 · 3 comments
Labels
enhancement New feature or request

Comments

@danieldabate
Copy link
Contributor

Describe the feature you'd like
When using langfuse the trace ID is randomly generated, this the default behaviour of the langfuse SDK. After the trace is created there is no way of matching a langfuse trace with a Flowise message.

One limitation of this is that it's impossible to use langfuse score API to store the feedback from the user, because we don't have the trace id of each message.

Different solution approaches could be:

  • Allowing to set the trace ID through the input params when running a prediction. This is currently being used to inject values in langfuse like the user id.
  • Always set the message id as trace id in langfuse.
  • Return with the prediction response also the trace id.

I checked the code and Flowise is using both langfuse and langfuse-langchain SDKs for different use cases. I'm not entirely sure which use case use which SDK. I'm testing a basic chain flow and it uses the langfuse-langchain SDK.

There is also an ongoing dicussion on langfuse side: https://github.com/orgs/langfuse/discussions/953

@HenryHengZJ HenryHengZJ added the enhancement New feature or request label Jul 21, 2024
@HenryHengZJ
Copy link
Contributor

I think its somewhat similar in this PR (https://github.com/FlowiseAI/Flowise/pull/2195/files) where we used a correlationId to track the parent message

@danieldabate
Copy link
Contributor Author

I'm not sure how that correlationId is stored in Langchain, but we need the traceId anyways to do things through Langfuse's API.

What we are doing in the meantime is using the metadata field of the traces to store a custom responseId and then before setting a score for that trace, we go over all the traces in the session and get the one matching the responseId to get the traceId. This works but it's very hacky.

@automacao-topnet
Copy link

How do you set this metadata to each trace? @danieldabate

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

No branches or pull requests

3 participants