(span: Span, response: Generated.SendChatCompletionRequest200)
| 1661 | } |
| 1662 | |
| 1663 | const annotateResponse = (span: Span, response: Generated.SendChatCompletionRequest200): void => { |
| 1664 | addGenAIAnnotations(span, { |
| 1665 | response: { |
| 1666 | id: response.id, |
| 1667 | model: response.model, |
| 1668 | finishReasons: response.choices.map((choice) => choice.finish_reason).filter(Predicate.isNotNullish) |
| 1669 | }, |
| 1670 | usage: { |
| 1671 | inputTokens: response.usage?.prompt_tokens, |
| 1672 | outputTokens: response.usage?.completion_tokens |
| 1673 | } |
| 1674 | }) |
| 1675 | } |
| 1676 | |
| 1677 | const annotateStreamResponse = (span: Span, part: Response.StreamPartEncoded) => { |
| 1678 | if (part.type === "response-metadata") { |
no test coverage detected