Skip to content

Commit 54a41d9

Browse files
xcpkyzhaobin
andauthored
Make OpenRouterProvider and DeepSeekProvider __init__ overloads less restrictive (#3739)
Co-authored-by: zhaobin <zhaobin@icbench.com>
1 parent 1894f35 commit 54a41d9

File tree

2 files changed

+18
-25
lines changed

2 files changed

+18
-25
lines changed

pydantic_ai_slim/pydantic_ai/providers/deepseek.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -58,16 +58,16 @@ def model_profile(self, model_name: str) -> ModelProfile | None:
5858
).update(profile)
5959

6060
@overload
61-
def __init__(self) -> None: ...
61+
def __init__(self, *, openai_client: AsyncOpenAI) -> None: ...
6262

6363
@overload
64-
def __init__(self, *, api_key: str) -> None: ...
65-
66-
@overload
67-
def __init__(self, *, api_key: str, http_client: httpx.AsyncClient) -> None: ...
68-
69-
@overload
70-
def __init__(self, *, openai_client: AsyncOpenAI | None = None) -> None: ...
64+
def __init__(
65+
self,
66+
*,
67+
api_key: str | None = None,
68+
openai_client: None = None,
69+
http_client: httpx.AsyncClient | None = None,
70+
) -> None: ...
7171

7272
def __init__(
7373
self,

pydantic_ai_slim/pydantic_ai/providers/openrouter.py

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -137,25 +137,18 @@ def model_profile(self, model_name: str) -> ModelProfile | None:
137137
).update(profile)
138138

139139
@overload
140-
def __init__(self) -> None: ...
140+
def __init__(self, *, openai_client: AsyncOpenAI) -> None: ...
141141

142142
@overload
143-
def __init__(self, *, api_key: str) -> None: ...
144-
145-
@overload
146-
def __init__(self, *, api_key: str, http_client: httpx.AsyncClient) -> None: ...
147-
148-
@overload
149-
def __init__(self, *, api_key: str, app_url: str, app_title: str) -> None: ...
150-
151-
@overload
152-
def __init__(self, *, api_key: str, app_url: str, app_title: str, http_client: httpx.AsyncClient) -> None: ...
153-
154-
@overload
155-
def __init__(self, *, http_client: httpx.AsyncClient) -> None: ...
156-
157-
@overload
158-
def __init__(self, *, openai_client: AsyncOpenAI | None = None) -> None: ...
143+
def __init__(
144+
self,
145+
*,
146+
api_key: str | None = None,
147+
app_url: str | None = None,
148+
app_title: str | None = None,
149+
openai_client: None = None,
150+
http_client: httpx.AsyncClient | None = None,
151+
) -> None: ...
159152

160153
def __init__(
161154
self,

0 commit comments

Comments
 (0)