(span: Span, response: Generated.ChatResponse)
| 1055 | } |
| 1056 | |
| 1057 | const annotateResponse = (span: Span, response: Generated.ChatResponse): void => { |
| 1058 | addGenAIAnnotations(span, { |
| 1059 | response: { |
| 1060 | id: response.id, |
| 1061 | model: response.model, |
| 1062 | finishReasons: response.choices.map((choice) => choice.finish_reason).filter(Predicate.isNotNullable) |
| 1063 | }, |
| 1064 | usage: { |
| 1065 | inputTokens: response.usage?.prompt_tokens, |
| 1066 | outputTokens: response.usage?.completion_tokens |
| 1067 | } |
| 1068 | }) |
| 1069 | } |
| 1070 | |
| 1071 | const annotateStreamResponse = (span: Span, part: Response.StreamPartEncoded) => { |
| 1072 | if (part.type === "response-metadata") { |
no test coverage detected