Skip to content

Commit d07517d

Browse files
committed
feat(core): Add shared GenAI agent attribute constants
1 parent c897e76 commit d07517d

File tree

2 files changed

+45
-0
lines changed

2 files changed

+45
-0
lines changed

packages/core/src/index.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,22 @@ export { _INTERNAL_getSpanForToolCallId, _INTERNAL_cleanupToolCallSpan } from '.
132132
export { instrumentOpenAiClient } from './utils/openai';
133133
export { OPENAI_INTEGRATION_NAME } from './utils/openai/constants';
134134
export { instrumentAnthropicAiClient } from './utils/anthropic-ai';
135+
export { setTokenUsageAttributes } from './utils/ai/utils';
136+
export {
137+
GEN_AI_AGENT_NAME_ATTRIBUTE,
138+
GEN_AI_OPERATION_NAME_ATTRIBUTE,
139+
GEN_AI_REQUEST_MESSAGES_ATTRIBUTE,
140+
GEN_AI_REQUEST_MODEL_ATTRIBUTE,
141+
GEN_AI_RESPONSE_ID_ATTRIBUTE,
142+
GEN_AI_RESPONSE_MODEL_ATTRIBUTE,
143+
GEN_AI_RESPONSE_TEXT_ATTRIBUTE,
144+
GEN_AI_RESPONSE_TOOL_CALLS_ATTRIBUTE,
145+
GEN_AI_SYSTEM_ATTRIBUTE,
146+
GEN_AI_TOOL_INPUT_ATTRIBUTE,
147+
GEN_AI_TOOL_NAME_ATTRIBUTE,
148+
GEN_AI_TOOL_OUTPUT_ATTRIBUTE,
149+
GEN_AI_TOOL_TYPE_ATTRIBUTE,
150+
} from './utils/ai/gen-ai-attributes';
135151
export { ANTHROPIC_AI_INTEGRATION_NAME } from './utils/anthropic-ai/constants';
136152
export { instrumentGoogleGenAIClient } from './utils/google-genai';
137153
export { GOOGLE_GENAI_INTEGRATION_NAME } from './utils/google-genai/constants';

packages/core/src/utils/ai/gen-ai-attributes.ts

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,35 @@ export const GEN_AI_RESPONSE_STREAMING_ATTRIBUTE = 'gen_ai.response.streaming';
129129
*/
130130
export const GEN_AI_RESPONSE_TOOL_CALLS_ATTRIBUTE = 'gen_ai.response.tool_calls';
131131

132+
// =============================================================================
133+
// AI AGENT ATTRIBUTES
134+
// =============================================================================
135+
136+
/**
137+
* The name of the AI agent
138+
*/
139+
export const GEN_AI_AGENT_NAME_ATTRIBUTE = 'gen_ai.agent.name';
140+
141+
/**
142+
* The name of the tool being executed
143+
*/
144+
export const GEN_AI_TOOL_NAME_ATTRIBUTE = 'gen_ai.tool.name';
145+
146+
/**
147+
* The type of the tool: 'function', 'extension', or 'datastore'
148+
*/
149+
export const GEN_AI_TOOL_TYPE_ATTRIBUTE = 'gen_ai.tool.type';
150+
151+
/**
152+
* The input parameters for a tool call
153+
*/
154+
export const GEN_AI_TOOL_INPUT_ATTRIBUTE = 'gen_ai.tool.input';
155+
156+
/**
157+
* The output/result of a tool call
158+
*/
159+
export const GEN_AI_TOOL_OUTPUT_ATTRIBUTE = 'gen_ai.tool.output';
160+
132161
// =============================================================================
133162
// OPENAI-SPECIFIC ATTRIBUTES
134163
// =============================================================================

0 commit comments

Comments
 (0)