[DOCS] Python SDK stream parameter type Literal[false] contradicts description
Documentation Type
Unclear/confusing documentation
Documentation Location
https://platform.claude.com/docs/en/api/python/messages/create
Section/Topic
Parameters section, stream parameter definition
Current Documentation
stream: Optional[Literal[false]]Whether to incrementally stream the response using server-sent events. See streaming for details. -false
What's Wrong or Missing?
Contradiction: The type definition Optional[Literal[false]] syntactically restricts the value to only False or None. However, the description says "Whether to incrementally stream the response" which implies the parameter can be set to True to enable streaming.
This creates confusion:
- Type says: Only
FalseorNoneallowed - Description says: Controls whether to stream (implying
Trueis valid)
Users don't know if:
- Streaming is supported on this endpoint via
stream=True - A separate method (e.g.,
messages.stream()) must be used instead - This is a documentation generator bug
Suggested Improvement
Option A: If messages.create supports streaming via stream=True:
stream: Optional[bool]
Whether to incrementally stream the response using server-sent events.
Set to `true` to enable streaming. Defaults to `false`.
Option B: If streaming requires a different method:
stream: Optional[Literal[false]]
Must be `False` or omitted. For streaming responses, use the `messages.stream()` method instead.
See [streaming](https://docs.claude.com/en/api/messages-streaming) for details.
Impact
Medium - Makes feature difficult to understand
Additional Context
Affected Pages:
| Page | Line | Endpoint |
|------|------|----------|
| https://platform.claude.com/docs/en/api/python/messages/create | 1569 | messages.create |
| https://platform.claude.com/docs/en/api/python/messages | 1571 | messages.create |
| https://platform.claude.com/docs/en/api/python/beta/messages/create | 2770 | beta.messages.create |
| https://platform.claude.com/docs/en/api/python/beta/messages | 2772 | beta.messages.create |
| https://platform.claude.com/docs/en/api/python/completions/create | 174 | completions.create |
| https://platform.claude.com/docs/en/api/python/completions | 176 | completions.create |
| https://platform.claude.com/docs/en/api/python/beta | 3311 | beta.messages.create |
Total scope: 7 files with contradictory stream: Optional[Literal[false]] definition.
Pattern searched: stream:.*Literal\[false\]
Note: This affects both the Messages API and the legacy Completions API.
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗