Skip to content

Conversation

@vincentkoc
Copy link
Member

Details

Add some improvements and refactoring for LLM calls mostly to centralize trace tagging and manipulation. Added support (partially) to block tracing if enabled.

Change checklist

  • User facing
  • Documentation update

Issues

  • Resolves #
  • OPIK-00000

Testing

Locally

Documentation

n.a

@vincentkoc vincentkoc requested a review from dsblank as a code owner November 25, 2025 05:39
Copilot AI review requested due to automatic review settings November 25, 2025 05:39
@vincentkoc vincentkoc requested a review from a team as a code owner November 25, 2025 05:39
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors and centralizes trace tagging functionality for LLM calls in the optimizer SDK. The main purpose is to standardize how optimization traces are tagged across different optimizer implementations and add support for conditionally disabling tracing based on environment variables.

Key changes:

  • Centralized trace tagging logic in BaseOptimizer with a new _tag_trace() helper method
  • Added optimizer short name mapping for consistent tag prefixes across all optimizer types
  • Implemented conditional tracing based on OPIK_TRACK_DISABLE and OPIK_API_KEY environment variables

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
optimizable_agent.py Added trace_phase attribute and automatic trace tagging during LLM completions
base_optimizer.py Added _tag_trace() centralized method and optimizer short name mapping
meta_prompt_optimizer/ops/evaluation_ops.py Removed manual trace tagging code, replaced with centralized helper
hierarchical_reflective_optimizer.py Removed manual trace tagging code, replaced with centralized helper
gepa_optimizer.py Removed manual trace tagging code, replaced with centralized helper
few_shot_bayesian_optimizer.py Removed manual trace tagging code, replaced with centralized helper
evolutionary_optimizer/ops/evaluation_ops.py Removed manual trace tagging code, replaced with centralized helper
_llm_calls.py Added stack-based trace tagging, optimizer short name detection, and conditional tracing logic

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants