diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index aac54e7..d68657d 100644 --- a/.speakeasy/gen.lock +++ b/.speakeasy/gen.lock @@ -1,12 +1,12 @@ lockVersion: 2.0.0 id: 232c6d4f-b0fd-4172-8f1b-e2421566e9b4 management: - docChecksum: 15ebbb27870a24f8f19c47eecc775af8 + docChecksum: 98b4f227e767bb91333b3b3469d93fa5 docVersion: 1.0.0 speakeasyVersion: 1.611.1 generationVersion: 2.694.1 - releaseVersion: 0.5.1 - configChecksum: 568679387340b2a17402ed3f9ffbf851 + releaseVersion: 0.5.2 + configChecksum: 4619605fbeb6f4488feb5336aa62bab6 repoURL: https://github.com/speakeasy-sdks/openrouter-python-sdk.git installationURL: https://github.com/speakeasy-sdks/openrouter-python-sdk.git features: @@ -315,7 +315,7 @@ examples: streamChatCompletion: speakeasy-default-stream-chat-completion: requestBody: - application/json: {"stream": false, "messages": [{"role": "user", "content": "Hello, how are you?"}], "temperature": 1, "top_p": 1} + application/json: {"messages": [{"role": "user", "content": "Hello, how are you?"}], "stream": true, "temperature": 1, "top_p": 1} responses: "400": application/json: {"error": {"code": null, "message": ""}} diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index fca4333..f8e576d 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -25,7 +25,7 @@ generation: generateNewTests: true skipResponseBodyAssertions: false python: - version: 0.5.1 + version: 0.5.2 additionalDependencies: dev: {} main: {} diff --git a/.speakeasy/in.openapi.yaml b/.speakeasy/in.openapi.yaml index cf74e4b..6fb845b 100644 --- a/.speakeasy/in.openapi.yaml +++ b/.speakeasy/in.openapi.yaml @@ -1501,6 +1501,7 @@ components: description: Chat completion request parameters ChatStreamCompletionCreateParams: allOf: + - $ref: '#/components/schemas/ChatCompletionCreateParams' - type: object properties: stream: @@ -1509,7 +1510,6 @@ components: - true default: true description: Enable streaming response - - $ref: '#/components/schemas/ChatCompletionCreateParams' parameters: {} paths: /chat/completions: diff --git a/.speakeasy/out.openapi.yaml b/.speakeasy/out.openapi.yaml index cf74e4b..6fb845b 100644 --- a/.speakeasy/out.openapi.yaml +++ b/.speakeasy/out.openapi.yaml @@ -1501,6 +1501,7 @@ components: description: Chat completion request parameters ChatStreamCompletionCreateParams: allOf: + - $ref: '#/components/schemas/ChatCompletionCreateParams' - type: object properties: stream: @@ -1509,7 +1510,6 @@ components: - true default: true description: Enable streaming response - - $ref: '#/components/schemas/ChatCompletionCreateParams' parameters: {} paths: /chat/completions: diff --git a/README-PYPI.md b/README-PYPI.md index 19c2f66..cdffb3c 100644 --- a/README-PYPI.md +++ b/README-PYPI.md @@ -248,7 +248,7 @@ with OpenRouter( "role": "user", "content": "Hello, how are you?", }, - ], stream=False, temperature=1, top_p=1) + ], stream=True, temperature=1, top_p=1) with res as event_stream: for event in event_stream: diff --git a/README.md b/README.md index 76f2d2c..c092889 100644 --- a/README.md +++ b/README.md @@ -248,7 +248,7 @@ with OpenRouter( "role": "user", "content": "Hello, how are you?", }, - ], stream=False, temperature=1, top_p=1) + ], stream=True, temperature=1, top_p=1) with res as event_stream: for event in event_stream: diff --git a/docs/models/chatstreamcompletioncreateparams.md b/docs/models/chatstreamcompletioncreateparams.md index ce7a8c4..a67bebf 100644 --- a/docs/models/chatstreamcompletioncreateparams.md +++ b/docs/models/chatstreamcompletioncreateparams.md @@ -7,7 +7,6 @@ Chat completion request parameters | Field | Type | Required | Description | Example | | ---------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- | -| `stream` | *OptionalNullable[bool]* | :heavy_minus_sign: | Enable streaming response | | | `messages` | List[[models.ChatCompletionMessageParam](../models/chatcompletionmessageparam.md)] | :heavy_check_mark: | List of messages for the conversation | [
{
"role": "user",
"content": "Hello, how are you?"
}
] | | `model` | *Optional[str]* | :heavy_minus_sign: | Model to use for completion | | | `frequency_penalty` | *OptionalNullable[float]* | :heavy_minus_sign: | Frequency penalty (-2.0 to 2.0) | | @@ -22,6 +21,7 @@ Chat completion request parameters | `response_format` | [Optional[models.ChatStreamCompletionCreateParamsResponseFormatUnion]](../models/chatstreamcompletioncreateparamsresponseformatunion.md) | :heavy_minus_sign: | Response format configuration | | | `seed` | *OptionalNullable[int]* | :heavy_minus_sign: | Random seed for deterministic outputs | | | `stop` | [OptionalNullable[models.ChatStreamCompletionCreateParamsStop]](../models/chatstreamcompletioncreateparamsstop.md) | :heavy_minus_sign: | Stop sequences (up to 4) | | +| `stream` | *Optional[bool]* | :heavy_minus_sign: | Enable streaming response | | | `stream_options` | [OptionalNullable[models.ChatStreamCompletionCreateParamsStreamOptions]](../models/chatstreamcompletioncreateparamsstreamoptions.md) | :heavy_minus_sign: | N/A | | | `temperature` | *OptionalNullable[float]* | :heavy_minus_sign: | Sampling temperature (0-2) | | | `tool_choice` | [Optional[models.ChatCompletionToolChoiceOption]](../models/chatcompletiontoolchoiceoption.md) | :heavy_minus_sign: | Tool choice configuration | | diff --git a/docs/sdks/chat/README.md b/docs/sdks/chat/README.md index f08f449..bc639cd 100644 --- a/docs/sdks/chat/README.md +++ b/docs/sdks/chat/README.md @@ -102,7 +102,7 @@ with OpenRouter( "role": "user", "content": "Hello, how are you?", }, - ], stream=False, temperature=1, top_p=1) + ], stream=True, temperature=1, top_p=1) with res as event_stream: for event in event_stream: @@ -116,7 +116,6 @@ with OpenRouter( | Parameter | Type | Required | Description | Example | | ------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- | | `messages` | List[[models.ChatCompletionMessageParam](../../models/chatcompletionmessageparam.md)] | :heavy_check_mark: | List of messages for the conversation | [
{
"role": "user",
"content": "Hello, how are you?"
}
] | -| `stream` | *OptionalNullable[bool]* | :heavy_minus_sign: | Enable streaming response | | | `model` | *Optional[str]* | :heavy_minus_sign: | Model to use for completion | | | `frequency_penalty` | *OptionalNullable[float]* | :heavy_minus_sign: | Frequency penalty (-2.0 to 2.0) | | | `logit_bias` | Dict[str, *float*] | :heavy_minus_sign: | Token logit bias adjustments | | @@ -130,6 +129,7 @@ with OpenRouter( | `response_format` | [Optional[models.ChatStreamCompletionCreateParamsResponseFormatUnion]](../../models/chatstreamcompletioncreateparamsresponseformatunion.md) | :heavy_minus_sign: | Response format configuration | | | `seed` | *OptionalNullable[int]* | :heavy_minus_sign: | Random seed for deterministic outputs | | | `stop` | [OptionalNullable[models.ChatStreamCompletionCreateParamsStop]](../../models/chatstreamcompletioncreateparamsstop.md) | :heavy_minus_sign: | Stop sequences (up to 4) | | +| `stream` | *Optional[bool]* | :heavy_minus_sign: | Enable streaming response | | | `stream_options` | [OptionalNullable[models.ChatStreamCompletionCreateParamsStreamOptions]](../../models/chatstreamcompletioncreateparamsstreamoptions.md) | :heavy_minus_sign: | N/A | | | `temperature` | *OptionalNullable[float]* | :heavy_minus_sign: | Sampling temperature (0-2) | | | `tool_choice` | [Optional[models.ChatCompletionToolChoiceOption]](../../models/chatcompletiontoolchoiceoption.md) | :heavy_minus_sign: | Tool choice configuration | | diff --git a/pyproject.toml b/pyproject.toml index d78dd18..573ac55 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "openrouter" -version = "0.5.1" +version = "0.5.2" description = "Python Client SDK Generated by Speakeasy." authors = [{ name = "Speakeasy" },] readme = "README-PYPI.md" diff --git a/src/openrouter/_version.py b/src/openrouter/_version.py index b3fb38a..2277dde 100644 --- a/src/openrouter/_version.py +++ b/src/openrouter/_version.py @@ -3,10 +3,10 @@ import importlib.metadata __title__: str = "openrouter" -__version__: str = "0.5.1" +__version__: str = "0.5.2" __openapi_doc_version__: str = "1.0.0" __gen_version__: str = "2.694.1" -__user_agent__: str = "speakeasy-sdk/python 0.5.1 2.694.1 1.0.0 openrouter" +__user_agent__: str = "speakeasy-sdk/python 0.5.2 2.694.1 1.0.0 openrouter" try: if __package__ is not None: diff --git a/src/openrouter/chat.py b/src/openrouter/chat.py index 822f61a..56afd7c 100644 --- a/src/openrouter/chat.py +++ b/src/openrouter/chat.py @@ -491,7 +491,6 @@ class Chat(BaseSDK): List[models.ChatCompletionMessageParam], List[models.ChatCompletionMessageParamTypedDict], ], - stream: OptionalNullable[bool] = False, model: Optional[str] = None, frequency_penalty: OptionalNullable[float] = UNSET, logit_bias: OptionalNullable[Dict[str, float]] = UNSET, @@ -520,6 +519,7 @@ class Chat(BaseSDK): models.ChatStreamCompletionCreateParamsStopTypedDict, ] ] = UNSET, + stream: Optional[bool] = True, stream_options: OptionalNullable[ Union[ models.ChatStreamCompletionCreateParamsStreamOptions, @@ -567,7 +567,6 @@ class Chat(BaseSDK): Creates a model response for the given chat conversation. Supports both streaming and non-streaming modes. :param messages: List of messages for the conversation - :param stream: Enable streaming response :param model: Model to use for completion :param frequency_penalty: Frequency penalty (-2.0 to 2.0) :param logit_bias: Token logit bias adjustments @@ -581,6 +580,7 @@ class Chat(BaseSDK): :param response_format: Response format configuration :param seed: Random seed for deterministic outputs :param stop: Stop sequences (up to 4) + :param stream: Enable streaming response :param stream_options: :param temperature: Sampling temperature (0-2) :param tool_choice: Tool choice configuration @@ -607,7 +607,6 @@ class Chat(BaseSDK): base_url = self._get_url(base_url, url_variables) request = models.ChatStreamCompletionCreateParams( - stream=stream, messages=utils.get_pydantic_model( messages, List[models.ChatCompletionMessageParam] ), @@ -630,6 +629,7 @@ class Chat(BaseSDK): ), seed=seed, stop=stop, + stream=stream, stream_options=utils.get_pydantic_model( stream_options, OptionalNullable[models.ChatStreamCompletionCreateParamsStreamOptions], @@ -743,7 +743,6 @@ class Chat(BaseSDK): List[models.ChatCompletionMessageParam], List[models.ChatCompletionMessageParamTypedDict], ], - stream: OptionalNullable[bool] = False, model: Optional[str] = None, frequency_penalty: OptionalNullable[float] = UNSET, logit_bias: OptionalNullable[Dict[str, float]] = UNSET, @@ -772,6 +771,7 @@ class Chat(BaseSDK): models.ChatStreamCompletionCreateParamsStopTypedDict, ] ] = UNSET, + stream: Optional[bool] = True, stream_options: OptionalNullable[ Union[ models.ChatStreamCompletionCreateParamsStreamOptions, @@ -819,7 +819,6 @@ class Chat(BaseSDK): Creates a model response for the given chat conversation. Supports both streaming and non-streaming modes. :param messages: List of messages for the conversation - :param stream: Enable streaming response :param model: Model to use for completion :param frequency_penalty: Frequency penalty (-2.0 to 2.0) :param logit_bias: Token logit bias adjustments @@ -833,6 +832,7 @@ class Chat(BaseSDK): :param response_format: Response format configuration :param seed: Random seed for deterministic outputs :param stop: Stop sequences (up to 4) + :param stream: Enable streaming response :param stream_options: :param temperature: Sampling temperature (0-2) :param tool_choice: Tool choice configuration @@ -859,7 +859,6 @@ class Chat(BaseSDK): base_url = self._get_url(base_url, url_variables) request = models.ChatStreamCompletionCreateParams( - stream=stream, messages=utils.get_pydantic_model( messages, List[models.ChatCompletionMessageParam] ), @@ -882,6 +881,7 @@ class Chat(BaseSDK): ), seed=seed, stop=stop, + stream=stream, stream_options=utils.get_pydantic_model( stream_options, OptionalNullable[models.ChatStreamCompletionCreateParamsStreamOptions], diff --git a/src/openrouter/models/chatstreamcompletioncreateparams.py b/src/openrouter/models/chatstreamcompletioncreateparams.py index 584abc5..aa19b5e 100644 --- a/src/openrouter/models/chatstreamcompletioncreateparams.py +++ b/src/openrouter/models/chatstreamcompletioncreateparams.py @@ -883,8 +883,6 @@ class ChatStreamCompletionCreateParamsTypedDict(TypedDict): messages: List[ChatCompletionMessageParamTypedDict] r"""List of messages for the conversation""" - stream: NotRequired[Nullable[bool]] - r"""Enable streaming response""" model: NotRequired[str] r"""Model to use for completion""" frequency_penalty: NotRequired[Nullable[float]] @@ -913,6 +911,8 @@ class ChatStreamCompletionCreateParamsTypedDict(TypedDict): r"""Random seed for deterministic outputs""" stop: NotRequired[Nullable[ChatStreamCompletionCreateParamsStopTypedDict]] r"""Stop sequences (up to 4)""" + stream: NotRequired[bool] + r"""Enable streaming response""" stream_options: NotRequired[ Nullable[ChatStreamCompletionCreateParamsStreamOptionsTypedDict] ] @@ -944,9 +944,6 @@ class ChatStreamCompletionCreateParams(BaseModel): messages: List[ChatCompletionMessageParam] r"""List of messages for the conversation""" - stream: OptionalNullable[bool] = False - r"""Enable streaming response""" - model: Optional[str] = None r"""Model to use for completion""" @@ -988,6 +985,9 @@ class ChatStreamCompletionCreateParams(BaseModel): stop: OptionalNullable[ChatStreamCompletionCreateParamsStop] = UNSET r"""Stop sequences (up to 4)""" + stream: Optional[bool] = True + r"""Enable streaming response""" + stream_options: OptionalNullable[ChatStreamCompletionCreateParamsStreamOptions] = ( UNSET ) @@ -1026,7 +1026,6 @@ class ChatStreamCompletionCreateParams(BaseModel): @model_serializer(mode="wrap") def serialize_model(self, handler): optional_fields = [ - "stream", "model", "frequency_penalty", "logit_bias", @@ -1040,6 +1039,7 @@ class ChatStreamCompletionCreateParams(BaseModel): "response_format", "seed", "stop", + "stream", "stream_options", "temperature", "tool_choice", @@ -1052,7 +1052,6 @@ class ChatStreamCompletionCreateParams(BaseModel): "plugins", ] nullable_fields = [ - "stream", "frequency_penalty", "logit_bias", "logprobs", diff --git a/uv.lock b/uv.lock index 2520774..431c396 100644 --- a/uv.lock +++ b/uv.lock @@ -201,7 +201,7 @@ wheels = [ [[package]] name = "openrouter" -version = "0.5.1" +version = "0.5.2" source = { editable = "." } dependencies = [ { name = "httpcore" },