From 2d7f03b2ed0668729e2837f8aa325c34ed47f964 Mon Sep 17 00:00:00 2001 From: 9qeklajc Date: Sun, 26 Apr 2026 22:42:39 +0200 Subject: [PATCH] fix: switch openai NOT_GIVEN to omit for openai 2.x compat --- routstr/upstream/clients/gemini.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/routstr/upstream/clients/gemini.py b/routstr/upstream/clients/gemini.py index 893dd647..c9c750c4 100644 --- a/routstr/upstream/clients/gemini.py +++ b/routstr/upstream/clients/gemini.py @@ -26,14 +26,14 @@ class GeminiClient(BaseAPIClient): max_tokens: int | None = None, **kwargs: Any, ) -> dict[str, Any]: - from openai import NOT_GIVEN + from openai import omit response = await self.client.chat.completions.create( model=model, messages=messages, # type: ignore - temperature=temperature if temperature is not None else NOT_GIVEN, - max_tokens=max_tokens if max_tokens is not None else NOT_GIVEN, - top_p=kwargs.get("top_p", NOT_GIVEN), + temperature=temperature if temperature is not None else omit, + max_tokens=max_tokens if max_tokens is not None else omit, + top_p=kwargs.get("top_p", omit), ) return response.model_dump() @@ -45,7 +45,7 @@ class GeminiClient(BaseAPIClient): max_tokens: int | None = None, **kwargs: Any, ) -> AsyncGenerator[dict[str, Any], None]: - from openai import NOT_GIVEN + from openai import omit usage_callback = kwargs.get("usage_callback") completion_callback = kwargs.get("completion_callback") @@ -55,9 +55,9 @@ class GeminiClient(BaseAPIClient): messages=messages, # type: ignore stream=True, stream_options={"include_usage": True}, - temperature=temperature if temperature is not None else NOT_GIVEN, - max_tokens=max_tokens if max_tokens is not None else NOT_GIVEN, - top_p=kwargs.get("top_p", NOT_GIVEN), + temperature=temperature if temperature is not None else omit, + max_tokens=max_tokens if max_tokens is not None else omit, + top_p=kwargs.get("top_p", omit), ) final_usage = None