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

[Observability] Langfuse move to context manager approach #1819

Open
Benvii opened this issue Jan 10, 2025 · 0 comments
Open

[Observability] Langfuse move to context manager approach #1819

Benvii opened this issue Jan 10, 2025 · 0 comments

Comments

@Benvii
Copy link
Member

Benvii commented Jan 10, 2025

See this PR comment : #1793 (comment)

Currently we use the old langchain callback integration attach langfuse client to chain execution. The new way is based on context managers we should refactor our implementation to use this approach that is also more likely to be compatible with the auto-instrumentation approach of other observability framework such as Arize Phoenix.

PR comment :
Those are directly mapped to the langfuse attributes ... I'm thinking that this is ok untill we just have langfuse but what about langsmith or Arize Phoenix so I made some research in case we would someday implement them :

  • Arize Phoenix uses auto-instrumentation (compatible with OpenTelemetry standard and OpenInference), meaning it's not done though an explicit langchain callback
  • Langsmith SDK is now called LangChainTracer, it seems that they aren't using callbacks any more : context managers are use in the document, tags are passed by wrapping the LCEL chain ...

It seems that langfuse also recommends using decorators : https://langfuse.com/docs/sdk/python/decorators#decorator-context

I think that it would be great to investigate a bit more and maybe instead of using a callback, wrap chains calls inside python's context managers ... where the manager is build by a factory.
Also we should test LCEL chain tags with_configs (to pass tags) in a more generic way, maybe we would have to pass them to the observability provider.

Arkea's internal ref : DERCBOT-1331

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

No branches or pull requests

1 participant