Skip to content

Commit 062077e

Browse files
authored
fix(structured outputs): avoid including beta header if output_format is missing (#1121)
* fix(structured outputs): avoid including beta header if output_format is missing * fix ci * fix condition
1 parent ea50de9 commit 062077e

File tree

3 files changed

+4
-6
lines changed

3 files changed

+4
-6
lines changed

src/anthropic/resources/beta/messages/messages.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1113,7 +1113,7 @@ def parse(
11131113

11141114
betas = [beta for beta in betas] if is_given(betas) else []
11151115

1116-
if "structured-outputs-2025-11-13" not in betas:
1116+
if "structured-outputs-2025-11-13" not in betas and is_given(output_format):
11171117
# Ensure structured outputs beta is included for parse method
11181118
betas.append("structured-outputs-2025-11-13")
11191119

@@ -2789,7 +2789,7 @@ async def parse(
27892789
)
27902790
betas = [beta for beta in betas] if is_given(betas) else []
27912791

2792-
if "structured-outputs-2025-11-13" not in betas:
2792+
if "structured-outputs-2025-11-13" not in betas and is_given(output_format):
27932793
# Ensure structured outputs beta is included for parse method
27942794
betas.append("structured-outputs-2025-11-13")
27952795

src/anthropic/types/beta/messages/batch_create_params.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from __future__ import annotations
44

5-
from typing import List, Literal, Iterable
5+
from typing import List, Iterable
66
from typing_extensions import Required, Annotated, TypedDict
77

88
from ...._utils import PropertyInfo
@@ -28,8 +28,6 @@ class RequestParamsOutputFormat(TypedDict, total=False):
2828
"""The JSON schema of the format"""
2929

3030

31-
32-
3331
class Request(TypedDict, total=False):
3432
custom_id: Required[str]
3533
"""Developer-provided ID created for each request in a Message Batch.

uv.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)