MessagesMessageParamContentUnion4 - TypeScript SDK

MessagesMessageParamContentUnion4 type definition

The TypeScript SDK and docs are currently in beta. Report issues on GitHub.

Supported Types

models.AnthropicTextBlockParam

1const value: models.AnthropicTextBlockParam = {
2 text: "Hello, world!",
3 type: "text",
4};

models.AnthropicImageBlockParam

1const value: models.AnthropicImageBlockParam = {
2 source: {
3 data: "/9j/4AAQ...",
4 mediaType: "image/jpeg",
5 type: "base64",
6 },
7 type: "image",
8};

models.AnthropicDocumentBlockParam

1const value: models.AnthropicDocumentBlockParam = {
2 source: {
3 data: "Hello, world!",
4 mediaType: "text/plain",
5 type: "text",
6 },
7 type: "document",
8};

models.ContentToolUse

1const value: models.ContentToolUse = {
2 id: "<id>",
3 name: "<value>",
4 type: "tool_use",
5};

models.ContentToolResult

1const value: models.ContentToolResult = {
2 toolUseId: "<id>",
3 type: "tool_result",
4};

models.ContentThinking

1const value: models.ContentThinking = {
2 signature: "<value>",
3 thinking: "<value>",
4 type: "thinking",
5};

models.ContentRedactedThinking

1const value: models.ContentRedactedThinking = {
2 data: "<value>",
3 type: "redacted_thinking",
4};

models.ContentServerToolUse

1const value: models.ContentServerToolUse = {
2 id: "<id>",
3 name: "<value>",
4 type: "server_tool_use",
5};

models.ContentWebSearchToolResult

1const value: models.ContentWebSearchToolResult = {
2 content: [
3 {
4 encryptedContent: "enc_content_0",
5 title: "Example Page",
6 type: "web_search_result",
7 url: "https://example.com",
8 },
9 ],
10 toolUseId: "<id>",
11 type: "web_search_tool_result",
12};

models.AnthropicSearchResultBlockParam

1const value: models.AnthropicSearchResultBlockParam = {
2 content: [
3 {
4 text: "Result content",
5 type: "text",
6 },
7 ],
8 source: "example_source",
9 title: "Example Result",
10 type: "search_result",
11};

models.ContentCompaction

1const value: models.ContentCompaction = {
2 content: null,
3 type: "compaction",
4};

models.MessagesAdvisorToolResultBlock

1const value: models.MessagesAdvisorToolResultBlock = {
2 content: {
3 "text": "Advisor response text",
4 "type": "advisor_result",
5 },
6 toolUseId: "srvtoolu_01abc",
7 type: "advisor_tool_result",
8};