Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
readability
  • Loading branch information
nicohrubec committed Mar 20, 2026
commit e5d1ae76b511df423fe57f712b676635981a0a97
17 changes: 11 additions & 6 deletions packages/core/src/tracing/ai/messageTruncation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,20 @@ type ContentMessage = {
content: string;
};

/**
* One block inside OpenAI / Anthropic `content: [...]` arrays (text, image_url, etc.).
*/
type ContentArrayBlock = {
[key: string]: unknown;
type: string;
};

/**
* Message format used by OpenAI and Anthropic APIs for media.
*/
type ContentArrayMessage = {
[key: string]: unknown;
content: {
[key: string]: unknown;
type: string;
}[];
content: ContentArrayBlock[];
};

/**
Expand All @@ -48,9 +53,9 @@ type MediaPart = {
};

/**
* Union of all item types that can appear in array-based messages.
* One element of an array-based message: OpenAI/Anthropic `content[]` or Google `parts`.
*/
type ArrayMessageItem = TextPart | MediaPart | ContentArrayMessage['content'][number];
type ArrayMessageItem = TextPart | MediaPart | ContentArrayBlock;

/**
* Calculate the UTF-8 byte length of a string.
Expand Down
Loading