@anthropic-ai/sdk
Version:
The official TypeScript library for the Anthropic API
27 lines • 1.65 kB
TypeScript
import { type Span } from '@opentelemetry/api';
import type { BaseAnthropic } from "../../../client.js";
import type { APIResponseProps } from "../../../internal/parse.js";
import { type ApiCallSpan } from "../../../internal/tracing.js";
import type { AnyMessage, MessageCreateBody } from "./types.js";
/**
* 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.ts.map