vectorvein 0.1.52__py3-none-any.whl → 0.1.53__py3-none-any.whl

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.
@@ -6,6 +6,7 @@ from typing import overload, Literal
6
6
  from .base_client import BaseChatClient, BaseAsyncChatClient
7
7
 
8
8
  from .yi_client import YiChatClient, AsyncYiChatClient
9
+ from .xai_client import XAIChatClient, AsyncXAIChatClient
9
10
  from .groq_client import GroqChatClient, AsyncGroqChatClient
10
11
  from .qwen_client import QwenChatClient, AsyncQwenChatClient
11
12
  from .local_client import LocalChatClient, AsyncLocalChatClient
@@ -41,6 +42,7 @@ BackendMap = {
41
42
  BackendType.ZhiPuAI: ZhiPuAIChatClient,
42
43
  BackendType.Baichuan: BaichuanChatClient,
43
44
  BackendType.StepFun: StepFunChatClient,
45
+ BackendType.XAI: XAIChatClient,
44
46
  },
45
47
  "async": {
46
48
  BackendType.Anthropic: AsyncAnthropicChatClient,
@@ -57,6 +59,7 @@ BackendMap = {
57
59
  BackendType.ZhiPuAI: AsyncZhiPuAIChatClient,
58
60
  BackendType.Baichuan: AsyncBaichuanChatClient,
59
61
  BackendType.StepFun: AsyncStepFunChatClient,
62
+ BackendType.XAI: AsyncXAIChatClient,
60
63
  },
61
64
  }
62
65
 
@@ -257,6 +260,20 @@ def create_chat_client(
257
260
  ) -> StepFunChatClient: ...
258
261
 
259
262
 
263
+ @overload
264
+ def create_chat_client(
265
+ backend: Literal[BackendType.XAI],
266
+ model: str | None = None,
267
+ stream: bool = False,
268
+ temperature: float = 0.7,
269
+ context_length_control: ContextLengthControlType = defs.CONTEXT_LENGTH_CONTROL,
270
+ random_endpoint: bool = True,
271
+ endpoint_id: str = "",
272
+ http_client: httpx.Client | None = None,
273
+ **kwargs,
274
+ ) -> XAIChatClient: ...
275
+
276
+
260
277
  @overload
261
278
  def create_chat_client(
262
279
  backend: BackendType,
@@ -496,6 +513,20 @@ def create_async_chat_client(
496
513
  ) -> AsyncStepFunChatClient: ...
497
514
 
498
515
 
516
+ @overload
517
+ def create_async_chat_client(
518
+ backend: Literal[BackendType.XAI],
519
+ model: str | None = None,
520
+ stream: bool = False,
521
+ temperature: float = 0.7,
522
+ context_length_control: ContextLengthControlType = defs.CONTEXT_LENGTH_CONTROL,
523
+ random_endpoint: bool = True,
524
+ endpoint_id: str = "",
525
+ http_client: httpx.AsyncClient | None = None,
526
+ **kwargs,
527
+ ) -> AsyncXAIChatClient: ...
528
+
529
+
499
530
  @overload
500
531
  def create_async_chat_client(
501
532
  backend: BackendType,
@@ -0,0 +1,15 @@
1
+ # @Author: Bi Ying
2
+ # @Date: 2024-07-26 14:48:55
3
+ from ..types.enums import BackendType
4
+ from ..types.defaults import XAI_DEFAULT_MODEL
5
+ from .openai_compatible_client import OpenAICompatibleChatClient, AsyncOpenAICompatibleChatClient
6
+
7
+
8
+ class XAIChatClient(OpenAICompatibleChatClient):
9
+ DEFAULT_MODEL = XAI_DEFAULT_MODEL
10
+ BACKEND_NAME = BackendType.XAI
11
+
12
+
13
+ class AsyncXAIChatClient(AsyncOpenAICompatibleChatClient):
14
+ DEFAULT_MODEL = XAI_DEFAULT_MODEL
15
+ BACKEND_NAME = BackendType.XAI
@@ -35,6 +35,7 @@ class Settings(BaseModel):
35
35
  zhipuai: BackendSettings = Field(default_factory=BackendSettings, description="Zhipuai models settings.")
36
36
  baichuan: BackendSettings = Field(default_factory=BackendSettings, description="Baichuan models settings.")
37
37
  stepfun: BackendSettings = Field(default_factory=BackendSettings, description="StepFun models settings.")
38
+ xai: BackendSettings = Field(default_factory=BackendSettings, description="XAI models settings.")
38
39
 
39
40
  def __init__(self, **data):
40
41
  model_types = {
@@ -724,3 +724,14 @@ STEPFUN_MODELS: Final[Dict[str, Dict[str, Any]]] = {
724
724
  "native_multimodal": True,
725
725
  },
726
726
  }
727
+
728
+
729
+ XAI_DEFAULT_MODEL: Final[str] = "grok-beta"
730
+ XAI_MODELS: Final[Dict[str, Dict[str, Any]]] = {
731
+ "grok-beta": {
732
+ "id": "grok-beta",
733
+ "context_length": 131072,
734
+ "function_call_available": True,
735
+ "response_format_available": True,
736
+ },
737
+ }
vectorvein/types/enums.py CHANGED
@@ -50,6 +50,9 @@ class BackendType(str, Enum):
50
50
  # StepFun
51
51
  StepFun = "stepfun"
52
52
 
53
+ # XAI
54
+ XAI = "xai"
55
+
53
56
  def __repr__(self):
54
57
  """Get a string representation."""
55
58
  return f'"{self.value}"'
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: vectorvein
3
- Version: 0.1.52
3
+ Version: 0.1.53
4
4
  Summary: Default template for PDM package
5
5
  Author-Email: Anderson <andersonby@163.com>
6
6
  License: MIT
@@ -1,8 +1,8 @@
1
- vectorvein-0.1.52.dist-info/METADATA,sha256=7Tl7WKTmbcQa7SG_fgPtxaZJbR8pOGzM5mOi07ivvpo,644
2
- vectorvein-0.1.52.dist-info/WHEEL,sha256=thaaA2w1JzcGC48WYufAs8nrYZjJm8LqNfnXFOFyCC4,90
3
- vectorvein-0.1.52.dist-info/entry_points.txt,sha256=6OYgBcLyFCUgeqLgnvMyOJxPCWzgy7se4rLPKtNonMs,34
1
+ vectorvein-0.1.53.dist-info/METADATA,sha256=AW3bZNyB9M8EgCvlgXGKZVpv81EXjtX-N5kJPOgCGHk,644
2
+ vectorvein-0.1.53.dist-info/WHEEL,sha256=thaaA2w1JzcGC48WYufAs8nrYZjJm8LqNfnXFOFyCC4,90
3
+ vectorvein-0.1.53.dist-info/entry_points.txt,sha256=6OYgBcLyFCUgeqLgnvMyOJxPCWzgy7se4rLPKtNonMs,34
4
4
  vectorvein/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
- vectorvein/chat_clients/__init__.py,sha256=dW169oK1n3v8Z0uD8itghzlCP72rxiaS-XYn6fvI2xM,16788
5
+ vectorvein/chat_clients/__init__.py,sha256=Oev7Lv1DIEWCMD-2Pm7e2cwzX7JFQTnIK-j6o4iUuyQ,17725
6
6
  vectorvein/chat_clients/anthropic_client.py,sha256=i1fMYSkUovd-Lc9B64bWMgzSTUFw4S3fj3AJ_pDokT4,34029
7
7
  vectorvein/chat_clients/baichuan_client.py,sha256=CVMvpgjdrZGv0BWnTOBD-f2ufZ3wq3496wqukumsAr4,526
8
8
  vectorvein/chat_clients/base_client.py,sha256=0Uj0e-JR0a68sRS_WfUMVd91Av7lzJh6-DukjutlaD0,9497
@@ -19,17 +19,18 @@ vectorvein/chat_clients/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hS
19
19
  vectorvein/chat_clients/qwen_client.py,sha256=-ryh-m9PgsO0fc4ulcCmPTy1155J8YUy15uPoJQOHA0,513
20
20
  vectorvein/chat_clients/stepfun_client.py,sha256=zsD2W5ahmR4DD9cqQTXmJr3txrGuvxbRWhFlRdwNijI,519
21
21
  vectorvein/chat_clients/utils.py,sha256=HUPtdn-OSxghJNCF5Q8PsL3Ye-1Nu16O84lntPqKyao,26439
22
+ vectorvein/chat_clients/xai_client.py,sha256=eLFJJrNRJ-ni3DpshODcr3S1EJQLbhVwxyO1E54LaqM,491
22
23
  vectorvein/chat_clients/yi_client.py,sha256=RNf4CRuPJfixrwLZ3-DEc3t25QDe1mvZeb9sku2f8Bc,484
23
24
  vectorvein/chat_clients/zhipuai_client.py,sha256=Ys5DSeLCuedaDXr3PfG1EW2zKXopt-awO2IylWSwY0s,519
24
25
  vectorvein/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
25
26
  vectorvein/server/token_server.py,sha256=36F9PKSNOX8ZtYBXY_l-76GQTpUSmQ2Y8EMy1H7wtdQ,1353
26
- vectorvein/settings/__init__.py,sha256=dyTCLhevXiKVJhOb1tjgZGMH38Indy4dkWVdDX543g0,3771
27
+ vectorvein/settings/__init__.py,sha256=g01y74x0k2JEAqNpRGG0PDs0NTULjOAZV6HRhydPX1c,3874
27
28
  vectorvein/settings/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
28
- vectorvein/types/defaults.py,sha256=orYqYQiQj8lj1wzsQdnyHWC3bSVYhRB14Zkm6qQDYcU,22661
29
- vectorvein/types/enums.py,sha256=x_S0IJiEWijOAEiMNdiGDGEWGtmt7TwMriJVDqrDmTo,1637
29
+ vectorvein/types/defaults.py,sha256=BxnXL_Hz_gM8mYDI6Y62J660ipCanFlAturV9lDj3aQ,22940
30
+ vectorvein/types/enums.py,sha256=7KTJSVtQueImmbr1fSwv3rQVtc0RyMWXJmoE2tDOaso,1667
30
31
  vectorvein/types/exception.py,sha256=gnW4GnJ76jND6UGnodk9xmqkcbeS7Cz2rvncA2HpD5E,69
31
32
  vectorvein/types/llm_parameters.py,sha256=5o-C_yXxxQWZy_e8OWowB2107GTS-Eawx4Mvb1q55Co,5256
32
33
  vectorvein/types/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
33
34
  vectorvein/utilities/media_processing.py,sha256=cnzLrU1OaJvSv87IOnc36FrDXtmGMDStPbxtIJ33YN4,5880
34
35
  vectorvein/utilities/retry.py,sha256=6KFS9R2HdhqM3_9jkjD4F36ZSpEx2YNFGOVlpOsUetM,2208
35
- vectorvein-0.1.52.dist-info/RECORD,,
36
+ vectorvein-0.1.53.dist-info/RECORD,,