Skip to content

Conversation

@Miyamura80
Copy link
Owner

Summary

  • Langfuse v3 Migration: Updated utils/llm/dspy_inference.py and utils/llm/dspy_langfuse.py to use Langfuse v3.x API (direct imports, get_client(), update_current_span(), and LangfuseGeneration type).
  • Gemini Model Updates: Switched gemini-3-flash to gemini-3-flash-preview in global_config.yaml as requested.
  • Config Fix: Added DEV_ENV: dev to common/global_config.yaml to resolve Pydantic validation errors during initialization.

Testing

  • Ran make ty to verify type safety.
  • Ran make banner to verify configuration loading.

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Jan 27, 2026

Greptile Overview

Greptile Summary

This PR successfully migrates the Langfuse integration from v2 to v3.x API and updates Gemini model names to preview variants.

Key Changes:

  • Replaced langfuse.decorators imports with direct imports from langfuse package
  • Migrated langfuse_context to get_client() throughout the codebase
  • Updated method calls from update_current_observation() to update_current_span()
  • Changed type annotation from StatefulGenerationClient to LangfuseGeneration
  • Updated Gemini model names: gemini-3-flashgemini-3-flash-preview, gemini-2.5-flashgemini-2.5-flash-preview
  • Added DEV_ENV: dev to global config to resolve Pydantic validation errors
  • Updated .cursor/rules/langfuse.mdc documentation to reflect v3.x API changes

The migration is complete and consistent across all files. No old v2 API references remain in the Python codebase.

Confidence Score: 5/5

  • This PR is safe to merge with no identified risks
  • The Langfuse v3 migration is complete and consistent across all files. All deprecated API calls have been properly replaced, type annotations updated correctly, and the documentation has been updated to match. The author has verified type safety with make ty and configuration loading with make banner. No logical errors or security issues identified.
  • No files require special attention

Important Files Changed

Filename Overview
.cursor/rules/langfuse.mdc Updated documentation to reflect v3.x API migration with correct imports and method names
common/global_config.yaml Updated Gemini model names to preview variants and added DEV_ENV field for Pydantic validation
utils/llm/dspy_inference.py Migrated Langfuse import to v3.x API, removed type ignore comment
utils/llm/dspy_langfuse.py Comprehensive v3.x migration: replaced langfuse_context with get_client(), updated type annotations to LangfuseGeneration

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

2 files reviewed, 2 comments

Edit Code Review Agent Settings | Greptile

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Jan 27, 2026

Additional Comments (1)

utils/llm/dspy_langfuse.py
verify update_current_span is correct for v3 API - previously used update_current_observation; observations and spans are different concepts in Langfuse

Prompt To Fix With AI
This is a comment left during a code review.
Path: utils/llm/dspy_langfuse.py
Line: 104:108

Comment:
verify `update_current_span` is correct for v3 API - previously used `update_current_observation`; observations and spans are different concepts in Langfuse

How can I resolve this? If you propose a fix, please make it concise.

@Miyamura80 Miyamura80 merged commit c230911 into main Jan 27, 2026
11 checks passed
@github-actions github-actions bot deleted the migrate-langfuse-v3 branch January 27, 2026 17:56
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.

2 participants