Skip to content

Commit

Permalink
feat: Add tool call id to semantic conventions
Browse files Browse the repository at this point in the history
  • Loading branch information
cephalization committed Nov 7, 2024
1 parent e11fddd commit 33e1f53
Showing 1 changed file with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ export const MessageAttributePostfixes = {
function_call_name: "function_call_name",
function_call_arguments_json: "function_call_arguments_json",
tool_calls: "tool_calls",
tool_call_id: "tool_call_id",
} as const;

export const MessageContentsAttributePostfixes = {
Expand All @@ -89,6 +90,7 @@ export const ImageAttributesPostfixes = {
export const ToolCallAttributePostfixes = {
function_name: "function.name",
function_arguments_json: "function.arguments",
id: "id",
} as const;

export const DocumentAttributePostfixes = {
Expand Down Expand Up @@ -202,6 +204,12 @@ export const MESSAGE_NAME =
export const MESSAGE_TOOL_CALLS =
`${SemanticAttributePrefixes.message}.${MessageAttributePostfixes.tool_calls}` as const;

/**
* The id of the tool call
*/
export const MESSAGE_TOOL_CALL_ID =
`${SemanticAttributePrefixes.message}.${MessageAttributePostfixes.tool_call_id}` as const;

/**
* tool_call.function.name
*/
Expand All @@ -214,6 +222,12 @@ export const TOOL_CALL_FUNCTION_NAME =
export const TOOL_CALL_FUNCTION_ARGUMENTS_JSON =
`${SemanticAttributePrefixes.tool_call}.${ToolCallAttributePostfixes.function_arguments_json}` as const;

/**
* The id of the tool call
*/
export const TOOL_CALL_ID =
`${SemanticAttributePrefixes.tool_call}.${ToolCallAttributePostfixes.id}` as const;

/**
* The LLM function call function name
*/
Expand Down Expand Up @@ -430,6 +444,8 @@ export const SemanticConventions = {
MESSAGE_ROLE,
MESSAGE_NAME,
MESSAGE_TOOL_CALLS,
MESSAGE_TOOL_CALL_ID,
TOOL_CALL_ID,
TOOL_CALL_FUNCTION_NAME,
TOOL_CALL_FUNCTION_ARGUMENTS_JSON,
MESSAGE_FUNCTION_CALL_NAME,
Expand Down

0 comments on commit 33e1f53

Please sign in to comment.