vectorvein 0.2.29__py3-none-any.whl → 0.2.31__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.
@@ -36,6 +36,7 @@ from anthropic import (
36
36
  )
37
37
  from anthropic._types import NOT_GIVEN
38
38
  from anthropic._exceptions import APIStatusError as AnthropicAPIStatusError
39
+ from anthropic._exceptions import APIConnectionError as AnthropicAPIConnectionError
39
40
  from anthropic.types import (
40
41
  TextBlock,
41
42
  ThinkingBlock,
@@ -53,7 +54,7 @@ from ..types import defaults as defs
53
54
  from .utils import cutoff_messages, get_message_token_counts
54
55
  from .base_client import BaseChatClient, BaseAsyncChatClient
55
56
  from .openai_compatible_client import OpenAICompatibleChatClient, AsyncOpenAICompatibleChatClient
56
- from ..types.exception import APIStatusError
57
+ from ..types.exception import APIStatusError, APIConnectionError
57
58
  from ..types.enums import ContextLengthControlType, BackendType
58
59
  from ..types.llm_parameters import (
59
60
  Usage,
@@ -618,6 +619,8 @@ class AnthropicChatClient(BaseChatClient):
618
619
  )
619
620
  except AnthropicAPIStatusError as e:
620
621
  raise APIStatusError(message=e.message, response=e.response, body=e.body)
622
+ except AnthropicAPIConnectionError as e:
623
+ raise APIConnectionError(message=e.message, request=e.request)
621
624
 
622
625
  def generator():
623
626
  result = {"content": "", "reasoning_content": "", "usage": {}, "tool_calls": []}
@@ -695,6 +698,8 @@ class AnthropicChatClient(BaseChatClient):
695
698
  )
696
699
  except AnthropicAPIStatusError as e:
697
700
  raise APIStatusError(message=e.message, response=e.response, body=e.body)
701
+ except AnthropicAPIConnectionError as e:
702
+ raise APIConnectionError(message=e.message, request=e.request)
698
703
 
699
704
  result = {
700
705
  "content": "",
@@ -1163,6 +1168,8 @@ class AsyncAnthropicChatClient(BaseAsyncChatClient):
1163
1168
  )
1164
1169
  except AnthropicAPIStatusError as e:
1165
1170
  raise APIStatusError(message=e.message, response=e.response, body=e.body)
1171
+ except AnthropicAPIConnectionError as e:
1172
+ raise APIConnectionError(message=e.message, request=e.request)
1166
1173
 
1167
1174
  async def generator():
1168
1175
  result = {"content": "", "reasoning_content": "", "usage": {}, "tool_calls": []}
@@ -1240,6 +1247,8 @@ class AsyncAnthropicChatClient(BaseAsyncChatClient):
1240
1247
  )
1241
1248
  except AnthropicAPIStatusError as e:
1242
1249
  raise APIStatusError(message=e.message, response=e.response, body=e.body)
1250
+ except AnthropicAPIConnectionError as e:
1251
+ raise APIConnectionError(message=e.message, request=e.request)
1243
1252
 
1244
1253
  result = {
1245
1254
  "content": "",
@@ -559,6 +559,7 @@ def format_workflow_messages(message: dict, content: str, backend: BackendType):
559
559
  def transform_from_openai_message(message: ChatCompletionMessageParam, backend: BackendType):
560
560
  role = message.get("role", "user")
561
561
  content = message.get("content", "")
562
+ tool_calls = message.get("tool_calls", [])
562
563
 
563
564
  if backend == BackendType.Anthropic:
564
565
  if role == "tool":
@@ -582,6 +583,16 @@ def transform_from_openai_message(message: ChatCompletionMessageParam, backend:
582
583
  formatted_content.append(format_image_message(item["image_url"]["url"], backend))
583
584
  else:
584
585
  formatted_content.append(item)
586
+ if tool_calls:
587
+ for tool_call in tool_calls:
588
+ formatted_content.append(
589
+ {
590
+ "type": "tool_use",
591
+ "id": tool_call["id"],
592
+ "name": tool_call["function"]["name"],
593
+ "input": json.loads(tool_call["function"]["arguments"]),
594
+ }
595
+ )
585
596
  return {"role": role, "content": formatted_content}
586
597
  else:
587
598
  return {"role": role, "content": content}
@@ -36,7 +36,7 @@ from .defaults import (
36
36
  XAI_MODELS,
37
37
  )
38
38
  from .enums import BackendType, LLMType, ContextLengthControlType
39
- from .exception import APIStatusError
39
+ from .exception import APIStatusError, APIConnectionError
40
40
  from .llm_parameters import (
41
41
  EndpointSetting,
42
42
  ModelSetting,
@@ -109,6 +109,7 @@ __all__ = [
109
109
  "LLMType",
110
110
  "ContextLengthControlType",
111
111
  "APIStatusError",
112
+ "APIConnectionError",
112
113
  "EndpointOptionDict",
113
114
  "EndpointSetting",
114
115
  "ModelSetting",
@@ -1,4 +1,5 @@
1
1
  from openai import APIStatusError
2
+ from openai import APIConnectionError
2
3
 
3
4
 
4
- __all__ = ["APIStatusError"]
5
+ __all__ = ["APIStatusError", "APIConnectionError"]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: vectorvein
3
- Version: 0.2.29
3
+ Version: 0.2.31
4
4
  Summary: VectorVein Python SDK
5
5
  Author-Email: Anderson <andersonby@163.com>
6
6
  License: MIT
@@ -1,13 +1,13 @@
1
- vectorvein-0.2.29.dist-info/METADATA,sha256=x_u1wwPKVV4ZhMXjLN0VmM3uG72meapuWpH1jCbBtsE,4570
2
- vectorvein-0.2.29.dist-info/WHEEL,sha256=thaaA2w1JzcGC48WYufAs8nrYZjJm8LqNfnXFOFyCC4,90
3
- vectorvein-0.2.29.dist-info/entry_points.txt,sha256=6OYgBcLyFCUgeqLgnvMyOJxPCWzgy7se4rLPKtNonMs,34
1
+ vectorvein-0.2.31.dist-info/METADATA,sha256=6bAhtke289AGWRwg2q8KMxxxgs78Mt8o2nfpO7444qk,4570
2
+ vectorvein-0.2.31.dist-info/WHEEL,sha256=thaaA2w1JzcGC48WYufAs8nrYZjJm8LqNfnXFOFyCC4,90
3
+ vectorvein-0.2.31.dist-info/entry_points.txt,sha256=6OYgBcLyFCUgeqLgnvMyOJxPCWzgy7se4rLPKtNonMs,34
4
4
  vectorvein/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
5
  vectorvein/api/__init__.py,sha256=lfY-XA46fgD2iIZTU0VYP8i07AwA03Egj4Qua0vUKrQ,738
6
6
  vectorvein/api/client.py,sha256=xF-leKDQzVyyy9FnIRaz0k4eElYW1XbbzeRLcpnyk90,33047
7
7
  vectorvein/api/exceptions.py,sha256=uS_PAdx0ksC0r3dgfSGWdbLMZm4qdLeWSSqCv1g3_Gc,772
8
8
  vectorvein/api/models.py,sha256=xtPWMsB0yIJI7i-gY4B6MtvXv0ZIXnoeKspmeInH6fU,1449
9
9
  vectorvein/chat_clients/__init__.py,sha256=UIytpIgwo8qkZpIyrHVxLYTyliUOTp4J7C4iHRjbtWE,23850
10
- vectorvein/chat_clients/anthropic_client.py,sha256=PVUP9UddiyFG7MXFXyon_PkQZxOgUc4GrsAmNkSu2co,59915
10
+ vectorvein/chat_clients/anthropic_client.py,sha256=MfROOOCPiuaW0N8DRTbkjHSL9Stv4I0xIMvILF-RARM,60547
11
11
  vectorvein/chat_clients/baichuan_client.py,sha256=CVMvpgjdrZGv0BWnTOBD-f2ufZ3wq3496wqukumsAr4,526
12
12
  vectorvein/chat_clients/base_client.py,sha256=p7s-G4Wh9MSpDKEfG8wuFAeWy5DGvj5Go31hqrpQPhM,38817
13
13
  vectorvein/chat_clients/deepseek_client.py,sha256=3qWu01NlJAP2N-Ff62d5-CZXZitlizE1fzb20LNetig,526
@@ -23,7 +23,7 @@ vectorvein/chat_clients/openai_compatible_client.py,sha256=d6V6T_FvPxEuOhHoQC-NH
23
23
  vectorvein/chat_clients/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
24
24
  vectorvein/chat_clients/qwen_client.py,sha256=-ryh-m9PgsO0fc4ulcCmPTy1155J8YUy15uPoJQOHA0,513
25
25
  vectorvein/chat_clients/stepfun_client.py,sha256=zsD2W5ahmR4DD9cqQTXmJr3txrGuvxbRWhFlRdwNijI,519
26
- vectorvein/chat_clients/utils.py,sha256=hb4fNgd1F3AI46qBqAT4IEQhLw6qkkdPjf9PDIEb9A8,25777
26
+ vectorvein/chat_clients/utils.py,sha256=g7lIzuTrZgm3Tq6skTRu8_xUpml8EfRFFMuFEKQm7Vc,26267
27
27
  vectorvein/chat_clients/xai_client.py,sha256=eLFJJrNRJ-ni3DpshODcr3S1EJQLbhVwxyO1E54LaqM,491
28
28
  vectorvein/chat_clients/yi_client.py,sha256=RNf4CRuPJfixrwLZ3-DEc3t25QDe1mvZeb9sku2f8Bc,484
29
29
  vectorvein/chat_clients/zhipuai_client.py,sha256=Ys5DSeLCuedaDXr3PfG1EW2zKXopt-awO2IylWSwY0s,519
@@ -31,10 +31,10 @@ vectorvein/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
31
31
  vectorvein/server/token_server.py,sha256=36F9PKSNOX8ZtYBXY_l-76GQTpUSmQ2Y8EMy1H7wtdQ,1353
32
32
  vectorvein/settings/__init__.py,sha256=3Kw3hbvqcIQepAR6Q2m2UXbBnwyJTUm8yAz-aHmbUTg,11163
33
33
  vectorvein/settings/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
34
- vectorvein/types/__init__.py,sha256=DJYGhlshgUQgzXPfMfKW5sTpBClZUCLhqmCqF44lVuU,3329
34
+ vectorvein/types/__init__.py,sha256=ypg8c8AwF49FrFBMqmgH_eIBH4LFf0KN4kjqQa7zrvM,3376
35
35
  vectorvein/types/defaults.py,sha256=U8acSg7yBWz5rOuwqRY45XX6lqPkM7Y7RbuurX9cpxg,27335
36
36
  vectorvein/types/enums.py,sha256=LplSVkXLBK-t8TWtJKj_f7ktWTd6CSHWRLb67XKMm54,1716
37
- vectorvein/types/exception.py,sha256=gnW4GnJ76jND6UGnodk9xmqkcbeS7Cz2rvncA2HpD5E,69
37
+ vectorvein/types/exception.py,sha256=KtnqZ-1DstHm95SZAyZdHhkGq1bJ4A9Aw3Zfdu-VIFo,130
38
38
  vectorvein/types/llm_parameters.py,sha256=1-8G6ieUj_Hb_hnJNTj7kt_7R6LkPmA6fcbNuIIiDDs,8070
39
39
  vectorvein/types/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
40
40
  vectorvein/types/settings.py,sha256=82RsherFSCc8s9-v0E7F_FK6avVh_XvC1b7EkNlFHbc,4918
@@ -62,4 +62,4 @@ vectorvein/workflow/nodes/vector_db.py,sha256=t6I17q6iR3yQreiDHpRrksMdWDPIvgqJs0
62
62
  vectorvein/workflow/nodes/video_generation.py,sha256=qmdg-t_idpxq1veukd-jv_ChICMOoInKxprV9Z4Vi2w,4118
63
63
  vectorvein/workflow/nodes/web_crawlers.py,sha256=LsqomfXfqrXfHJDO1cl0Ox48f4St7X_SL12DSbAMSOw,5415
64
64
  vectorvein/workflow/utils/json_to_code.py,sha256=F7dhDy8kGc8ndOeihGLRLGFGlquoxVlb02ENtxnQ0C8,5914
65
- vectorvein-0.2.29.dist-info/RECORD,,
65
+ vectorvein-0.2.31.dist-info/RECORD,,