vectorvein 0.2.25__py3-none-any.whl → 0.2.27__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.
@@ -35,6 +35,7 @@ from anthropic import (
35
35
  AsyncAnthropicBedrock,
36
36
  )
37
37
  from anthropic._types import NOT_GIVEN
38
+ from anthropic._exceptions import APIStatusError as AnthropicAPIStatusError
38
39
  from anthropic.types import (
39
40
  TextBlock,
40
41
  ThinkingBlock,
@@ -52,6 +53,7 @@ from ..types import defaults as defs
52
53
  from .utils import cutoff_messages, get_message_token_counts
53
54
  from .base_client import BaseChatClient, BaseAsyncChatClient
54
55
  from .openai_compatible_client import OpenAICompatibleChatClient, AsyncOpenAICompatibleChatClient
56
+ from ..types.exception import APIStatusError
55
57
  from ..types.enums import ContextLengthControlType, BackendType
56
58
  from ..types.llm_parameters import (
57
59
  Usage,
@@ -601,18 +603,21 @@ class AnthropicChatClient(BaseChatClient):
601
603
  self._acquire_rate_limit(self.endpoint, self.model, messages)
602
604
 
603
605
  if self.stream:
604
- stream_response = raw_client.messages.create(
605
- model=self.model_id,
606
- messages=messages,
607
- system=system_prompt,
608
- stream=True,
609
- temperature=self.temperature,
610
- max_tokens=max_tokens,
611
- tools=tools_params,
612
- tool_choice=tool_choice_param,
613
- top_p=top_p,
614
- thinking=thinking,
615
- )
606
+ try:
607
+ stream_response = raw_client.messages.create(
608
+ model=self.model_id,
609
+ messages=messages,
610
+ system=system_prompt,
611
+ stream=True,
612
+ temperature=self.temperature,
613
+ max_tokens=max_tokens,
614
+ tools=tools_params,
615
+ tool_choice=tool_choice_param,
616
+ top_p=top_p,
617
+ thinking=thinking,
618
+ )
619
+ except AnthropicAPIStatusError as e:
620
+ raise APIStatusError(message=e.message, response=e.response, body=e.body)
616
621
 
617
622
  def generator():
618
623
  result = {"content": "", "reasoning_content": "", "usage": {}, "tool_calls": []}
@@ -675,18 +680,21 @@ class AnthropicChatClient(BaseChatClient):
675
680
 
676
681
  return generator()
677
682
  else:
678
- response = raw_client.messages.create(
679
- model=self.model_id,
680
- messages=messages,
681
- system=system_prompt,
682
- stream=False,
683
- temperature=self.temperature,
684
- max_tokens=max_tokens,
685
- tools=tools_params,
686
- tool_choice=tool_choice_param,
687
- top_p=top_p,
688
- thinking=thinking,
689
- )
683
+ try:
684
+ response = raw_client.messages.create(
685
+ model=self.model_id,
686
+ messages=messages,
687
+ system=system_prompt,
688
+ stream=False,
689
+ temperature=self.temperature,
690
+ max_tokens=max_tokens,
691
+ tools=tools_params,
692
+ tool_choice=tool_choice_param,
693
+ top_p=top_p,
694
+ thinking=thinking,
695
+ )
696
+ except AnthropicAPIStatusError as e:
697
+ raise APIStatusError(message=e.message, response=e.response, body=e.body)
690
698
 
691
699
  result = {
692
700
  "content": "",
@@ -1140,18 +1148,21 @@ class AsyncAnthropicChatClient(BaseAsyncChatClient):
1140
1148
  await self._acquire_rate_limit(self.endpoint, self.model, messages)
1141
1149
 
1142
1150
  if self.stream:
1143
- stream_response = await raw_client.messages.create(
1144
- model=self.model_id,
1145
- messages=messages,
1146
- system=system_prompt,
1147
- stream=True,
1148
- temperature=self.temperature,
1149
- max_tokens=max_tokens,
1150
- tools=tools_params,
1151
- tool_choice=tool_choice_param,
1152
- top_p=top_p,
1153
- thinking=thinking,
1154
- )
1151
+ try:
1152
+ stream_response = await raw_client.messages.create(
1153
+ model=self.model_id,
1154
+ messages=messages,
1155
+ system=system_prompt,
1156
+ stream=True,
1157
+ temperature=self.temperature,
1158
+ max_tokens=max_tokens,
1159
+ tools=tools_params,
1160
+ tool_choice=tool_choice_param,
1161
+ top_p=top_p,
1162
+ thinking=thinking,
1163
+ )
1164
+ except AnthropicAPIStatusError as e:
1165
+ raise APIStatusError(message=e.message, response=e.response, body=e.body)
1155
1166
 
1156
1167
  async def generator():
1157
1168
  result = {"content": "", "reasoning_content": "", "usage": {}, "tool_calls": []}
@@ -1214,18 +1225,21 @@ class AsyncAnthropicChatClient(BaseAsyncChatClient):
1214
1225
 
1215
1226
  return generator()
1216
1227
  else:
1217
- response = await raw_client.messages.create(
1218
- model=self.model_id,
1219
- messages=messages,
1220
- system=system_prompt,
1221
- stream=False,
1222
- temperature=self.temperature,
1223
- max_tokens=max_tokens,
1224
- tools=tools_params,
1225
- tool_choice=tool_choice_param,
1226
- top_p=top_p,
1227
- thinking=thinking,
1228
- )
1228
+ try:
1229
+ response = await raw_client.messages.create(
1230
+ model=self.model_id,
1231
+ messages=messages,
1232
+ system=system_prompt,
1233
+ stream=False,
1234
+ temperature=self.temperature,
1235
+ max_tokens=max_tokens,
1236
+ tools=tools_params,
1237
+ tool_choice=tool_choice_param,
1238
+ top_p=top_p,
1239
+ thinking=thinking,
1240
+ )
1241
+ except AnthropicAPIStatusError as e:
1242
+ raise APIStatusError(message=e.message, response=e.response, body=e.body)
1229
1243
 
1230
1244
  result = {
1231
1245
  "content": "",
@@ -6,17 +6,17 @@ class Edge:
6
6
  self,
7
7
  id: str,
8
8
  source: str,
9
- sourceHandle: str,
9
+ source_handle: str,
10
10
  target: str,
11
- targetHandle: str,
11
+ target_handle: str,
12
12
  animated: bool = True,
13
13
  type: str = "default",
14
14
  ) -> None:
15
15
  self.id: str = id
16
16
  self.source: str = source
17
- self.sourceHandle: str = sourceHandle
17
+ self.source_handle: str = source_handle
18
18
  self.target: str = target
19
- self.targetHandle: str = targetHandle
19
+ self.target_handle: str = target_handle
20
20
  self.animated: bool = animated
21
21
  self.type: str = type
22
22
  self.style: Dict[str, Union[str, int]] = {"stroke": "#28c5e5", "strokeWidth": 3}
@@ -25,9 +25,9 @@ class Edge:
25
25
  return {
26
26
  "id": self.id,
27
27
  "source": self.source,
28
- "sourceHandle": self.sourceHandle,
28
+ "sourceHandle": self.source_handle,
29
29
  "target": self.target,
30
- "targetHandle": self.targetHandle,
30
+ "targetHandle": self.target_handle,
31
31
  "animated": self.animated,
32
32
  "type": self.type,
33
33
  "style": self.style,
@@ -65,6 +65,13 @@ class Workflow:
65
65
  if not target_node_obj.has_input_port(target_port):
66
66
  raise ValueError(f"目标节点 {target_node_id} 不存在输入端口: {target_port}")
67
67
 
68
+ # 检查目标端口是否已有被连接的线
69
+ for edge in self.edges:
70
+ if edge.target == target_node_id and edge.target_handle == target_port:
71
+ raise ValueError(
72
+ f"目标节点 {target_node_id} 的输入端口 {target_port} 已经被连接: {edge.source}({edge.source_handle}) → {edge.target}({edge.target_handle})"
73
+ )
74
+
68
75
  # 创建并添加边
69
76
  edge_id = f"vueflow__edge-{source_node_id}{source_port}-{target_node_id}{target_port}"
70
77
  edge = Edge(edge_id, source_node_id, source_port, target_node_id, target_port)
@@ -112,7 +119,7 @@ class Workflow:
112
119
  for edge in self.edges:
113
120
  source_label = node_id_to_label[edge.source]
114
121
  target_label = node_id_to_label[edge.target]
115
- label = f"{edge.sourceHandle} → {edge.targetHandle}"
122
+ label = f"{edge.source_handle} → {edge.target_handle}"
116
123
  lines.append(f" {source_label} -->|{label}| {target_label}")
117
124
 
118
125
  return "\n".join(lines)
@@ -14,6 +14,7 @@ from .llms import (
14
14
  Moonshot,
15
15
  OpenAI,
16
16
  XAi,
17
+ CustomModel,
17
18
  )
18
19
  from .media_editing import (
19
20
  AudioEditing,
@@ -45,6 +46,7 @@ from .text_processing import (
45
46
  MarkdownToHtml,
46
47
  ListRender,
47
48
  TemplateCompose,
49
+ RegexExtract,
48
50
  )
49
51
  from .tools import CodebaseAnalysis, TextTranslation, TextSearch, ProgrammingFunction, ImageSearch, WorkflowInvoke
50
52
  from .vector_db import AddData, DeleteData, Search
@@ -65,6 +67,7 @@ __all__ = [
65
67
  "CodebaseAnalysis",
66
68
  "CogVideoX",
67
69
  "Conditional",
70
+ "CustomModel",
68
71
  "DallE",
69
72
  "Deepseek",
70
73
  "DeepseekVl",
@@ -109,6 +112,7 @@ __all__ = [
109
112
  "QwenVision",
110
113
  "RandomChoice",
111
114
  "Recraft",
115
+ "RegexExtract",
112
116
  "RunSql",
113
117
  "SmartQuery",
114
118
  "SoundEffects",
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: vectorvein
3
- Version: 0.2.25
3
+ Version: 0.2.27
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.25.dist-info/METADATA,sha256=Q5GwQcPe2_hMU26jkaFftOxDlEkbYEPN-vw6KvImgRQ,4570
2
- vectorvein-0.2.25.dist-info/WHEEL,sha256=thaaA2w1JzcGC48WYufAs8nrYZjJm8LqNfnXFOFyCC4,90
3
- vectorvein-0.2.25.dist-info/entry_points.txt,sha256=6OYgBcLyFCUgeqLgnvMyOJxPCWzgy7se4rLPKtNonMs,34
1
+ vectorvein-0.2.27.dist-info/METADATA,sha256=eRQRtg4_0C11ovd8KFKMW2Z-5eCIllKhPMWyFlx9PE4,4570
2
+ vectorvein-0.2.27.dist-info/WHEEL,sha256=thaaA2w1JzcGC48WYufAs8nrYZjJm8LqNfnXFOFyCC4,90
3
+ vectorvein-0.2.27.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=URufNrSLKk24kaNPwvxjDfRsYcSSbAmPjyZJdSt2U7Q,58978
10
+ vectorvein/chat_clients/anthropic_client.py,sha256=PVUP9UddiyFG7MXFXyon_PkQZxOgUc4GrsAmNkSu2co,59915
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
@@ -41,11 +41,11 @@ vectorvein/types/settings.py,sha256=82RsherFSCc8s9-v0E7F_FK6avVh_XvC1b7EkNlFHbc,
41
41
  vectorvein/utilities/media_processing.py,sha256=7KtbLFzOYIn1e9QTN9G6C76NH8CBlV9kfAgiRKEIeXY,6263
42
42
  vectorvein/utilities/rate_limiter.py,sha256=dwolIUVw2wP83Odqpx0AAaE77de1GzxkYDGH4tM_u_4,10300
43
43
  vectorvein/utilities/retry.py,sha256=6KFS9R2HdhqM3_9jkjD4F36ZSpEx2YNFGOVlpOsUetM,2208
44
- vectorvein/workflow/graph/edge.py,sha256=xLZEJmBjAfVB53cd7CuRcKhgE6QqXv9nz32wJn8cmyk,1064
44
+ vectorvein/workflow/graph/edge.py,sha256=1ckyyjCue_PLm7P1ItUfKOy6AKkemOpZ9m1WJ8UXIHQ,1072
45
45
  vectorvein/workflow/graph/node.py,sha256=A3M_GghrSju1D3xc_HtPdGyr-7XSkplGPKJveOUiIF4,3256
46
46
  vectorvein/workflow/graph/port.py,sha256=Q6HmI2cUi6viJ98ec6-MmMPMRtKS1-OgaudP3LMwVLA,6054
47
- vectorvein/workflow/graph/workflow.py,sha256=XIoCHfJBNLEvdNf1xDur10o4cjAvhuqy2SjRLvRip1M,8200
48
- vectorvein/workflow/nodes/__init__.py,sha256=jd4O27kIJdOtkij1FYZ6aJnJy2OQa7xtL1r-Yv8ylO0,3103
47
+ vectorvein/workflow/graph/workflow.py,sha256=l0rSDZeSd6OtHMwxzhIENfOKS0fJKKB4JUow-dV-LUI,8610
48
+ vectorvein/workflow/nodes/__init__.py,sha256=a1fsitA0mf1UlDOSEz6QjSGjiFsvsQcuDE-p2q9SlhM,3181
49
49
  vectorvein/workflow/nodes/audio_generation.py,sha256=ht2S0vnd0mIAt6FBaSWlADGbb7f_1DAySYrgYnvZT1Q,5726
50
50
  vectorvein/workflow/nodes/control_flows.py,sha256=Zc_uWuroYznLrU-BZCncyzvejC-zFl6EuN_VP8oq5mY,6573
51
51
  vectorvein/workflow/nodes/file_processing.py,sha256=Rsjc8al0z-2KuweO0nIybWvceqxbqOPQyTs0-pgy5m4,3980
@@ -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.25.dist-info/RECORD,,
65
+ vectorvein-0.2.27.dist-info/RECORD,,