Skip to main content

Claude

Claude

Properties used to connect to Claude.

claude

Connect to Claude's Messages API. You can set this property to true or configure it using an object:
model is the Claude model to use (e.g., "claude-sonnet-4-6", "claude-3-haiku-20240307").
max_tokens is the maximum number of tokens to generate.
stop_sequences defines sequences where the API will stop generating.
system_prompt provides behavioral context and instructions to the model.
tools is an array that defines functions that the model can call.
tool_choice controls which (if any) tool should be called.
function_handler is the actual function called with the model's instructions.
mcp_servers enables integration with Model Context Protocol servers.
metadata is an object describing the request, currently supporting a user_id string for abuse detection.
thinking enables extended thinking where the model reasons through a problem before responding.
service_tier selects the request priority"auto" uses standard with priority fallback, "standard_only" forces standard tier only.
inference_geo is the geographic region for inference processing.

Basic Example

<deep-chat
directConnection='{
"claude": {
"key": "placeholder key",
"max_tokens": 1000,
"system_prompt": "You are a helpful assistant."
}
}'
></deep-chat>
info

Use stream to stream the AI responses.

Vision Example

Upload images alongside your text prompts for visual understanding.

<deep-chat
directConnection='{
"claude": {
"key": "placeholder key"
}
}'
images="true"
camera="true"
></deep-chat>
tip

When sending images we advise you to set maxMessages to 1 to send less data and reduce costs.

Tool Calling

Claude supports tool calling functionality:

ClaudeTool

  • Type: {
         name: string,
         description: string,
         input_schema: {
             type: "object",
             properties: object,
             required?: string[]
         },
         input_examples?: object[],
         defer_loading?: boolean,
         type?: string,
         allowed_callers?: string[]
    }

Array describing tools that the model may call.
name is the name of the tool function.
description explains what the tool does and when it should be used.
input_schema defines the parameters the tool accepts in JSON Schema format.
input_examples is an array of example input objects that demonstrate valid tool calls to the model. Each example must conform to input_schema. See Providing tool use examples.
Advanced tool use:
defer_loading does not load the tool in the initial context so it can be discovered dynamically.
type defines the tool type.
allowed_callers are programmtic execution tools that can call this tool.

ClaudeMCPServer

  • Type: {
         type: "url",
         url: string,
         name: string,
         authorization_token?: string
    }

Configuration for Model Context Protocol server integration.
type must be "url" for URL-based MCP servers.
url is the endpoint URL of the MCP server.
name is a unique identifier for the MCP server.
authorization_token is an optional token for server authentication.

ClaudeThinking

  • Type: {type: "enabled", budget_tokens: number, display?: "summarized" | "omitted"} | {type: "disabled"} | {type: "adaptive", display?: "summarized" | "omitted"}

Configuration for extended thinking.
When type is "enabled", budget_tokens sets the maximum number of tokens the model can spend on internal reasoning (minimum 1024).
type: "adaptive" lets the model decide how much to think based on the request.
display controls whether reasoning content is "summarized" or "omitted" from the response.

ClaudeOutputConfig

  • Type: {
         format: {type: "json_schema", schema: object},
         effort?: "low" | "medium" | "high" | "xhigh" | "max"
    }

Constrains model output to a specific format.
format.type is currently "json_schema", and format.schema is a JSON Schema describing the response shape.
effort is an optional hint for how much compute the model should spend on producing schema-conformant output.

<deep-chat
directConnection='{
"claude": {
"key": "placeholder-key",
"mcp_servers": [
{
"type": "url",
"url": "https://example-server.modelcontextprotocol.io/sse",
"name": "my-mcp-server",
"authorization_token": "my-auth-token"
}
]
}
}'
></deep-chat>

FunctionHandler

The actual function that the component will call if the model wants to use tools.
functionsDetails contains information about what tool functions should be called.
This function should either return an array of JSONs containing a response property for each tool function (in the same order as in functionsDetails) which will feed it back into the model to finalize a response, or return a JSON containing text which will immediately display it in the chat.

Example

// using JavaScript for a simplified example

chatElementRef.directConnection = {
claude: {
tools: [
{
name: 'get_weather',
description: 'Get the current weather in a given location',
input_schema: {
type: 'object',
properties: {
location: {
type: 'string',
description: 'The city and state, e.g. San Francisco, CA',
},
unit: {type: 'string', enum: ['celsius', 'fahrenheit']},
},
required: ['location'],
},
},
],
function_handler: (functionsDetails) => {
return functionsDetails.map((functionDetails) => {
return {
response: getCurrentWeather(functionDetails.arguments),
};
});
},
key: 'placeholder-key',
},
};

Types

Types shared by Claude properties:

ClaudeToolChoice

  • Type: {type: "auto" | "any", disable_parallel_tool_use?: boolean} | {type: "tool", name: string, disable_parallel_tool_use?: boolean} | {type: "none"}

Controls which (if any) tool should be called.
"auto" lets the model decide whether to use a tool.
"any" forces the model to use one of the provided tools, but doesn't force a particular one.
"tool" forces the model to always use the tool with the specified name.
"none" prevents the model from using any tools.
disable_parallel_tool_use limits the model to a single tool call per response.