vectorvein 0.1.62__tar.gz → 0.1.63__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {vectorvein-0.1.62 → vectorvein-0.1.63}/PKG-INFO +1 -1
- {vectorvein-0.1.62 → vectorvein-0.1.63}/pyproject.toml +1 -1
- {vectorvein-0.1.62 → vectorvein-0.1.63}/src/vectorvein/chat_clients/anthropic_client.py +50 -37
- {vectorvein-0.1.62 → vectorvein-0.1.63}/src/vectorvein/types/llm_parameters.py +1 -1
- {vectorvein-0.1.62 → vectorvein-0.1.63}/README.md +0 -0
- {vectorvein-0.1.62 → vectorvein-0.1.63}/src/vectorvein/__init__.py +0 -0
- {vectorvein-0.1.62 → vectorvein-0.1.63}/src/vectorvein/chat_clients/__init__.py +0 -0
- {vectorvein-0.1.62 → vectorvein-0.1.63}/src/vectorvein/chat_clients/baichuan_client.py +0 -0
- {vectorvein-0.1.62 → vectorvein-0.1.63}/src/vectorvein/chat_clients/base_client.py +0 -0
- {vectorvein-0.1.62 → vectorvein-0.1.63}/src/vectorvein/chat_clients/deepseek_client.py +0 -0
- {vectorvein-0.1.62 → vectorvein-0.1.63}/src/vectorvein/chat_clients/gemini_client.py +0 -0
- {vectorvein-0.1.62 → vectorvein-0.1.63}/src/vectorvein/chat_clients/groq_client.py +0 -0
- {vectorvein-0.1.62 → vectorvein-0.1.63}/src/vectorvein/chat_clients/local_client.py +0 -0
- {vectorvein-0.1.62 → vectorvein-0.1.63}/src/vectorvein/chat_clients/minimax_client.py +0 -0
- {vectorvein-0.1.62 → vectorvein-0.1.63}/src/vectorvein/chat_clients/mistral_client.py +0 -0
- {vectorvein-0.1.62 → vectorvein-0.1.63}/src/vectorvein/chat_clients/moonshot_client.py +0 -0
- {vectorvein-0.1.62 → vectorvein-0.1.63}/src/vectorvein/chat_clients/openai_client.py +0 -0
- {vectorvein-0.1.62 → vectorvein-0.1.63}/src/vectorvein/chat_clients/openai_compatible_client.py +0 -0
- {vectorvein-0.1.62 → vectorvein-0.1.63}/src/vectorvein/chat_clients/py.typed +0 -0
- {vectorvein-0.1.62 → vectorvein-0.1.63}/src/vectorvein/chat_clients/qwen_client.py +0 -0
- {vectorvein-0.1.62 → vectorvein-0.1.63}/src/vectorvein/chat_clients/stepfun_client.py +0 -0
- {vectorvein-0.1.62 → vectorvein-0.1.63}/src/vectorvein/chat_clients/utils.py +0 -0
- {vectorvein-0.1.62 → vectorvein-0.1.63}/src/vectorvein/chat_clients/xai_client.py +0 -0
- {vectorvein-0.1.62 → vectorvein-0.1.63}/src/vectorvein/chat_clients/yi_client.py +0 -0
- {vectorvein-0.1.62 → vectorvein-0.1.63}/src/vectorvein/chat_clients/zhipuai_client.py +0 -0
- {vectorvein-0.1.62 → vectorvein-0.1.63}/src/vectorvein/py.typed +0 -0
- {vectorvein-0.1.62 → vectorvein-0.1.63}/src/vectorvein/server/token_server.py +0 -0
- {vectorvein-0.1.62 → vectorvein-0.1.63}/src/vectorvein/settings/__init__.py +0 -0
- {vectorvein-0.1.62 → vectorvein-0.1.63}/src/vectorvein/settings/py.typed +0 -0
- {vectorvein-0.1.62 → vectorvein-0.1.63}/src/vectorvein/types/defaults.py +0 -0
- {vectorvein-0.1.62 → vectorvein-0.1.63}/src/vectorvein/types/enums.py +0 -0
- {vectorvein-0.1.62 → vectorvein-0.1.63}/src/vectorvein/types/exception.py +0 -0
- {vectorvein-0.1.62 → vectorvein-0.1.63}/src/vectorvein/types/py.typed +0 -0
- {vectorvein-0.1.62 → vectorvein-0.1.63}/src/vectorvein/utilities/media_processing.py +0 -0
- {vectorvein-0.1.62 → vectorvein-0.1.63}/src/vectorvein/utilities/retry.py +0 -0
@@ -2,7 +2,6 @@
|
|
2
2
|
# @Date: 2024-07-26 14:48:55
|
3
3
|
import json
|
4
4
|
import random
|
5
|
-
from functools import cached_property
|
6
5
|
from typing import overload, Generator, AsyncGenerator, Any, Literal, Iterable
|
7
6
|
|
8
7
|
import httpx
|
@@ -178,19 +177,23 @@ class AnthropicChatClient(BaseChatClient):
|
|
178
177
|
backend_name,
|
179
178
|
)
|
180
179
|
self.model_id = None
|
180
|
+
self.endpoint = None
|
181
181
|
|
182
182
|
@property
|
183
183
|
def raw_client(self): # type: ignore
|
184
|
-
if self.
|
185
|
-
self.random_endpoint
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
184
|
+
if self.endpoint is None:
|
185
|
+
if self.random_endpoint:
|
186
|
+
self.random_endpoint = True
|
187
|
+
endpoint = random.choice(self.backend_settings.models[self.model].endpoints)
|
188
|
+
self.model_id = None
|
189
|
+
if isinstance(endpoint, dict):
|
190
|
+
self.endpoint_id = endpoint["endpoint_id"]
|
191
|
+
self.model_id = endpoint["model_id"]
|
192
|
+
else:
|
193
|
+
self.endpoint_id = endpoint
|
194
|
+
self.endpoint = settings.get_endpoint(self.endpoint_id)
|
191
195
|
else:
|
192
|
-
self.
|
193
|
-
self.endpoint = settings.get_endpoint(self.endpoint_id)
|
196
|
+
self.endpoint = settings.get_endpoint(self.endpoint_id)
|
194
197
|
|
195
198
|
if self.endpoint.is_vertex:
|
196
199
|
if self.endpoint.credentials is None:
|
@@ -330,16 +333,19 @@ class AnthropicChatClient(BaseChatClient):
|
|
330
333
|
if temperature is not None:
|
331
334
|
self.temperature = temperature
|
332
335
|
|
333
|
-
if self.
|
334
|
-
self.random_endpoint
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
336
|
+
if self.endpoint is None:
|
337
|
+
if self.random_endpoint:
|
338
|
+
self.random_endpoint = True
|
339
|
+
endpoint = random.choice(self.backend_settings.models[self.model].endpoints)
|
340
|
+
self.model_id = None
|
341
|
+
if isinstance(endpoint, dict):
|
342
|
+
self.endpoint_id = endpoint["endpoint_id"]
|
343
|
+
self.model_id = endpoint["model_id"]
|
344
|
+
else:
|
345
|
+
self.endpoint_id = endpoint
|
346
|
+
self.endpoint = settings.get_endpoint(self.endpoint_id)
|
340
347
|
else:
|
341
|
-
self.
|
342
|
-
self.endpoint = settings.get_endpoint(self.endpoint_id)
|
348
|
+
self.endpoint = settings.get_endpoint(self.endpoint_id)
|
343
349
|
|
344
350
|
if self.endpoint.api_schema_type == "openai":
|
345
351
|
_tools = OPENAI_NOT_GIVEN if tools is NOT_GIVEN else tools
|
@@ -569,19 +575,23 @@ class AsyncAnthropicChatClient(BaseAsyncChatClient):
|
|
569
575
|
backend_name,
|
570
576
|
)
|
571
577
|
self.model_id = None
|
578
|
+
self.endpoint = None
|
572
579
|
|
573
580
|
@property
|
574
581
|
def raw_client(self): # type: ignore
|
575
|
-
if self.
|
576
|
-
self.random_endpoint
|
577
|
-
|
578
|
-
|
579
|
-
|
580
|
-
|
581
|
-
|
582
|
+
if self.endpoint is None:
|
583
|
+
if self.random_endpoint:
|
584
|
+
self.random_endpoint = True
|
585
|
+
endpoint = random.choice(self.backend_settings.models[self.model].endpoints)
|
586
|
+
self.model_id = None
|
587
|
+
if isinstance(endpoint, dict):
|
588
|
+
self.endpoint_id = endpoint["endpoint_id"]
|
589
|
+
self.model_id = endpoint["model_id"]
|
590
|
+
else:
|
591
|
+
self.endpoint_id = endpoint
|
592
|
+
self.endpoint = settings.get_endpoint(self.endpoint_id)
|
582
593
|
else:
|
583
|
-
self.
|
584
|
-
self.endpoint = settings.get_endpoint(self.endpoint_id)
|
594
|
+
self.endpoint = settings.get_endpoint(self.endpoint_id)
|
585
595
|
|
586
596
|
if self.endpoint.is_vertex:
|
587
597
|
if self.endpoint.credentials is None:
|
@@ -720,16 +730,19 @@ class AsyncAnthropicChatClient(BaseAsyncChatClient):
|
|
720
730
|
if temperature is not None:
|
721
731
|
self.temperature = temperature
|
722
732
|
|
723
|
-
if self.
|
724
|
-
self.random_endpoint
|
725
|
-
|
726
|
-
|
727
|
-
|
728
|
-
|
729
|
-
|
733
|
+
if self.endpoint is None:
|
734
|
+
if self.random_endpoint:
|
735
|
+
self.random_endpoint = True
|
736
|
+
endpoint = random.choice(self.backend_settings.models[self.model].endpoints)
|
737
|
+
self.model_id = None
|
738
|
+
if isinstance(endpoint, dict):
|
739
|
+
self.endpoint_id = endpoint["endpoint_id"]
|
740
|
+
self.model_id = endpoint["model_id"]
|
741
|
+
else:
|
742
|
+
self.endpoint_id = endpoint
|
743
|
+
self.endpoint = settings.get_endpoint(self.endpoint_id)
|
730
744
|
else:
|
731
|
-
self.
|
732
|
-
self.endpoint = settings.get_endpoint(self.endpoint_id)
|
745
|
+
self.endpoint = settings.get_endpoint(self.endpoint_id)
|
733
746
|
|
734
747
|
if self.endpoint.api_schema_type == "openai":
|
735
748
|
_tools = OPENAI_NOT_GIVEN if tools is NOT_GIVEN else tools
|
@@ -28,7 +28,7 @@ class EndpointOptionDict(TypedDict):
|
|
28
28
|
class EndpointSetting(BaseModel):
|
29
29
|
id: str = Field(..., description="The id of the endpoint.")
|
30
30
|
region: Optional[str] = Field(None, description="The region for the endpoint.")
|
31
|
-
api_base: str = Field(None, description="The base URL for the API.")
|
31
|
+
api_base: Optional[str] = Field(None, description="The base URL for the API.")
|
32
32
|
api_key: Optional[str] = Field(None, description="The API key for authentication.")
|
33
33
|
api_schema_type: Optional[str] = Field(
|
34
34
|
"default",
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{vectorvein-0.1.62 → vectorvein-0.1.63}/src/vectorvein/chat_clients/openai_compatible_client.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|