UNPKG

@anthropic-ai/sdk

Version:
27 lines • 1.65 kB
import { type Span } from '@opentelemetry/api'; import type { BaseAnthropic } from "../../../client.mjs"; import type { APIResponseProps } from "../../../internal/parse.mjs"; import { type ApiCallSpan } from "../../../internal/tracing.mjs"; import type { AnyMessage, MessageCreateBody } from "./types.mjs"; /** * In content mode, records `message`, which a stream helper accumulated, as the response content * of `call`, under the same size limit as a response that is not streamed. */ export declare function recordStreamedMessageContent(client: BaseAnthropic, call: ApiCallSpan, body: MessageCreateBody, message: AnyMessage): void; /** * Ends `span` when the application's read of `stream` ends. Only the stream of `messages.create` * has events that the span records. */ export declare function endAnthropicApiCallSpanWhenStreamEnds(client: BaseAnthropic, span: Span, stream: AsyncIterable<unknown>, props: APIResponseProps): void; /** * The paths in a streamed Message whose values are final only from `message_delta` on. * `message_start` has placeholders for them, so the span of a stream that ended before * `message_delta` records nothing under them. */ export declare const FINAL_FROM_MESSAGE_DELTA: ReadonlyArray<readonly string[]>; /** * The totals in the usage of `message_delta`, besides `output_tokens`, that replace those of * `message_start`. Of the rest of the event, the span records the stop reason alone. */ export declare const TOTALS_IN_MESSAGE_DELTA: readonly ["input_tokens", "cache_creation_input_tokens", "cache_read_input_tokens", "output_tokens_details", "iterations"]; //# sourceMappingURL=streaming.d.mts.map