results() — anthropic-sdk-python Function Reference
Architecture documentation for the results() function in batches.py from the anthropic-sdk-python codebase.
Entity Profile
Dependency Diagram
graph TD 152e22b1_8e3c_0832_4a29_9c2ada3d5f79["results()"] ed73efe2_f340_c24f_2bf4_933c18889495["AsyncBatches"] 152e22b1_8e3c_0832_4a29_9c2ada3d5f79 -->|defined in| ed73efe2_f340_c24f_2bf4_933c18889495 67be316c_9863_b4bd_9bbc_d8e337c703db["results()"] 67be316c_9863_b4bd_9bbc_d8e337c703db -->|calls| 152e22b1_8e3c_0832_4a29_9c2ada3d5f79 71222aa7_f413_7f74_6de7_f1b11ab10d35["retrieve()"] 152e22b1_8e3c_0832_4a29_9c2ada3d5f79 -->|calls| 71222aa7_f413_7f74_6de7_f1b11ab10d35 67be316c_9863_b4bd_9bbc_d8e337c703db["results()"] 152e22b1_8e3c_0832_4a29_9c2ada3d5f79 -->|calls| 67be316c_9863_b4bd_9bbc_d8e337c703db 0751e31f_8bae_63a0_44b9_22ed73da9d12["retrieve()"] 152e22b1_8e3c_0832_4a29_9c2ada3d5f79 -->|calls| 0751e31f_8bae_63a0_44b9_22ed73da9d12 style 152e22b1_8e3c_0832_4a29_9c2ada3d5f79 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
src/anthropic/resources/beta/messages/batches.py lines 737–800
async def results(
self,
message_batch_id: str,
*,
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,
) -> AsyncJSONLDecoder[BetaMessageBatchIndividualResponse]:
"""
Streams the results of a Message Batch as a `.jsonl` file.
Each line in the file is a JSON object containing the result of a single request
in the Message Batch. Results are not guaranteed to be in the same order as
requests. Use the `custom_id` field to match results to requests.
Learn more about the Message Batches API in our
[user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing)
Args:
message_batch_id: ID of the Message Batch.
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
"""
if not message_batch_id:
raise ValueError(f"Expected a non-empty value for `message_batch_id` but received {message_batch_id!r}")
batch = await self.retrieve(message_batch_id=message_batch_id)
if not batch.results_url:
raise AnthropicError(
f"No `results_url` for the given batch; Has it finished processing? {batch.processing_status}"
)
extra_headers = {"Accept": "application/binary", **(extra_headers or {})}
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._get(
batch.results_url,
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
cast_to=AsyncJSONLDecoder[BetaMessageBatchIndividualResponse],
stream=True,
)
Domain
Subdomains
Called By
Source
Frequently Asked Questions
What does results() do?
results() is a function in the anthropic-sdk-python codebase, defined in src/anthropic/resources/beta/messages/batches.py.
Where is results() defined?
results() is defined in src/anthropic/resources/beta/messages/batches.py at line 737.
What does results() call?
results() calls 3 function(s): results, retrieve, retrieve.
What calls results()?
results() is called by 1 function(s): results.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free