Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 | import type { ChatCompletionMessage } from '@shared/types/api/routes/shared/messages';
export interface AnthropicTool {
cache_control?: { type: 'ephemeral' };
name: string;
description: string;
input_schema: {
type: string;
properties?: Record<
string,
{
type: string;
description: string;
}
>;
required?: string[];
additionalProperties?: boolean;
};
}
export interface AnthropicToolResultContentItem {
type: 'tool_result';
tool_use_id: string;
content?: string;
}
export interface AnthropicBase64ImageContentItem {
type: 'image';
source: {
type: 'base64';
media_type: string;
data: string;
};
}
export interface AnthropicUrlImageContentItem {
type: 'image';
source: {
type: 'url';
url: string;
};
}
export interface AnthropicTextContentItem {
type: 'text';
text: string;
cache_control?: { type: 'ephemeral' };
}
export interface AnthropicUrlPdfContentItem {
type: string;
source: {
type: string;
url: string;
};
}
export interface AnthropicBase64PdfContentItem {
type: string;
source: {
type: string;
data: string;
media_type: string;
};
}
export interface AnthropicPlainTextContentItem {
type: string;
source: {
type: string;
data: string;
media_type: string;
};
}
export type AnthropicMessageContentItem =
| AnthropicToolResultContentItem
| AnthropicBase64ImageContentItem
| AnthropicUrlImageContentItem
| AnthropicTextContentItem
| AnthropicUrlPdfContentItem
| AnthropicBase64PdfContentItem
| AnthropicPlainTextContentItem;
export interface AnthropicMessage extends ChatCompletionMessage {
cache_control?: { type: 'ephemeral' };
content: AnthropicMessageContentItem[];
}
export interface AnthropicErrorObject {
type: string;
message: string;
}
export interface AnthropicErrorResponse {
type: string;
error: AnthropicErrorObject;
}
export interface AnthropicToolContentItem {
type: 'tool_use';
name: string;
id: string;
input: Record<string, unknown>;
}
export type AnthropicContentItem =
| AnthropicTextContentItem
| AnthropicToolContentItem;
export interface AnthropicCompleteResponse {
completion: string;
stop_reason: string;
model: string;
truncated: boolean;
stop: null | string;
log_id: string;
exception: null | string;
}
export type AnthropicStreamState = {
toolIndex?: number;
usage?: {
prompt_tokens?: number;
completion_tokens?: number;
cache_read_input_tokens?: number;
cache_creation_input_tokens?: number;
};
model?: string;
jsonOutputToolId?: string;
jsonOutputToolIndex?: number;
};
|