File tree Expand file tree Collapse file tree 1 file changed +3
-1
lines changed
packages/core/src/utils/langchain Expand file tree Collapse file tree 1 file changed +3
-1
lines changed Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ import {
2323 GEN_AI_USAGE_OUTPUT_TOKENS_ATTRIBUTE ,
2424 GEN_AI_USAGE_TOTAL_TOKENS_ATTRIBUTE ,
2525} from '../ai/gen-ai-attributes' ;
26+ import { truncateGenAiMessages } from '../ai/messageTruncation' ;
2627import { LANGCHAIN_ORIGIN , ROLE_MAP } from './constants' ;
2728import type { LangChainLLMResult , LangChainMessage , LangChainSerialized } from './types' ;
2829
@@ -281,7 +282,8 @@ export function extractChatModelRequestAttributes(
281282
282283 if ( recordInputs && Array . isArray ( langChainMessages ) && langChainMessages . length > 0 ) {
283284 const normalized = normalizeLangChainMessages ( langChainMessages . flat ( ) ) ;
284- setIfDefined ( attrs , GEN_AI_REQUEST_MESSAGES_ATTRIBUTE , asString ( normalized ) ) ;
285+ const truncated = truncateGenAiMessages ( normalized ) ;
286+ setIfDefined ( attrs , GEN_AI_REQUEST_MESSAGES_ATTRIBUTE , asString ( truncated ) ) ;
285287 }
286288
287289 return attrs ;
You can’t perform that action at this time.
0 commit comments