File tree Expand file tree Collapse file tree 1 file changed +12
-4
lines changed
packages/instrumentation-openai/src Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -365,7 +365,11 @@ export class OpenAIInstrumentation extends InstrumentationBase {
365365 ] = JSON . stringify ( func . parameters ) ;
366366 } ) ;
367367 params . tools ?. forEach ( ( tool , index ) => {
368- if ( tool . type !== 'function' || ! ( 'function' in tool ) || ! tool . function ) {
368+ if (
369+ tool . type !== "function" ||
370+ ! ( "function" in tool ) ||
371+ ! tool . function
372+ ) {
369373 return ;
370374 }
371375
@@ -490,10 +494,14 @@ export class OpenAIInstrumentation extends InstrumentationBase {
490494 toolCall . type ;
491495 }
492496 if ( toolCall . function ?. name ) {
493- ( result . choices [ 0 ] . message . tool_calls [ toolCall . index ] as any ) . function . name += toolCall . function . name ;
497+ (
498+ result . choices [ 0 ] . message . tool_calls [ toolCall . index ] as any
499+ ) . function . name += toolCall . function . name ;
494500 }
495501 if ( toolCall . function ?. arguments ) {
496- ( result . choices [ 0 ] . message . tool_calls [ toolCall . index ] as any ) . function . arguments += toolCall . function . arguments ;
502+ (
503+ result . choices [ 0 ] . message . tool_calls [ toolCall . index ] as any
504+ ) . function . arguments += toolCall . function . arguments ;
497505 }
498506 }
499507 }
@@ -699,7 +707,7 @@ export class OpenAIInstrumentation extends InstrumentationBase {
699707 toolIndex ,
700708 toolCall ,
701709 ] of choice ?. message ?. tool_calls ?. entries ( ) || [ ] ) {
702- if ( toolCall . type === ' function' && ' function' in toolCall ) {
710+ if ( toolCall . type === " function" && " function" in toolCall ) {
703711 span . setAttribute (
704712 `${ SpanAttributes . LLM_COMPLETIONS } .${ index } .tool_calls.${ toolIndex } .name` ,
705713 toolCall . function . name ,
You can’t perform that action at this time.
0 commit comments