Skip to content

Upgrade Langfuse tracing integration to Python SDK v4Β #2853

Description

@hassiebp

Hi Ragas team πŸ‘‹ β€” I'm Hassieb from the Langfuse team.

Langfuse Cloud's Fast Preview requires Python SDK v4.7.0+ for real-time data. Ragas' tracing extra currently allows any langfuse>=3.2.4, while parts of the docs still use removed v2 context imports.

From the current integration, the concrete migration looks like:

  • Constrain the extra to langfuse>=4.7,<5.
  • Update examples from langfuse.decorators/langfuse_context to top-level observe and get_client().
  • Replace langfuse_context.score_current_trace(...) with the v4 client scoring API, and use propagate_attributes() for user/session context.
  • If LangfuseTrace.sync_trace() and filter() remain public, make them fetch/filter real v4 API data rather than returning placeholder objects.
  • Add a test that imports the real v4 package and runs the documented tracing flow.

The relevant guide is Python SDK v3β†’v4.

If you need support with the migration, we're happy to jump on a call or help review a PR.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions