Skip to content

Commit b05c3c5

Browse files
authored
Update index.ts
1 parent 903de8a commit b05c3c5

File tree

1 file changed

+6
-1
lines changed
  • packages/core/src/utils/google-genai

1 file changed

+6
-1
lines changed

packages/core/src/utils/google-genai/index.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,10 +128,15 @@ function extractRequestAttributes(
128128

129129
return attributes;
130130
}
131-
131+
/**
132+
* Add private request attributes to spans.
133+
* This is only recorded if recordInputs is true.
134+
* Handles different parameter formats for different Google GenAI methods.
135+
*/
132136
function addPrivateRequestAttributes(span: Span, params: Record<string, unknown>): void {
133137
if ('contents' in params) {
134138
const contents = params.contents;
139+
// For models.generateContent: ContentListUnion: Content | Content[] | PartUnion | PartUnion[]
135140
if (Array.isArray(contents)) {
136141
const truncatedContents = truncateGenAiMessages(contents);
137142
span.setAttributes({ [GEN_AI_REQUEST_MESSAGES_ATTRIBUTE]: JSON.stringify(truncatedContents) });

0 commit comments

Comments
 (0)