Class: Anthropic::Models::Beta::Messages::BatchCreateParams::Request::Params

Inherits:
Internal::Type::BaseModel show all
Defined in:
lib/anthropic/models/beta/messages/batch_create_params.rb,
sig/anthropic/models/beta/messages/batch_create_params.rbs

Overview

See Also:

  • Anthropic::Models::Beta::Messages::BatchCreateParams::Request#params

Defined Under Namespace

Modules: Container, ServiceTier, Speed, System

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

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, context_management: nil, diagnostics: nil, fallback_credit_token: nil, fallbacks: nil, inference_geo: nil, mcp_servers: nil, metadata: nil, output_config: nil, output_format: nil, service_tier: nil, speed: nil, stop_sequences: nil, stream: nil, system_: nil, temperature: nil, thinking: nil, tool_choice: nil, tools: nil, top_k: nil, top_p: nil) ⇒ Object

Some parameter documentations has been truncated, see Anthropic::Models::Beta::Messages::BatchCreateParams::Request::Params for more details.

Messages API creation parameters for the individual request.

See the Messages API reference for full documentation on available parameters.

Parameters:



# File 'lib/anthropic/models/beta/messages/batch_create_params.rb', line 484

Instance Attribute Details

#cache_controlAnthropic::Models::Beta::BetaCacheControlEphemeral?

Top-level cache control automatically applies a cache_control marker to the last cacheable block in the request.

Parameters:

  • value (Anthropic::Beta::BetaCacheControlEphemeral, nil)

Returns:



180
# File 'lib/anthropic/models/beta/messages/batch_create_params.rb', line 180

optional :cache_control, -> { Anthropic::Beta::BetaCacheControlEphemeral }, nil?: true

#containerAnthropic::Models::Beta::BetaContainerParams, ...

Container identifier for reuse across requests.

Parameters:

  • value (Anthropic::Models::Beta::Messages::BatchCreateParams::Request::Params::container, nil)

Returns:



186
187
188
# File 'lib/anthropic/models/beta/messages/batch_create_params.rb', line 186

optional :container,
union: -> { Anthropic::Beta::Messages::BatchCreateParams::Request::Params::Container },
nil?: true

#context_managementAnthropic::Models::Beta::BetaContextManagementConfig?

Context management configuration.

This allows you to control how Claude manages context across multiple requests, such as whether to clear function results or not.

Parameters:

  • value (Anthropic::Beta::BetaContextManagementConfig, nil)

Returns:



197
# File 'lib/anthropic/models/beta/messages/batch_create_params.rb', line 197

optional :context_management, -> { Anthropic::Beta::BetaContextManagementConfig }, nil?: true

#diagnosticsAnthropic::Models::Beta::BetaDiagnosticsParam?

Request-level diagnostics. Currently carries the previous response id for prompt-cache divergence reporting.

Parameters:

  • value (Anthropic::Beta::BetaDiagnosticsParam, nil)

Returns:



204
# File 'lib/anthropic/models/beta/messages/batch_create_params.rb', line 204

optional :diagnostics, -> { Anthropic::Beta::BetaDiagnosticsParam }, nil?: true

#fallback_credit_tokenString?

The fallback_credit_token from a prior refusal's stop_details.

When a preceding request was refused and returned a fallback_credit_token, pass that code here on the retry to have the retry's cache-creation tokens for the prefix that was warm on the refused model billed at the cache-read rate. Must be redeemed by the same organization and workspace, with the same request body (optionally extended by one appended assistant message whose content is the partial text — with any trailing whitespace stripped from the final text block — and paired server-tool blocks streamed before the refusal; the appended-assistant form is not available for requests with output_format set or forced tool_choice), on an eligible fallback model, on the same platform, and within 5 minutes of the refusal; a mismatch is a 400. A token minted mid-server-tool-loop whose partial content was continuable may only be redeemed with the appended-assistant form — if an exact-body retry is rejected with a 400 saying the token must be redeemed by continuing the partial response, retry with the appended-assistant form instead.

When the appended-assistant form is used on a model that otherwise disallows assistant-turn prefill, this token also authorizes that one prefill.

Parameters:

  • value (String, nil)

Returns:

  • (String, nil)


228
# File 'lib/anthropic/models/beta/messages/batch_create_params.rb', line 228

optional :fallback_credit_token, String, nil?: true

#fallbacksArray<Anthropic::Models::Beta::BetaFallbackParam>?

Opt-in server-side retry on one or more substitute models when the requested model declines for policy reasons. Tried in order: if the first entry also declines, the second is tried, and so on.

Parameters:

  • value (::Array[Anthropic::Beta::BetaFallbackParam], nil)

Returns:



236
237
238
# File 'lib/anthropic/models/beta/messages/batch_create_params.rb', line 236

optional :fallbacks,
-> { Anthropic::Internal::Type::ArrayOf[Anthropic::Beta::BetaFallbackParam] },
nil?: true

#inference_geoString?

Specifies the geographic region for inference processing. If not specified, the workspace's default_inference_geo is used.

Parameters:

  • value (String, nil)

Returns:

  • (String, nil)


245
# File 'lib/anthropic/models/beta/messages/batch_create_params.rb', line 245

optional :inference_geo, String, nil?: true

#max_tokensInteger

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.

Parameters:

  • value (Integer)

Returns:

  • (Integer)


93
# File 'lib/anthropic/models/beta/messages/batch_create_params.rb', line 93

required :max_tokens, Integer

#mcp_serversArray<Anthropic::Models::Beta::BetaRequestMCPServerURLDefinition>?

MCP servers to be utilized in this request



251
252
# File 'lib/anthropic/models/beta/messages/batch_create_params.rb', line 251

optional :mcp_servers,
-> { Anthropic::Internal::Type::ArrayOf[Anthropic::Beta::BetaRequestMCPServerURLDefinition] }

#messagesArray<Anthropic::Models::Beta::BetaMessageParam>

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.

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:

[
  {
    "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 no "system" role for input messages in the Messages API.

There is a limit of 100,000 messages in a single request.

Parameters:

  • value (::Array[Anthropic::Beta::BetaMessageParam])

Returns:



164
# File 'lib/anthropic/models/beta/messages/batch_create_params.rb', line 164

required :messages, -> { Anthropic::Internal::Type::ArrayOf[Anthropic::Beta::BetaMessageParam] }

#metadataAnthropic::Models::Beta::BetaMetadata?

An object describing metadata about the request.



258
# File 'lib/anthropic/models/beta/messages/batch_create_params.rb', line 258

optional :metadata, -> { Anthropic::Beta::BetaMetadata }

#modelSymbol, ...

The model that will complete your prompt.

See models for additional details and options.

Parameters:

  • value (Anthropic::Models::model)

Returns:



173
# File 'lib/anthropic/models/beta/messages/batch_create_params.rb', line 173

required :model, union: -> { Anthropic::Model }

#output_configAnthropic::Models::Beta::BetaOutputConfig?

Configuration options for the model's output, such as the output format.



264
# File 'lib/anthropic/models/beta/messages/batch_create_params.rb', line 264

optional :output_config, -> { Anthropic::Beta::BetaOutputConfig }

#output_formatAnthropic::Models::Beta::BetaJSONOutputFormat?

Deprecated.

Deprecated: Use output_config.format instead. See structured outputs

A schema to specify Claude's output format in responses. This parameter will be removed in a future release.

Parameters:

  • value (Anthropic::Beta::BetaJSONOutputFormat, nil)

Returns:



276
# File 'lib/anthropic/models/beta/messages/batch_create_params.rb', line 276

optional :output_format, -> { Anthropic::Beta::BetaJSONOutputFormat }, nil?: true

#service_tierSymbol, ...

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.



287
288
# File 'lib/anthropic/models/beta/messages/batch_create_params.rb', line 287

optional :service_tier,
enum: -> { Anthropic::Beta::Messages::BatchCreateParams::Request::Params::ServiceTier }

#speedSymbol, ...

The inference speed mode for this request. "fast" enables high output-tokens-per-second inference.

Parameters:

  • value (Anthropic::Models::Beta::Messages::BatchCreateParams::Request::Params::speed, nil)

Returns:



295
296
297
# File 'lib/anthropic/models/beta/messages/batch_create_params.rb', line 295

optional :speed,
enum: -> { Anthropic::Beta::Messages::BatchCreateParams::Request::Params::Speed },
nil?: true

#stop_sequencesArray<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.

Parameters:

  • (::Array[String])

Returns:

  • (Array<String>, nil)


311
# File 'lib/anthropic/models/beta/messages/batch_create_params.rb', line 311

optional :stop_sequences, Anthropic::Internal::Type::ArrayOf[String]

#streamBoolean?

Whether to incrementally stream the response using server-sent events.

See streaming for details.

Parameters:

Returns:



320
# File 'lib/anthropic/models/beta/messages/batch_create_params.rb', line 320

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.

Returns:



330
331
332
# File 'lib/anthropic/models/beta/messages/batch_create_params.rb', line 330

optional :system_,
union: -> { Anthropic::Beta::Messages::BatchCreateParams::Request::Params::System },
api_name: :system

#temperatureFloat?

Deprecated.

Deprecated. Models released after Claude Opus 4.6 do not support setting

temperature. A value of 1.0 of will be accepted for backwards compatibility, all other values will be rejected with a 400 error.

Amount of randomness injected into the response.

Defaults to 1.0. Ranges from 0.0 to 1.0. Use temperature closer to 0.0 for analytical / multiple choice, and closer to 1.0 for creative and generative tasks.

Note that even with temperature of 0.0, the results will not be fully deterministic.

Parameters:

  • (Float)

Returns:

  • (Float, nil)


349
# File 'lib/anthropic/models/beta/messages/batch_create_params.rb', line 349

optional :temperature, Float

#thinkingAnthropic::Models::Beta::BetaThinkingConfigEnabled, ...

Configuration for enabling Claude's extended thinking.

When enabled, responses include thinking content blocks showing Claude's thinking process before the final answer. Requires a minimum budget of 1,024 tokens and counts towards your max_tokens limit.

See extended thinking for details.



363
# File 'lib/anthropic/models/beta/messages/batch_create_params.rb', line 363

optional :thinking, union: -> { Anthropic::Beta::BetaThinkingConfigParam }

#tool_choiceAnthropic::Models::Beta::BetaToolChoiceAuto, ...

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.



370
# File 'lib/anthropic/models/beta/messages/batch_create_params.rb', line 370

optional :tool_choice, union: -> { Anthropic::Beta::BetaToolChoice }

#toolsArray<Anthropic::Models::Beta::BetaTool, Anthropic::Models::Beta::BetaToolBash20241022, Anthropic::Models::Beta::BetaToolBash20250124, Anthropic::Models::Beta::BetaCodeExecutionTool20250522, Anthropic::Models::Beta::BetaCodeExecutionTool20250825, Anthropic::Models::Beta::BetaCodeExecutionTool20260120, Anthropic::Models::Beta::BetaCodeExecutionTool20260521, Anthropic::Models::Beta::BetaToolComputerUse20241022, Anthropic::Models::Beta::BetaMemoryTool20250818, Anthropic::Models::Beta::BetaToolComputerUse20250124, Anthropic::Models::Beta::BetaToolTextEditor20241022, Anthropic::Models::Beta::BetaToolComputerUse20251124, Anthropic::Models::Beta::BetaToolTextEditor20250124, Anthropic::Models::Beta::BetaToolTextEditor20250429, Anthropic::Models::Beta::BetaToolTextEditor20250728, Anthropic::Models::Beta::BetaWebSearchTool20250305, Anthropic::Models::Beta::BetaWebFetchTool20250910, Anthropic::Models::Beta::BetaWebSearchTool20260209, Anthropic::Models::Beta::BetaWebFetchTool20260209, Anthropic::Models::Beta::BetaWebFetchTool20260309, Anthropic::Models::Beta::BetaWebSearchTool20260318, Anthropic::Models::Beta::BetaWebFetchTool20260318, Anthropic::Models::Beta::BetaAdvisorTool20260301, Anthropic::Models::Beta::BetaToolSearchToolBm25_20251119, Anthropic::Models::Beta::BetaToolSearchToolRegex20251119, Anthropic::Models::Beta::BetaMCPToolset>?

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 tool input shape that the model will produce in tool_use output 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.



452
# File 'lib/anthropic/models/beta/messages/batch_create_params.rb', line 452

optional :tools, -> { Anthropic::Internal::Type::ArrayOf[union: Anthropic::Beta::BetaToolUnion] }

#top_kInteger?

Deprecated.

Deprecated. Models released after Claude Opus 4.6 do not accept top_k; any value

will be rejected with a 400 error.

Only sample from the top K options for each subsequent token.

Used to remove "long tail" low probability responses. Learn more technical details here.

Recommended for advanced use cases only.

Parameters:

  • (Integer)

Returns:

  • (Integer, nil)


466
# File 'lib/anthropic/models/beta/messages/batch_create_params.rb', line 466

optional :top_k, Integer

#top_pFloat?

Deprecated.

Deprecated. Models released after Claude Opus 4.6 do not support setting top_p.

A value >= 0.99 will be accepted for backwards compatibility, all other values will be rejected with a 400 error.

Use nucleus sampling.

In nucleus sampling, we compute the cumulative distribution over all the options for each subsequent token in decreasing probability order and cut it off once it reaches a particular probability specified by top_p.

Recommended for advanced use cases only.

Parameters:

  • (Float)

Returns:

  • (Float, nil)


482
# File 'lib/anthropic/models/beta/messages/batch_create_params.rb', line 482

optional :top_p, Float

Class Method Details

.valuesArray<Symbol>

Returns:

  • (Array<Symbol>)


# File 'lib/anthropic/models/beta/messages/batch_create_params.rb', line 574

.variantsArray(Anthropic::Models::Beta::BetaContainerParams, String)



# File 'lib/anthropic/models/beta/messages/batch_create_params.rb', line 556

Instance Method Details

#to_hash{

Returns:

  • ({)


214
# File 'sig/anthropic/models/beta/messages/batch_create_params.rbs', line 214

def to_hash: -> {