99
1010from typing import List
1111
12+ import anthropic
13+ from google import genai
1214from openai import AsyncOpenAI , OpenAI
1315
1416from .api_polling import APIPolling
@@ -19,7 +21,7 @@ def __init__(self,
1921 api_keys : APIPolling | List [str ],
2022 * args , ** kwargs ):
2123 self .api_polling = APIPolling (api_keys )
22- self .openai_kwargs = kwargs .copy ()
24+ self .client_kwargs = kwargs .copy ()
2325
2426 def __len__ (self ):
2527 return self .api_polling .polling_length
@@ -28,14 +30,49 @@ def __len__(self):
2830 def client (self ) -> OpenAI :
2931 client = OpenAI (
3032 api_key = self .api_polling .api_key ,
31- ** self .openai_kwargs
33+ ** self .client_kwargs
3234 )
3335 return client
3436
3537 @property
3638 def async_client (self ) -> AsyncOpenAI :
3739 client = AsyncOpenAI (
3840 api_key = self .api_polling .api_key ,
39- ** self .openai_kwargs
41+ ** self .client_kwargs
42+ )
43+ return client
44+
45+
46+ class GeminiClientPolling (ClientPolling ):
47+ @property
48+ def client (self ) -> genai .Client :
49+ client = genai .Client (
50+ api_key = self .api_polling .api_key ,
51+ ** self .client_kwargs
52+ )
53+ return client
54+
55+ @property
56+ def async_client (self ) -> genai .Client :
57+ """
58+ Google GenAI SDK not support async client. (At least I have not found that)
59+ """
60+ return self .client
61+
62+
63+ class ClaudeClientPolling (ClientPolling ):
64+ @property
65+ def client (self ) -> anthropic .Anthropic :
66+ client = anthropic .Anthropic (
67+ api_key = self .api_polling .api_key ,
68+ ** self .client_kwargs
69+ )
70+ return client
71+
72+ @property
73+ def async_client (self ) -> anthropic .AsyncAnthropic :
74+ client = anthropic .AsyncAnthropic (
75+ api_key = self .api_polling .api_key ,
76+ ** self .client_kwargs
4077 )
4178 return client
0 commit comments