Module: DSPy::Scores
- Extended by:
- T::Sig
- Defined in:
- lib/dspy/scores.rb,
lib/dspy/scores/data_type.rb,
lib/dspy/scores/evaluators.rb,
lib/dspy/scores/score_event.rb
Overview
Score reporting for Langfuse integration Provides a simple API for creating and exporting evaluation scores
Defined Under Namespace
Modules: Evaluators Classes: DataType, ScoreEvent
Class Method Summary collapse
Class Method Details
.create(name:, value:, data_type: DataType::Numeric, comment: nil, span: nil, trace_id: nil, observation_id: nil, emit: true) ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/dspy/scores.rb', line 37 def create( name:, value:, data_type: DataType::Numeric, comment: nil, span: nil, trace_id: nil, observation_id: nil, emit: true ) # Extract trace_id from context if not provided resolved_trace_id = trace_id || extract_trace_id_from_context resolved_observation_id = observation_id || extract_observation_id_from_span(span) event = ScoreEvent.new( name: name, value: value, data_type: data_type, comment: comment, trace_id: resolved_trace_id, observation_id: resolved_observation_id ) # Emit score.create event for listeners and exporters emit_score_event(event) if emit event end |