Class: Anthropic::Models::Messages::BatchCreateParams::Request::Params
- Inherits:
-
Internal::Type::BaseModel
- Object
- Internal::Type::BaseModel
- Anthropic::Models::Messages::BatchCreateParams::Request::Params
- Defined in:
- lib/anthropic/models/messages/batch_create_params.rb,
sig/anthropic/models/messages/batch_create_params.rbs
Overview
Defined Under Namespace
Modules: ServiceTier, Speed, System
Instance Attribute Summary collapse
-
#cache_control ⇒ Anthropic::Models::CacheControlEphemeral?
Top-level cache control automatically applies a cache_control marker to the last cacheable block in the request.
-
#container ⇒ Anthropic::Models::ContainerParams, ...
Container identifier for reuse across requests.
-
#diagnostics ⇒ Anthropic::Models::DiagnosticsParam?
Request-level diagnostics.
-
#inference_geo ⇒ String?
Specifies the geographic region for inference processing.
-
#max_tokens ⇒ Integer
The maximum number of tokens to generate before stopping.
-
#messages ⇒ Array<Anthropic::Models::UserMessageParam, Anthropic::Models::AssistantMessageParam, Anthropic::Models::SystemMessageParam>
Input messages.
-
#metadata ⇒ Anthropic::Models::Metadata?
An object describing metadata about the request.
-
#model ⇒ Symbol, ...
The model that will complete your prompt.
-
#output_config ⇒ Anthropic::Models::OutputConfig?
Configuration options for the model's output, such as the output format.
-
#service_tier ⇒ Symbol, ...
Determines whether to use priority capacity (if available) or standard capacity for this request.
-
#speed ⇒ Symbol, ...
The inference speed mode for this request.
-
#stop_sequences ⇒ Array<String>?
Custom text sequences that will cause the model to stop generating.
-
#stream ⇒ Boolean?
Whether to incrementally stream the response using server-sent events.
-
#system_ ⇒ String, ...
System prompt.
-
#thinking ⇒ Anthropic::Models::ThinkingConfigEnabled, ...
Configuration for Claude's thinking.
-
#tool_choice ⇒ Anthropic::Models::ToolChoiceAuto, ...
How the model should use the provided tools.
-
#tools ⇒ Array<Anthropic::Models::Tool, Anthropic::Models::ToolBash20250124, Anthropic::Models::CodeExecutionTool20250522, Anthropic::Models::CodeExecutionTool20250825, Anthropic::Models::CodeExecutionTool20260120, Anthropic::Models::CodeExecutionTool20260521, Anthropic::Models::BrowserToolset20260801, Anthropic::Models::MemoryTool20250818, Anthropic::Models::ComputerToolset20260801, Anthropic::Models::ToolTextEditor20250124, Anthropic::Models::ToolTextEditor20250429, Anthropic::Models::ToolTextEditor20250728, Anthropic::Models::WebSearchTool20250305, Anthropic::Models::WebFetchTool20250910, Anthropic::Models::WebSearchTool20260209, Anthropic::Models::WebFetchTool20260209, Anthropic::Models::WebFetchTool20260309, Anthropic::Models::WebSearchTool20260318, Anthropic::Models::WebFetchTool20260318, Anthropic::Models::ToolSearchToolBm25_20251119, Anthropic::Models::ToolSearchToolRegex20251119>?
Definitions of tools that the model may use.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(max_tokens:, messages:, model:, cache_control: nil, container: nil, diagnostics: nil, inference_geo: nil, metadata: nil, output_config: nil, service_tier: nil, speed: nil, stop_sequences: nil, stream: nil, system_: nil, thinking: nil, tool_choice: nil, tools: nil) ⇒ Params
constructor
Messages API creation parameters for the individual request.
- #to_hash ⇒ { max_tokens: Integer, messages: ::Array[Anthropic::Models::message_param], model: Anthropic::Models::model, cache_control: Anthropic::CacheControlEphemeral?, container: Anthropic::Models::message_create_params_container?, diagnostics: Anthropic::DiagnosticsParam?, inference_geo: String?, metadata: Anthropic::Metadata, output_config: Anthropic::OutputConfig, service_tier: Anthropic::Models::Messages::BatchCreateParams::Request::Params::service_tier, speed: Anthropic::Models::Messages::BatchCreateParams::Request::Params::speed?, stop_sequences: ::Array[String], stream: bool, system_: Anthropic::Models::Messages::BatchCreateParams::Request::Params::system_, thinking: Anthropic::Models::thinking_config_param, tool_choice: Anthropic::Models::tool_choice, tools: ::Array[Anthropic::Models::tool_union] }
Methods inherited from Internal::Type::BaseModel
==, #==, #[], coerce, #deconstruct_keys, #deep_to_h, dump, fields, hash, #hash, inherited, inspect, #inspect, known_fields, optional, recursively_to_h, required, #to_h, #to_json, #to_s, to_sorbet_type, #to_yaml
Methods included from Internal::Type::Converter
#coerce, coerce, #dump, dump, inspect, #inspect, meta_info, new_coerce_state, type_info
Methods included from Internal::Util::SorbetRuntimeSupport
#const_missing, #define_sorbet_constant!, #sorbet_constant_defined?, #to_sorbet_type, to_sorbet_type
Constructor Details
#initialize(max_tokens:, messages:, model:, cache_control: nil, container: nil, diagnostics: nil, inference_geo: nil, metadata: nil, output_config: nil, service_tier: nil, speed: nil, stop_sequences: nil, stream: nil, system_: nil, thinking: nil, tool_choice: nil, tools: nil) ⇒ Params
Messages API creation parameters for the individual request.
See the Messages API reference for full documentation on available parameters.
Some parameter documentations has been truncated, see Anthropic::Models::Messages::BatchCreateParams::Request::Params for more details.
|
|
# File 'lib/anthropic/models/messages/batch_create_params.rb', line 391
|
Instance Attribute Details
#cache_control ⇒ Anthropic::Models::CacheControlEphemeral?
Top-level cache control automatically applies a cache_control marker to the last cacheable block in the request.
186 |
# File 'lib/anthropic/models/messages/batch_create_params.rb', line 186 optional :cache_control, -> { Anthropic::CacheControlEphemeral }, nil?: true |
#container ⇒ Anthropic::Models::ContainerParams, ...
Container identifier for reuse across requests.
192 |
# File 'lib/anthropic/models/messages/batch_create_params.rb', line 192 optional :container, union: -> { Anthropic::MessageCreateParamsContainer }, nil?: true |
#diagnostics ⇒ Anthropic::Models::DiagnosticsParam?
Request-level diagnostics. Supply previous_message_id to have the response
include diagnostics.cache_miss_reason explaining any prompt-cache divergence
from that prior request.
200 |
# File 'lib/anthropic/models/messages/batch_create_params.rb', line 200 optional :diagnostics, -> { Anthropic::DiagnosticsParam }, nil?: true |
#inference_geo ⇒ String?
Specifies the geographic region for inference processing. If not specified, the
workspace's default_inference_geo is used.
207 |
# File 'lib/anthropic/models/messages/batch_create_params.rb', line 207 optional :inference_geo, String, nil?: true |
#max_tokens ⇒ Integer
The maximum number of tokens to generate before stopping.
Note that our models may stop before reaching this maximum. This parameter only specifies the absolute maximum number of tokens to generate.
Set to 0 to populate the
prompt cache
without generating a response.
Different models have different maximum values for this parameter. See models for details.
96 |
# File 'lib/anthropic/models/messages/batch_create_params.rb', line 96 required :max_tokens, Integer |
#messages ⇒ Array<Anthropic::Models::UserMessageParam, Anthropic::Models::AssistantMessageParam, Anthropic::Models::SystemMessageParam>
Input messages.
Our models are trained to operate on alternating user and assistant
conversational turns. When creating a new Message, you specify the prior
conversational turns with the messages parameter, and the model then generates
the next Message in the conversation. Consecutive user or assistant turns
in your request will be combined into a single turn.
Each input message must be an object with a role and content. You can
specify a single user-role message, or you can include multiple user and
assistant messages.
If the final message uses the assistant role, the response content will
continue immediately from the content in that message. This can be used to
constrain part of the model's response. This is called prefill. On models that
don't support prefill, creating a message that ends with a partial assistant
response returns a 400 error. See
Prefill not supported.
Example with a single user message:
[{ "role": "user", "content": "Hello, Claude" }]
Example with multiple conversational turns:
[
{ "role": "user", "content": "Hello there." },
{ "role": "assistant", "content": "Hi, I'm Claude. How can I help you?" },
{ "role": "user", "content": "Can you explain LLMs in plain English?" }
]
Example with a partially-filled response from Claude, for models that support prefill:
[
{
"role": "user",
"content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"
},
{ "role": "assistant", "content": "The best answer is (" }
]
Each input message content may be either a single string or an array of
content blocks, where each block has a specific type. Using a string for
content is shorthand for an array of one content block of type "text". The
following input messages are equivalent:
{ "role": "user", "content": "Hello, Claude" }
{ "role": "user", "content": [{ "type": "text", "text": "Hello, Claude" }] }
See input examples.
Note that if you want to include a
system prompt,
you can use the top-level system parameter.
There is a limit of 100,000 messages in a single request.
170 |
# File 'lib/anthropic/models/messages/batch_create_params.rb', line 170 required :messages, -> { Anthropic::Internal::Type::ArrayOf[union: Anthropic::MessageParam] } |
#metadata ⇒ Anthropic::Models::Metadata?
An object describing metadata about the request.
213 |
# File 'lib/anthropic/models/messages/batch_create_params.rb', line 213 optional :metadata, -> { Anthropic::Metadata } |
#model ⇒ Symbol, ...
The model that will complete your prompt.
See models for additional details and options.
179 |
# File 'lib/anthropic/models/messages/batch_create_params.rb', line 179 required :model, union: -> { Anthropic::Model } |
#output_config ⇒ Anthropic::Models::OutputConfig?
Configuration options for the model's output, such as the output format.
219 |
# File 'lib/anthropic/models/messages/batch_create_params.rb', line 219 optional :output_config, -> { Anthropic::OutputConfig } |
#service_tier ⇒ Symbol, ...
Determines whether to use priority capacity (if available) or standard capacity for this request.
Anthropic offers different levels of service for your API requests. See service-tiers for details.
230 |
# File 'lib/anthropic/models/messages/batch_create_params.rb', line 230 optional :service_tier, enum: -> { Anthropic::Messages::BatchCreateParams::Request::Params::ServiceTier } |
#speed ⇒ Symbol, ...
The inference speed mode for this request. "fast" enables high
output-tokens-per-second inference.
Some models require the fast-mode-2026-02-01 beta header for any speed
value. See
fast mode for
which models.
242 243 244 245 246 |
# File 'lib/anthropic/models/messages/batch_create_params.rb', line 242 optional :speed, enum: -> { Anthropic::Messages::BatchCreateParams::Request::Params::Speed }, nil?: true |
#stop_sequences ⇒ Array<String>?
Custom text sequences that will cause the model to stop generating.
Our models will normally stop when they have naturally completed their turn,
which will result in a response stop_reason of "end_turn".
If you want the model to stop generating when it encounters custom strings of
text, you can use the stop_sequences parameter. If the model encounters one of
the custom sequences, the response stop_reason value will be "stop_sequence"
and the response stop_sequence value will contain the matched stop sequence.
260 |
# File 'lib/anthropic/models/messages/batch_create_params.rb', line 260 optional :stop_sequences, Anthropic::Internal::Type::ArrayOf[String] |
#stream ⇒ Boolean?
Whether to incrementally stream the response using server-sent events. When
true, SDKs return a raw event stream.
In the TypeScript, Python and Ruby SDKs, the recommended way to stream is
messages.stream(). It sets stream for you and accumulates the events into
the final message. See
Streaming with SDKs
for an example in each language.
273 |
# File 'lib/anthropic/models/messages/batch_create_params.rb', line 273 optional :stream, Anthropic::Internal::Type::Boolean |
#system_ ⇒ String, ...
System prompt.
A system prompt is a way of providing context and instructions to Claude, such as specifying a particular goal or role. See our guide to system prompts.
283 284 285 |
# File 'lib/anthropic/models/messages/batch_create_params.rb', line 283 optional :system_, union: -> { Anthropic::Messages::BatchCreateParams::Request::Params::System }, api_name: :system |
#thinking ⇒ Anthropic::Models::ThinkingConfigEnabled, ...
Configuration for Claude's thinking.
With {"type": "adaptive"}, Claude decides when and how much to think. With
{"type": "enabled"} (manual extended thinking), you set a budget_tokens of
at least 1,024. Thinking tokens count toward your max_tokens limit.
Which type values are accepted, and what happens when you omit thinking,
depend on the model. See
thinking
for each model's behavior.
300 |
# File 'lib/anthropic/models/messages/batch_create_params.rb', line 300 optional :thinking, union: -> { Anthropic::ThinkingConfigParam } |
#tool_choice ⇒ Anthropic::Models::ToolChoiceAuto, ...
How the model should use the provided tools. The model can use a specific tool, any available tool, decide by itself, or not use tools at all.
307 |
# File 'lib/anthropic/models/messages/batch_create_params.rb', line 307 optional :tool_choice, union: -> { Anthropic::ToolChoice } |
#tools ⇒ Array<Anthropic::Models::Tool, Anthropic::Models::ToolBash20250124, Anthropic::Models::CodeExecutionTool20250522, Anthropic::Models::CodeExecutionTool20250825, Anthropic::Models::CodeExecutionTool20260120, Anthropic::Models::CodeExecutionTool20260521, Anthropic::Models::BrowserToolset20260801, Anthropic::Models::MemoryTool20250818, Anthropic::Models::ComputerToolset20260801, Anthropic::Models::ToolTextEditor20250124, Anthropic::Models::ToolTextEditor20250429, Anthropic::Models::ToolTextEditor20250728, Anthropic::Models::WebSearchTool20250305, Anthropic::Models::WebFetchTool20250910, Anthropic::Models::WebSearchTool20260209, Anthropic::Models::WebFetchTool20260209, Anthropic::Models::WebFetchTool20260309, Anthropic::Models::WebSearchTool20260318, Anthropic::Models::WebFetchTool20260318, Anthropic::Models::ToolSearchToolBm25_20251119, Anthropic::Models::ToolSearchToolRegex20251119>?
Definitions of tools that the model may use.
If you include tools in your API request, the model may return tool_use
content blocks that represent the model's use of those tools. You can then run
those tools using the tool input generated by the model and then optionally
return results back to the model using tool_result content blocks.
There are two types of tools: client tools and server tools. The behavior described below applies to client tools. For server tools, see their individual documentation as each has its own behavior (e.g., the web search tool).
Each tool definition includes:
name: Name of the tool.description: Optional, but strongly-recommended description of the tool.input_schema: JSON schema for the toolinputshape that the model will produce intool_useoutput content blocks.
For example, if you defined tools as:
[
{
"name": "get_stock_price",
"description": "Get the current stock price for a given ticker symbol.",
"input_schema": {
"type": "object",
"properties": {
"ticker": {
"type": "string",
"description": "The stock ticker symbol, e.g. AAPL for Apple Inc."
}
},
"required": ["ticker"]
}
}
]
And then asked the model "What's the S&P 500 at today?", the model might produce
tool_use content blocks in the response like this:
[
{
"type": "tool_use",
"id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV",
"name": "get_stock_price",
"input": { "ticker": "^GSPC" }
}
]
You might then run your get_stock_price tool with {"ticker": "^GSPC"} as an
input, and return the following back to the model in a subsequent user
message:
[
{
"type": "tool_result",
"tool_use_id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV",
"content": "259.75 USD"
}
]
Tools can be used for workflows that include running client-side tools and functions, or more generally whenever you want the model to produce a particular JSON structure of output.
See our guide for more details.
389 |
# File 'lib/anthropic/models/messages/batch_create_params.rb', line 389 optional :tools, -> { Anthropic::Internal::Type::ArrayOf[union: Anthropic::ToolUnion] } |
Class Method Details
.values ⇒ Array<Symbol>
|
|
# File 'lib/anthropic/models/messages/batch_create_params.rb', line 450
|
Instance Method Details
#to_hash ⇒ { max_tokens: Integer, messages: ::Array[Anthropic::Models::message_param], model: Anthropic::Models::model, cache_control: Anthropic::CacheControlEphemeral?, container: Anthropic::Models::message_create_params_container?, diagnostics: Anthropic::DiagnosticsParam?, inference_geo: String?, metadata: Anthropic::Metadata, output_config: Anthropic::OutputConfig, service_tier: Anthropic::Models::Messages::BatchCreateParams::Request::Params::service_tier, speed: Anthropic::Models::Messages::BatchCreateParams::Request::Params::speed?, stop_sequences: ::Array[String], stream: bool, system_: Anthropic::Models::Messages::BatchCreateParams::Request::Params::system_, thinking: Anthropic::Models::thinking_config_param, tool_choice: Anthropic::Models::tool_choice, tools: ::Array[Anthropic::Models::tool_union] }
167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 |
# File 'sig/anthropic/models/messages/batch_create_params.rbs', line 167
def to_hash: -> {
max_tokens: Integer,
messages: ::Array[Anthropic::Models::message_param],
model: Anthropic::Models::model,
cache_control: Anthropic::CacheControlEphemeral?,
container: Anthropic::Models::message_create_params_container?,
diagnostics: Anthropic::DiagnosticsParam?,
inference_geo: String?,
metadata: Anthropic::Metadata,
output_config: Anthropic::OutputConfig,
service_tier: Anthropic::Models::Messages::BatchCreateParams::Request::Params::service_tier,
speed: Anthropic::Models::Messages::BatchCreateParams::Request::Params::speed?,
stop_sequences: ::Array[String],
stream: bool,
system_: Anthropic::Models::Messages::BatchCreateParams::Request::Params::system_,
thinking: Anthropic::Models::thinking_config_param,
tool_choice: Anthropic::Models::tool_choice,
tools: ::Array[Anthropic::Models::tool_union]
}
|