Skip to content

langfuse integration#90

Draft
fatihbugrakdogan wants to merge 1 commit into
masterfrom
fatihb/langfuse
Draft

langfuse integration#90
fatihbugrakdogan wants to merge 1 commit into
masterfrom
fatihb/langfuse

Conversation

@fatihbugrakdogan

Copy link
Copy Markdown
Contributor

This pull request updates the OpenAI client integration in src/ra/clients/openai.py to optionally use Langfuse's tracing capabilities when available. The code now automatically wraps OpenAI API calls with Langfuse for enhanced observability if the LANGFUSE_SECRET_KEY environment variable is set and the Langfuse package is installed. Otherwise, it defaults to the standard OpenAI client.

Integration with Langfuse tracing:

  • Added conditional import and use of Langfuse's OpenAI and AsyncOpenAI clients, enabling automatic tracing when the LANGFUSE_SECRET_KEY environment variable is present.
  • Updated client instantiation in both sync and async code paths to prefer Langfuse-wrapped clients if available, falling back to standard OpenAI clients otherwise. [1] [2]

@fatihbugrakdogan fatihbugrakdogan self-assigned this Apr 14, 2026
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.

1 participant