vectorvein 0.2.1__tar.gz → 0.2.3__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.2.1 → vectorvein-0.2.3}/PKG-INFO +1 -1
- {vectorvein-0.2.1 → vectorvein-0.2.3}/pyproject.toml +1 -1
- {vectorvein-0.2.1 → vectorvein-0.2.3}/src/vectorvein/api/client.py +96 -42
- {vectorvein-0.2.1 → vectorvein-0.2.3}/README.md +0 -0
- {vectorvein-0.2.1 → vectorvein-0.2.3}/src/vectorvein/__init__.py +0 -0
- {vectorvein-0.2.1 → vectorvein-0.2.3}/src/vectorvein/api/__init__.py +0 -0
- {vectorvein-0.2.1 → vectorvein-0.2.3}/src/vectorvein/api/exceptions.py +0 -0
- {vectorvein-0.2.1 → vectorvein-0.2.3}/src/vectorvein/api/models.py +0 -0
- {vectorvein-0.2.1 → vectorvein-0.2.3}/src/vectorvein/chat_clients/__init__.py +0 -0
- {vectorvein-0.2.1 → vectorvein-0.2.3}/src/vectorvein/chat_clients/anthropic_client.py +0 -0
- {vectorvein-0.2.1 → vectorvein-0.2.3}/src/vectorvein/chat_clients/baichuan_client.py +0 -0
- {vectorvein-0.2.1 → vectorvein-0.2.3}/src/vectorvein/chat_clients/base_client.py +0 -0
- {vectorvein-0.2.1 → vectorvein-0.2.3}/src/vectorvein/chat_clients/deepseek_client.py +0 -0
- {vectorvein-0.2.1 → vectorvein-0.2.3}/src/vectorvein/chat_clients/gemini_client.py +0 -0
- {vectorvein-0.2.1 → vectorvein-0.2.3}/src/vectorvein/chat_clients/groq_client.py +0 -0
- {vectorvein-0.2.1 → vectorvein-0.2.3}/src/vectorvein/chat_clients/local_client.py +0 -0
- {vectorvein-0.2.1 → vectorvein-0.2.3}/src/vectorvein/chat_clients/minimax_client.py +0 -0
- {vectorvein-0.2.1 → vectorvein-0.2.3}/src/vectorvein/chat_clients/mistral_client.py +0 -0
- {vectorvein-0.2.1 → vectorvein-0.2.3}/src/vectorvein/chat_clients/moonshot_client.py +0 -0
- {vectorvein-0.2.1 → vectorvein-0.2.3}/src/vectorvein/chat_clients/openai_client.py +0 -0
- {vectorvein-0.2.1 → vectorvein-0.2.3}/src/vectorvein/chat_clients/openai_compatible_client.py +0 -0
- {vectorvein-0.2.1 → vectorvein-0.2.3}/src/vectorvein/chat_clients/py.typed +0 -0
- {vectorvein-0.2.1 → vectorvein-0.2.3}/src/vectorvein/chat_clients/qwen_client.py +0 -0
- {vectorvein-0.2.1 → vectorvein-0.2.3}/src/vectorvein/chat_clients/stepfun_client.py +0 -0
- {vectorvein-0.2.1 → vectorvein-0.2.3}/src/vectorvein/chat_clients/utils.py +0 -0
- {vectorvein-0.2.1 → vectorvein-0.2.3}/src/vectorvein/chat_clients/xai_client.py +0 -0
- {vectorvein-0.2.1 → vectorvein-0.2.3}/src/vectorvein/chat_clients/yi_client.py +0 -0
- {vectorvein-0.2.1 → vectorvein-0.2.3}/src/vectorvein/chat_clients/zhipuai_client.py +0 -0
- {vectorvein-0.2.1 → vectorvein-0.2.3}/src/vectorvein/py.typed +0 -0
- {vectorvein-0.2.1 → vectorvein-0.2.3}/src/vectorvein/server/token_server.py +0 -0
- {vectorvein-0.2.1 → vectorvein-0.2.3}/src/vectorvein/settings/__init__.py +0 -0
- {vectorvein-0.2.1 → vectorvein-0.2.3}/src/vectorvein/settings/py.typed +0 -0
- {vectorvein-0.2.1 → vectorvein-0.2.3}/src/vectorvein/types/defaults.py +0 -0
- {vectorvein-0.2.1 → vectorvein-0.2.3}/src/vectorvein/types/enums.py +0 -0
- {vectorvein-0.2.1 → vectorvein-0.2.3}/src/vectorvein/types/exception.py +0 -0
- {vectorvein-0.2.1 → vectorvein-0.2.3}/src/vectorvein/types/llm_parameters.py +0 -0
- {vectorvein-0.2.1 → vectorvein-0.2.3}/src/vectorvein/types/py.typed +0 -0
- {vectorvein-0.2.1 → vectorvein-0.2.3}/src/vectorvein/utilities/media_processing.py +0 -0
- {vectorvein-0.2.1 → vectorvein-0.2.3}/src/vectorvein/utilities/rate_limiter.py +0 -0
- {vectorvein-0.2.1 → vectorvein-0.2.3}/src/vectorvein/utilities/retry.py +0 -0
- {vectorvein-0.2.1 → vectorvein-0.2.3}/src/vectorvein/workflow/graph/edge.py +0 -0
- {vectorvein-0.2.1 → vectorvein-0.2.3}/src/vectorvein/workflow/graph/node.py +0 -0
- {vectorvein-0.2.1 → vectorvein-0.2.3}/src/vectorvein/workflow/graph/port.py +0 -0
- {vectorvein-0.2.1 → vectorvein-0.2.3}/src/vectorvein/workflow/graph/workflow.py +0 -0
- {vectorvein-0.2.1 → vectorvein-0.2.3}/src/vectorvein/workflow/nodes/__init__.py +0 -0
- {vectorvein-0.2.1 → vectorvein-0.2.3}/src/vectorvein/workflow/nodes/audio_generation.py +0 -0
- {vectorvein-0.2.1 → vectorvein-0.2.3}/src/vectorvein/workflow/nodes/control_flows.py +0 -0
- {vectorvein-0.2.1 → vectorvein-0.2.3}/src/vectorvein/workflow/nodes/file_processing.py +0 -0
- {vectorvein-0.2.1 → vectorvein-0.2.3}/src/vectorvein/workflow/nodes/image_generation.py +0 -0
- {vectorvein-0.2.1 → vectorvein-0.2.3}/src/vectorvein/workflow/nodes/llms.py +0 -0
- {vectorvein-0.2.1 → vectorvein-0.2.3}/src/vectorvein/workflow/nodes/media_editing.py +0 -0
- {vectorvein-0.2.1 → vectorvein-0.2.3}/src/vectorvein/workflow/nodes/media_processing.py +0 -0
- {vectorvein-0.2.1 → vectorvein-0.2.3}/src/vectorvein/workflow/nodes/output.py +0 -0
- {vectorvein-0.2.1 → vectorvein-0.2.3}/src/vectorvein/workflow/nodes/relational_db.py +0 -0
- {vectorvein-0.2.1 → vectorvein-0.2.3}/src/vectorvein/workflow/nodes/text_processing.py +0 -0
- {vectorvein-0.2.1 → vectorvein-0.2.3}/src/vectorvein/workflow/nodes/tools.py +0 -0
- {vectorvein-0.2.1 → vectorvein-0.2.3}/src/vectorvein/workflow/nodes/triggers.py +0 -0
- {vectorvein-0.2.1 → vectorvein-0.2.3}/src/vectorvein/workflow/nodes/vector_db.py +0 -0
- {vectorvein-0.2.1 → vectorvein-0.2.3}/src/vectorvein/workflow/nodes/video_generation.py +0 -0
- {vectorvein-0.2.1 → vectorvein-0.2.3}/src/vectorvein/workflow/nodes/web_crawlers.py +0 -0
- {vectorvein-0.2.1 → vectorvein-0.2.3}/src/vectorvein/workflow/utils/json_to_code.py +0 -0
@@ -48,12 +48,11 @@ class VectorVeinClient:
|
|
48
48
|
|
49
49
|
self.api_key = api_key
|
50
50
|
self.base_url = base_url or self.BASE_URL
|
51
|
-
self.
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
)
|
51
|
+
self.default_headers = {
|
52
|
+
"VECTORVEIN-API-KEY": api_key,
|
53
|
+
"VECTORVEIN-API-VERSION": self.API_VERSION,
|
54
|
+
}
|
55
|
+
self._client = httpx.Client(timeout=60)
|
57
56
|
|
58
57
|
def __enter__(self):
|
59
58
|
return self
|
@@ -67,6 +66,7 @@ class VectorVeinClient:
|
|
67
66
|
endpoint: str,
|
68
67
|
params: Optional[Dict[str, Any]] = None,
|
69
68
|
json: Optional[Dict[str, Any]] = None,
|
69
|
+
api_key_type: Literal["WORKFLOW", "VAPP"] = "WORKFLOW",
|
70
70
|
**kwargs,
|
71
71
|
) -> Dict[str, Any]:
|
72
72
|
"""发送HTTP请求
|
@@ -87,8 +87,18 @@ class VectorVeinClient:
|
|
87
87
|
APIKeyError: API密钥无效或已过期
|
88
88
|
"""
|
89
89
|
url = f"{self.base_url}/{endpoint}"
|
90
|
+
headers = self.default_headers.copy()
|
91
|
+
if api_key_type == "VAPP":
|
92
|
+
headers["VECTORVEIN-API-KEY-TYPE"] = "VAPP"
|
90
93
|
try:
|
91
|
-
response = self._client.request(
|
94
|
+
response = self._client.request(
|
95
|
+
method=method,
|
96
|
+
url=url,
|
97
|
+
params=params,
|
98
|
+
json=json,
|
99
|
+
headers=headers,
|
100
|
+
**kwargs,
|
101
|
+
)
|
92
102
|
response.raise_for_status()
|
93
103
|
result = response.json()
|
94
104
|
|
@@ -107,6 +117,7 @@ class VectorVeinClient:
|
|
107
117
|
input_fields: List[WorkflowInputField],
|
108
118
|
output_scope: Literal["all", "output_fields_only"] = "output_fields_only",
|
109
119
|
wait_for_completion: Literal[False] = False,
|
120
|
+
api_key_type: Literal["WORKFLOW", "VAPP"] = "WORKFLOW",
|
110
121
|
timeout: int = 30,
|
111
122
|
) -> str: ...
|
112
123
|
|
@@ -117,6 +128,7 @@ class VectorVeinClient:
|
|
117
128
|
input_fields: List[WorkflowInputField],
|
118
129
|
output_scope: Literal["all", "output_fields_only"] = "output_fields_only",
|
119
130
|
wait_for_completion: Literal[True] = True,
|
131
|
+
api_key_type: Literal["WORKFLOW", "VAPP"] = "WORKFLOW",
|
120
132
|
timeout: int = 30,
|
121
133
|
) -> WorkflowRunResult: ...
|
122
134
|
|
@@ -126,6 +138,7 @@ class VectorVeinClient:
|
|
126
138
|
input_fields: List[WorkflowInputField],
|
127
139
|
output_scope: Literal["all", "output_fields_only"] = "output_fields_only",
|
128
140
|
wait_for_completion: bool = False,
|
141
|
+
api_key_type: Literal["WORKFLOW", "VAPP"] = "WORKFLOW",
|
129
142
|
timeout: int = 30,
|
130
143
|
) -> Union[str, WorkflowRunResult]:
|
131
144
|
"""运行工作流
|
@@ -135,6 +148,7 @@ class VectorVeinClient:
|
|
135
148
|
input_fields: 输入字段列表
|
136
149
|
output_scope: 输出范围,可选值:'all' 或 'output_fields_only'
|
137
150
|
wait_for_completion: 是否等待完成
|
151
|
+
api_key_type: 密钥类型,可选值:'WORKFLOW' 或 'VAPP'
|
138
152
|
timeout: 超时时间(秒)
|
139
153
|
|
140
154
|
Returns:
|
@@ -154,7 +168,7 @@ class VectorVeinClient:
|
|
154
168
|
],
|
155
169
|
}
|
156
170
|
|
157
|
-
result = self._request("POST", "workflow/run", json=payload)
|
171
|
+
result = self._request("POST", "workflow/run", json=payload, api_key_type=api_key_type)
|
158
172
|
|
159
173
|
if not wait_for_completion:
|
160
174
|
return result["data"]["rid"]
|
@@ -166,30 +180,43 @@ class VectorVeinClient:
|
|
166
180
|
if time.time() - start_time > timeout:
|
167
181
|
raise TimeoutError(f"Workflow execution timed out after {timeout} seconds")
|
168
182
|
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
)
|
177
|
-
elif status["status"] == 500:
|
178
|
-
raise WorkflowError(f"Workflow execution failed: {status['msg']}")
|
183
|
+
if api_key_type == "WORKFLOW":
|
184
|
+
result = self.check_workflow_status(rid, api_key_type=api_key_type)
|
185
|
+
else:
|
186
|
+
result = self.check_workflow_status(rid, wid=wid, api_key_type=api_key_type)
|
187
|
+
if result.status == 200:
|
188
|
+
return result
|
189
|
+
elif result.status == 500:
|
190
|
+
raise WorkflowError(f"Workflow execution failed: {result.msg}")
|
179
191
|
|
180
192
|
time.sleep(5)
|
181
193
|
|
182
|
-
def check_workflow_status(
|
194
|
+
def check_workflow_status(
|
195
|
+
self, rid: str, wid: Optional[str] = None, api_key_type: Literal["WORKFLOW", "VAPP"] = "WORKFLOW"
|
196
|
+
) -> WorkflowRunResult:
|
183
197
|
"""检查工作流运行状态
|
184
198
|
|
185
199
|
Args:
|
186
200
|
rid: 工作流运行记录ID
|
201
|
+
wid: 工作流ID,非必填
|
202
|
+
api_key_type: 密钥类型,可选值:'WORKFLOW' 或 'VAPP'
|
187
203
|
|
188
204
|
Returns:
|
189
|
-
|
205
|
+
WorkflowRunResult: 工作流运行结果
|
190
206
|
"""
|
191
207
|
payload = {"rid": rid}
|
192
|
-
|
208
|
+
if wid:
|
209
|
+
payload["wid"] = wid
|
210
|
+
response = self._request("POST", "workflow/check-status", json=payload, api_key_type=api_key_type)
|
211
|
+
if response["status"] in [200, 202]:
|
212
|
+
return WorkflowRunResult(
|
213
|
+
rid=rid,
|
214
|
+
status=response["status"],
|
215
|
+
msg=response["msg"],
|
216
|
+
data=[WorkflowOutput(**output) for output in response["data"]],
|
217
|
+
)
|
218
|
+
else:
|
219
|
+
raise WorkflowError(f"Workflow execution failed: {response['msg']}")
|
193
220
|
|
194
221
|
def get_access_keys(
|
195
222
|
self, access_keys: Optional[List[str]] = None, get_type: Literal["selected", "all"] = "selected"
|
@@ -448,12 +475,11 @@ class AsyncVectorVeinClient:
|
|
448
475
|
|
449
476
|
self.api_key = api_key
|
450
477
|
self.base_url = base_url or self.BASE_URL
|
451
|
-
self.
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
)
|
478
|
+
self.default_headers = {
|
479
|
+
"VECTORVEIN-API-KEY": api_key,
|
480
|
+
"VECTORVEIN-API-VERSION": self.API_VERSION,
|
481
|
+
}
|
482
|
+
self._client = httpx.AsyncClient(timeout=60)
|
457
483
|
|
458
484
|
async def __aenter__(self):
|
459
485
|
return self
|
@@ -467,6 +493,7 @@ class AsyncVectorVeinClient:
|
|
467
493
|
endpoint: str,
|
468
494
|
params: Optional[Dict[str, Any]] = None,
|
469
495
|
json: Optional[Dict[str, Any]] = None,
|
496
|
+
api_key_type: Literal["WORKFLOW", "VAPP"] = "WORKFLOW",
|
470
497
|
**kwargs,
|
471
498
|
) -> Dict[str, Any]:
|
472
499
|
"""发送异步HTTP请求
|
@@ -487,8 +514,18 @@ class AsyncVectorVeinClient:
|
|
487
514
|
APIKeyError: API密钥无效或已过期
|
488
515
|
"""
|
489
516
|
url = f"{self.base_url}/{endpoint}"
|
517
|
+
headers = self.default_headers.copy()
|
518
|
+
if api_key_type == "VAPP":
|
519
|
+
headers["VECTORVEIN-API-KEY-TYPE"] = "VAPP"
|
490
520
|
try:
|
491
|
-
response = await self._client.request(
|
521
|
+
response = await self._client.request(
|
522
|
+
method=method,
|
523
|
+
url=url,
|
524
|
+
params=params,
|
525
|
+
json=json,
|
526
|
+
headers=headers,
|
527
|
+
**kwargs,
|
528
|
+
)
|
492
529
|
response.raise_for_status()
|
493
530
|
result = response.json()
|
494
531
|
|
@@ -507,6 +544,7 @@ class AsyncVectorVeinClient:
|
|
507
544
|
input_fields: List[WorkflowInputField],
|
508
545
|
output_scope: Literal["all", "output_fields_only"] = "output_fields_only",
|
509
546
|
wait_for_completion: Literal[False] = False,
|
547
|
+
api_key_type: Literal["WORKFLOW", "VAPP"] = "WORKFLOW",
|
510
548
|
timeout: int = 30,
|
511
549
|
) -> str: ...
|
512
550
|
|
@@ -517,6 +555,7 @@ class AsyncVectorVeinClient:
|
|
517
555
|
input_fields: List[WorkflowInputField],
|
518
556
|
output_scope: Literal["all", "output_fields_only"] = "output_fields_only",
|
519
557
|
wait_for_completion: Literal[True] = True,
|
558
|
+
api_key_type: Literal["WORKFLOW", "VAPP"] = "WORKFLOW",
|
520
559
|
timeout: int = 30,
|
521
560
|
) -> WorkflowRunResult: ...
|
522
561
|
|
@@ -526,6 +565,7 @@ class AsyncVectorVeinClient:
|
|
526
565
|
input_fields: List[WorkflowInputField],
|
527
566
|
output_scope: Literal["all", "output_fields_only"] = "output_fields_only",
|
528
567
|
wait_for_completion: bool = False,
|
568
|
+
api_key_type: Literal["WORKFLOW", "VAPP"] = "WORKFLOW",
|
529
569
|
timeout: int = 30,
|
530
570
|
) -> Union[str, WorkflowRunResult]:
|
531
571
|
"""异步运行工作流
|
@@ -535,6 +575,7 @@ class AsyncVectorVeinClient:
|
|
535
575
|
input_fields: 输入字段列表
|
536
576
|
output_scope: 输出范围,可选值:'all' 或 'output_fields_only'
|
537
577
|
wait_for_completion: 是否等待完成
|
578
|
+
api_key_type: 密钥类型,可选值:'WORKFLOW' 或 'VAPP'
|
538
579
|
timeout: 超时时间(秒)
|
539
580
|
|
540
581
|
Returns:
|
@@ -554,7 +595,7 @@ class AsyncVectorVeinClient:
|
|
554
595
|
],
|
555
596
|
}
|
556
597
|
|
557
|
-
result = await self._request("POST", "workflow/run", json=payload)
|
598
|
+
result = await self._request("POST", "workflow/run", json=payload, api_key_type=api_key_type)
|
558
599
|
|
559
600
|
if not wait_for_completion:
|
560
601
|
return result["data"]["rid"]
|
@@ -566,30 +607,43 @@ class AsyncVectorVeinClient:
|
|
566
607
|
if time.time() - start_time > timeout:
|
567
608
|
raise TimeoutError(f"Workflow execution timed out after {timeout} seconds")
|
568
609
|
|
569
|
-
|
570
|
-
|
571
|
-
|
572
|
-
|
573
|
-
|
574
|
-
|
575
|
-
|
576
|
-
)
|
577
|
-
elif status["status"] == 500:
|
578
|
-
raise WorkflowError(f"Workflow execution failed: {status['msg']}")
|
610
|
+
if api_key_type == "WORKFLOW":
|
611
|
+
result = await self.check_workflow_status(rid, api_key_type=api_key_type)
|
612
|
+
else:
|
613
|
+
result = await self.check_workflow_status(rid, wid=wid, api_key_type=api_key_type)
|
614
|
+
if result.status == 200:
|
615
|
+
return result
|
616
|
+
elif result.status == 500:
|
617
|
+
raise WorkflowError(f"Workflow execution failed: {result.msg}")
|
579
618
|
|
580
619
|
await asyncio.sleep(5)
|
581
620
|
|
582
|
-
async def check_workflow_status(
|
621
|
+
async def check_workflow_status(
|
622
|
+
self, rid: str, wid: Optional[str] = None, api_key_type: Literal["WORKFLOW", "VAPP"] = "WORKFLOW"
|
623
|
+
) -> WorkflowRunResult:
|
583
624
|
"""异步检查工作流运行状态
|
584
625
|
|
585
626
|
Args:
|
586
627
|
rid: 工作流运行记录ID
|
628
|
+
wid: 工作流ID,非必填
|
629
|
+
api_key_type: 密钥类型,可选值:'WORKFLOW' 或 'VAPP'
|
587
630
|
|
588
631
|
Returns:
|
589
|
-
|
632
|
+
WorkflowRunResult: 工作流运行结果
|
590
633
|
"""
|
591
634
|
payload = {"rid": rid}
|
592
|
-
|
635
|
+
if wid:
|
636
|
+
payload["wid"] = wid
|
637
|
+
response = await self._request("POST", "workflow/check-status", json=payload, api_key_type=api_key_type)
|
638
|
+
if response["status"] in [200, 202]:
|
639
|
+
return WorkflowRunResult(
|
640
|
+
rid=rid,
|
641
|
+
status=response["status"],
|
642
|
+
msg=response["msg"],
|
643
|
+
data=[WorkflowOutput(**output) for output in response["data"]],
|
644
|
+
)
|
645
|
+
else:
|
646
|
+
raise WorkflowError(f"Workflow execution failed: {response['msg']}")
|
593
647
|
|
594
648
|
async def get_access_keys(
|
595
649
|
self, access_keys: Optional[List[str]] = None, get_type: Literal["selected", "all"] = "selected"
|
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
|
{vectorvein-0.2.1 → vectorvein-0.2.3}/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
|
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
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|