Module: Langfuse::Types
- Defined in:
- lib/langfuse/types.rb
Overview
Type definitions and constants for Langfuse domain models
Provides observation type constants and attribute classes for type-safe handling of Langfuse observations and traces.
Defined Under Namespace
Classes: EmbeddingAttributes, GenerationAttributes, SpanAttributes, TraceAttributes
Constant Summary collapse
- OBSERVATION_TYPES =
Types of observations that can be created in Langfuse
span: General-purpose observations for tracking operations, functions, or logical units of workgeneration: Specialized observations for LLM calls with model parameters, usage, and costsevent: Point-in-time occurrences or log entries within a traceembedding: Observations for embedding generation callsagent: Observations for agent-based workflowstool: Observations for tool/function callschain: Observations for chain-based workflowsretriever: Observations for retrieval operationsevaluator: Observations for evaluation operationsguardrail: Observations for guardrail checks
%w[ span generation event embedding agent tool chain retriever evaluator guardrail ].freeze
- LEVELS =
Severity levels for observations in Langfuse
Used to categorize the importance or severity of observations:
DEBUG: Detailed diagnostic informationDEFAULT: Normal operation informationWARNING: Potentially problematic situationsERROR: Error conditions that need attention
%w[DEBUG DEFAULT WARNING ERROR].freeze
- SCORE_DATA_TYPES =
Data types for Langfuse scores
Used to categorize score values:
numeric: Numeric values (Integer, Float, BigDecimal)boolean: Boolean values (true/false or 0/1)categorical: String values for categorical scorestext: Free-form String values (1 to 500 characters)correction: Corrected output String attached to a trace or observation (conventionally named "output")
{ numeric: "NUMERIC", boolean: "BOOLEAN", categorical: "CATEGORICAL", text: "TEXT", correction: "CORRECTION" }.freeze
- VALID_SCORE_DATA_TYPES =
Valid score data type symbols
SCORE_DATA_TYPES.keys.freeze
- EXPERIMENT_SCORE_DATA_TYPES =
Score data types accepted by experiment evaluations
Experiment evaluations represent metrics, so this set is intentionally narrower than SCORE_DATA_TYPES: text notes and corrected outputs are general scores, not experiment metrics (matching langfuse-python).
%i[numeric boolean categorical].freeze
- EventAttributes =
Alias for event observation attributes (same as SpanAttributes)
SpanAttributes- AgentAttributes =
Alias for agent observation attributes (same as SpanAttributes)
SpanAttributes- ToolAttributes =
Alias for tool observation attributes (same as SpanAttributes)
SpanAttributes- ChainAttributes =
Alias for chain observation attributes (same as SpanAttributes)
SpanAttributes- RetrieverAttributes =
Alias for retriever observation attributes (same as SpanAttributes)
SpanAttributes- EvaluatorAttributes =
Alias for evaluator observation attributes (same as SpanAttributes)
SpanAttributes- GuardrailAttributes =
Alias for guardrail observation attributes (same as SpanAttributes)
SpanAttributes