1313 * See the License for the specific language governing permissions and
1414 * limitations under the License.
1515 */
16+ // TODO: Remove unnecessary comments after all instrumentations are updated before (parent branch merge)
1617
1718export const SpanAttributes = {
1819 // Attributes not yet in @opentelemetry /semantic-conventions
20+
21+ // TODO: Remove after all instrumentations are updated
22+ // Kept for backwards compatibility
1923 GEN_AI_USAGE_CACHE_CREATION_INPUT_TOKENS :
2024 "gen_ai.usage.cache_creation_input_tokens" ,
25+
26+ // TODO: Remove after all instrumentations are updated
27+ // Kept for backwards compatibility
2128 GEN_AI_USAGE_CACHE_READ_INPUT_TOKENS : "gen_ai.usage.cache_read_input_tokens" ,
29+
2230 GEN_AI_USAGE_REASONING_TOKENS : "gen_ai.usage.reasoning_tokens" ,
2331
32+ GEN_AI_REQUEST_THINKING_TYPE : "gen_ai.request.thinking_type" ,
33+
34+ GEN_AI_REQUEST_THINKING_BUDGET_TOKENS :
35+ "gen_ai.request.thinking.budget_tokens" ,
2436 // LLM
37+
38+ // TODO: Remove after all instrumentations are updated
39+ // Kept for backwards compatibility
2540 LLM_REQUEST_TYPE : "llm.request.type" ,
41+
42+ GEN_AI_USAGE_TOTAL_TOKENS : "gen_ai.usage.total_tokens" ,
43+
44+ // TODO: Remove after all instrumentations are updated
45+ // Kept for backwards compatibility
2646 LLM_USAGE_TOTAL_TOKENS : "llm.usage.total_tokens" ,
47+
48+ // TODO: Remove after all instrumentations are updated
49+ // Kept for backwards compatibility
2750 LLM_TOP_K : "llm.top_k" ,
51+
52+ // TODO: Remove after all instrumentations are updated
53+ // Kept for backwards compatibility
2854 LLM_FREQUENCY_PENALTY : "llm.frequency_penalty" ,
55+
56+ // TODO: Remove after all instrumentations are updated
57+ // Kept for backwards compatibility
2958 LLM_PRESENCE_PENALTY : "llm.presence_penalty" ,
59+
60+ // TODO: Remove after all instrumentations are updated
61+ // Kept for backwards compatibility
3062 LLM_CHAT_STOP_SEQUENCES : "llm.chat.stop_sequences" ,
63+
64+ // TODO: Remove after all instrumentations are updated
65+ // Kept for backwards compatibility
3166 LLM_REQUEST_FUNCTIONS : "llm.request.functions" ,
3267
3368 // Vector DB
@@ -42,7 +77,7 @@ export const SpanAttributes = {
4277 VECTOR_DB_GET_INCLUDE_METADATA : "db.vector.get.include_metadata" ,
4378 VECTOR_DB_GET_INCLUDE_VALUES : "db.vector.get.include_values" ,
4479
45- // LLM Workflows
80+ // LLM Workflows (all Traceloop-specific, no OTel equivalents yet)
4681 TRACELOOP_SPAN_KIND : "traceloop.span.kind" ,
4782 TRACELOOP_WORKFLOW_NAME : "traceloop.workflow.name" ,
4883 TRACELOOP_ENTITY_NAME : "traceloop.entity.name" ,
@@ -115,3 +150,16 @@ export enum TraceloopSpanKindValues {
115150 SESSION = "session" ,
116151 UNKNOWN = "unknown" ,
117152}
153+
154+ /**
155+ * Standardized finish reason values following OpenTelemetry semantic conventions.
156+ * These should be used by all LLM provider instrumentations when mapping
157+ * provider-specific stop reasons to standard values.
158+ */
159+ export const FinishReasons = {
160+ STOP : "stop" ,
161+ LENGTH : "length" ,
162+ TOOL_CALL : "tool_call" ,
163+ CONTENT_FILTER : "content_filter" ,
164+ ERROR : "error" ,
165+ } as const ;
0 commit comments