Home / Function/ create() — anthropic-sdk-python Function Reference

create() — anthropic-sdk-python Function Reference

Architecture documentation for the create() function in batches.py from the anthropic-sdk-python codebase.

Function python AnthropicClient SyncAPI calls 1 called by 1

Entity Profile

Dependency Diagram

graph TD
  eb402747_3f4c_1529_7731_07000b62d2de["create()"]
  ed73efe2_f340_c24f_2bf4_933c18889495["AsyncBatches"]
  eb402747_3f4c_1529_7731_07000b62d2de -->|defined in| ed73efe2_f340_c24f_2bf4_933c18889495
  6c043e0f_9673_5341_e44b_834959537834["create()"]
  6c043e0f_9673_5341_e44b_834959537834 -->|calls| eb402747_3f4c_1529_7731_07000b62d2de
  6c043e0f_9673_5341_e44b_834959537834["create()"]
  eb402747_3f4c_1529_7731_07000b62d2de -->|calls| 6c043e0f_9673_5341_e44b_834959537834
  style eb402747_3f4c_1529_7731_07000b62d2de fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

src/anthropic/resources/beta/messages/batches.py lines 436–490

    async def create(
        self,
        *,
        requests: Iterable[batch_create_params.Request],
        betas: List[AnthropicBetaParam] | Omit = omit,
        # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
        # The extra values given here take precedence over values defined on the client or passed to this method.
        extra_headers: Headers | None = None,
        extra_query: Query | None = None,
        extra_body: Body | None = None,
        timeout: float | httpx.Timeout | None | NotGiven = not_given,
    ) -> BetaMessageBatch:
        """
        Send a batch of Message creation requests.

        The Message Batches API can be used to process multiple Messages API requests at
        once. Once a Message Batch is created, it begins processing immediately. Batches
        can take up to 24 hours to complete.

        Learn more about the Message Batches API in our
        [user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing)

        Args:
          requests: List of requests for prompt completion. Each is an individual request to create
              a Message.

          betas: Optional header to specify the beta version(s) you want to use.

          extra_headers: Send extra headers

          extra_query: Add additional query parameters to the request

          extra_body: Add additional JSON properties to the request

          timeout: Override the client-level default timeout for this request, in seconds
        """
        extra_headers = {
            **strip_not_given(
                {
                    "anthropic-beta": ",".join(chain((str(e) for e in betas), ["message-batches-2024-09-24"]))
                    if is_given(betas)
                    else not_given
                }
            ),
            **(extra_headers or {}),
        }
        extra_headers = {"anthropic-beta": "message-batches-2024-09-24", **(extra_headers or {})}
        return await self._post(
            "/v1/messages/batches?beta=true",
            body=await async_maybe_transform({"requests": requests}, batch_create_params.BatchCreateParams),
            options=make_request_options(
                extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
            ),
            cast_to=BetaMessageBatch,
        )

Subdomains

Calls

Called By

Frequently Asked Questions

What does create() do?
create() is a function in the anthropic-sdk-python codebase, defined in src/anthropic/resources/beta/messages/batches.py.
Where is create() defined?
create() is defined in src/anthropic/resources/beta/messages/batches.py at line 436.
What does create() call?
create() calls 1 function(s): create.
What calls create()?
create() is called by 1 function(s): create.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free