pycoze 0.1.279__py3-none-any.whl → 0.1.281__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.
pycoze/api/lib/view.py CHANGED
@@ -5,6 +5,7 @@ from pycoze import utils
5
5
 
6
6
  socket = utils.socket
7
7
 
8
+
8
9
  class ViewCls:
9
10
 
10
11
  def __init__(self, location: list[str], nodeIds: list[str] = []):
@@ -15,7 +16,7 @@ class ViewCls:
15
16
 
16
17
  def __getitem__(self, key):
17
18
  return self.location[key]
18
-
19
+
19
20
  def wait_for_tab_open(self):
20
21
  times = 0
21
22
  while not self.is_tab_open():
@@ -38,7 +39,7 @@ class ViewCls:
38
39
  assert self.is_tab
39
40
  result = socket.post_and_recv_result("is-tab-open", {"location": self.location})
40
41
  return result
41
-
42
+
42
43
  def pin_tab(self):
43
44
  assert self.is_tab
44
45
  self.wait_for_tab_open()
@@ -57,55 +58,63 @@ class WorkflowCls(ViewCls):
57
58
  pass
58
59
 
59
60
  def run(self, wait_for_end=False):
60
- result = socket.post_and_recv_result("workflow-run", {"location": self.location, "wait_for_end": wait_for_end})
61
+ result = socket.post_and_recv_result(
62
+ "workflow-run", {"location": self.location, "wait_for_end": wait_for_end}
63
+ )
61
64
  if not result["ok"]:
62
65
  raise Exception(result["value"])
63
66
  return result["value"] # task_id
64
67
 
65
68
  def stop(self):
66
- result = socket.post_and_recv_result("workflow-stop", {"location": self.location})
69
+ result = socket.post_and_recv_result(
70
+ "workflow-stop", {"location": self.location}
71
+ )
67
72
  if not result["ok"]:
68
73
  raise Exception(result["value"])
69
74
 
70
75
  def get_state(self):
71
- result = socket.post_and_recv_result("workflow-get-state", {"location": self.location})
76
+ result = socket.post_and_recv_result(
77
+ "workflow-get-state", {"location": self.location}
78
+ )
72
79
  if not result["ok"]:
73
80
  raise Exception(result["value"])
74
81
  return result["value"]
75
82
 
76
83
  def get_nodes(self):
77
- result = socket.post_and_recv_result("workflow-get-graph-nodes", {"location": self.location})
84
+ result = socket.post_and_recv_result(
85
+ "workflow-get-graph-nodes", {"location": self.location}
86
+ )
78
87
  if not result["ok"]:
79
88
  raise Exception(result["value"])
80
89
  return result["value"]
81
-
90
+
82
91
  def get_edges(self):
83
- result = socket.post_and_recv_result("workflow-get-graph-edges", {"location": self.location})
92
+ result = socket.post_and_recv_result(
93
+ "workflow-get-graph-edges", {"location": self.location}
94
+ )
84
95
  return result["value"]
85
-
86
- def add_text_node(self, text: str, position='center'):
87
- result = socket.post_and_recv_result("workflow-add-text-node", {
88
- "location": self.location,
89
- "text": text,
90
- "position": position
91
- })
96
+
97
+ def add_text_node(self, text: str, position="center"):
98
+ result = socket.post_and_recv_result(
99
+ "workflow-add-text-node",
100
+ {"location": self.location, "text": text, "position": position},
101
+ )
92
102
  if not result["ok"]:
93
103
  raise Exception(result["value"])
94
104
  time.sleep(0.01)
95
105
  return result["value"] # node
96
106
 
97
- def add_markdown_node(self, text: str, position='center'):
98
- result = socket.post_and_recv_result("workflow-add-markdown-node", {
99
- "location": self.location,
100
- "text": text,
101
- "position": position
102
- })
107
+ def add_markdown_node(self, text: str, position="center"):
108
+ result = socket.post_and_recv_result(
109
+ "workflow-add-markdown-node",
110
+ {"location": self.location, "text": text, "position": position},
111
+ )
103
112
  if not result["ok"]:
104
113
  raise Exception(result["value"])
105
114
  time.sleep(0.01)
106
115
  return result["value"] # node
107
116
 
108
- def add_file_node(self, file_path: str, position='center'):
117
+ def add_file_node(self, file_path: str, position="center"):
109
118
  is_step = False
110
119
  if file_path.lower().endswith(".py"):
111
120
  with open(file_path, "r", encoding="utf-8") as f:
@@ -114,40 +123,36 @@ class WorkflowCls(ViewCls):
114
123
  is_step = True
115
124
  if is_step:
116
125
  return self.add_step_file_node(file_path, position)
117
- result = socket.post_and_recv_result("workflow-add-file-node", {
118
- "location": self.location,
119
- "file_path": file_path,
120
- "position": position
121
- })
126
+ result = socket.post_and_recv_result(
127
+ "workflow-add-file-node",
128
+ {"location": self.location, "file_path": file_path, "position": position},
129
+ )
122
130
  if not result["ok"]:
123
131
  raise Exception(result["value"])
124
132
  time.sleep(0.01)
125
133
  return result["value"] # node
126
134
 
127
- def add_step_file_node(self, file_path: str, position='center'):
128
- result = socket.post_and_recv_result("workflow-add-step-file-node", {
129
- "location": self.location,
130
- "file_path": file_path,
131
- "position": position
132
- })
135
+ def add_step_file_node(self, file_path: str, position="center"):
136
+ result = socket.post_and_recv_result(
137
+ "workflow-add-step-file-node",
138
+ {"location": self.location, "file_path": file_path, "position": position},
139
+ )
133
140
  if not result["ok"]:
134
141
  raise Exception(result["value"])
135
142
  time.sleep(0.01)
136
143
  return result["value"] # node
137
144
 
138
- def add_edge(self, from_node_id: str, from_port_id: str, to_node_id: str, to_port_id: str):
145
+ def add_edge(
146
+ self, from_node_id: str, from_port_id: str, to_node_id: str, to_port_id: str
147
+ ):
139
148
  result = socket.post_and_recv_result(
140
- "workflow-add-edge", {
149
+ "workflow-add-edge",
150
+ {
141
151
  "location": self.location,
142
- "source": {
143
- "cell": from_node_id,
144
- "port": from_port_id
145
- },
146
- "target": {
147
- "cell": to_node_id,
148
- "port": to_port_id
149
- }
150
- })
152
+ "source": {"cell": from_node_id, "port": from_port_id},
153
+ "target": {"cell": to_node_id, "port": to_port_id},
154
+ },
155
+ )
151
156
  if not result["ok"]:
152
157
  raise Exception(result["value"])
153
158
  time.sleep(0.01)
@@ -156,7 +161,9 @@ class WorkflowCls(ViewCls):
156
161
  def get_node_info(self, node: Union[str, object]):
157
162
  if isinstance(node, object):
158
163
  node_id = node["id"]
159
- result = socket.post_and_recv_result("workflow-get-node-info", {"location": self.location, "node_id": node_id})
164
+ result = socket.post_and_recv_result(
165
+ "workflow-get-node-info", {"location": self.location, "node_id": node_id}
166
+ )
160
167
  if not result["ok"]:
161
168
  raise Exception(result["value"])
162
169
  return result["value"]
@@ -164,7 +171,9 @@ class WorkflowCls(ViewCls):
164
171
  def get_node_state(self, node: Union[str, object]):
165
172
  if isinstance(node, object):
166
173
  node_id = node["id"]
167
- result = socket.post_and_recv_result("workflow-get-node-state", {"location": self.location, "node_id": node_id})
174
+ result = socket.post_and_recv_result(
175
+ "workflow-get-node-state", {"location": self.location, "node_id": node_id}
176
+ )
168
177
  if not result["ok"]:
169
178
  raise Exception(result["value"])
170
179
  return result["value"]
@@ -172,28 +181,36 @@ class WorkflowCls(ViewCls):
172
181
  def get_node_log(self, node: Union[str, object]):
173
182
  if isinstance(node, object):
174
183
  node_id = node["id"]
175
- result = socket.post_and_recv_result("workflow-get-node-log", {"location": self.location, "node_id": node_id})
184
+ result = socket.post_and_recv_result(
185
+ "workflow-get-node-log", {"location": self.location, "node_id": node_id}
186
+ )
176
187
  if not result["ok"]:
177
188
  raise Exception(result["value"])
178
189
  return result["value"]
179
190
 
180
- def get_node_input_data(self, node: Union[str, object], port:str):
191
+ def get_node_input_data(self, node: Union[str, object], port: str):
181
192
  if isinstance(node, object):
182
193
  node_id = node["id"]
183
- result = socket.post_and_recv_result("workflow-get-node-input-data", {"location": self.location, "node_id": node_id, "port":port})
194
+ result = socket.post_and_recv_result(
195
+ "workflow-get-node-input-data",
196
+ {"location": self.location, "node_id": node_id, "port": port},
197
+ )
184
198
  if not result["ok"]:
185
199
  raise Exception(result["value"])
186
200
  return result["value"]
187
-
188
- def get_node_output_data(self, node: Union[str, object], port:str):
201
+
202
+ def get_node_output_data(self, node: Union[str, object], port: str):
189
203
  if isinstance(node, object):
190
204
  node_id = node["id"]
191
- result = socket.post_and_recv_result("workflow-get-node-output-data", {"location": self.location, "node_id": node_id, "port":port})
205
+ result = socket.post_and_recv_result(
206
+ "workflow-get-node-output-data",
207
+ {"location": self.location, "node_id": node_id, "port": port},
208
+ )
192
209
  if not result["ok"]:
193
210
  raise Exception(result["value"])
194
211
  return result["value"]
195
-
196
- def parse_node_data(self, data: Union[dict|list]):
212
+
213
+ def parse_node_data(self, data: Union[dict, list]):
197
214
  if isinstance(data, list):
198
215
  return [parse_data(d) for d in data]
199
- return parse_data(data)
216
+ return parse_data(data)
pycoze/bot/agent/agent.py CHANGED
@@ -15,7 +15,7 @@ from .agent_types.const import HumanToolString
15
15
  async def run_agent(agent, inputs: list, tool_compatibility_mode: bool):
16
16
  exist_ids = set()
17
17
  content_list = []
18
- async for event in agent.astream_events(inputs, version="v1"):
18
+ async for event in agent.astream_events(inputs, version="v2"):
19
19
  kind = event["event"]
20
20
  if kind == "on_chain_end":
21
21
  if "data" in event:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pycoze
3
- Version: 0.1.279
3
+ Version: 0.1.281
4
4
  Summary: Package for pycoze only!
5
5
  Home-page: UNKNOWN
6
6
  Author: Yuan Jie Xiong
@@ -8,13 +8,13 @@ pycoze/ai/llm/think.py,sha256=sUgTBdGzcZtL3r-Wx8M3lDuVUmDVz8g3qC0VU8uiKAI,5143
8
8
  pycoze/api/__init__.py,sha256=GGRRRPop0ZxdXe5JRhg2XvHITGIWfNcHA25opJZ0f1w,313
9
9
  pycoze/api/lib/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10
10
  pycoze/api/lib/tab_cls.py,sha256=nPbTfWF_Mmz3tKAmGrVdgK21HE9g1074V59nrteiG8c,2612
11
- pycoze/api/lib/view.py,sha256=sl3qOC-IbfJaUg1-nLtEpm-0sDxyI9UOhhrnITaFsFs,7258
11
+ pycoze/api/lib/view.py,sha256=_PIpTfeuTPPlMDKshMGsqFQYMq7ZiO4Hg5XwHwDoU60,7357
12
12
  pycoze/api/lib/window_cls.py,sha256=Yezy-SR_EwVtUjrgXnHRC69WGgXVaXeJHjaxn09Ophg,1737
13
13
  pycoze/bot/__init__.py,sha256=JxnRoCCqx_LFyVb3pLu0qYCsH8ZLuAaMXAtvVUuCHuE,78
14
14
  pycoze/bot/agent_chat.py,sha256=ARXXsIVCTpmBojz2C4BR69nB0QhM6gkEngL3iq34JPo,4178
15
15
  pycoze/bot/bot.py,sha256=_qmUTZ09FmRLifHrW5stDZWGVK6yuMEMBC3fmeYJnqk,844
16
16
  pycoze/bot/agent/__init__.py,sha256=3wE8_FFQS8j2BY-g9Cr-onV0POEvDRZaw_NCzpqrNus,265
17
- pycoze/bot/agent/agent.py,sha256=rdmc1GD3LVWNDpt2BD4_5N3w5c8dHkxoOlvAWKq3b1E,3653
17
+ pycoze/bot/agent/agent.py,sha256=qkLIRgSMNT1VD_UD0e6kYUuOTOqylQiYSCay6HZ12LA,3653
18
18
  pycoze/bot/agent/assistant.py,sha256=5LIgPIVVzx6uIOWT5S_XDDyPPjPHRBBNpIU3GiOkVHc,1186
19
19
  pycoze/bot/agent/chat.py,sha256=mubOCAHvA6VtyE6N40elI6KrP6A69uB_G6ihE3G_Vi4,860
20
20
  pycoze/bot/agent/agent_types/__init__.py,sha256=zmU2Kmrv5mCdfg-QlPn2H6pWxbGeq8s7YTqLhpzJC6k,179
@@ -35,8 +35,8 @@ pycoze/utils/arg.py,sha256=jop1tBfe5hYkHW1NSpCeaZBEznkgguBscj_7M2dWfrs,503
35
35
  pycoze/utils/env.py,sha256=5pWlXfM1F5ZU9hhv1rHlDEanjEW5wf0nbyez9bNRqqA,559
36
36
  pycoze/utils/socket.py,sha256=bZbFFRH4mfThzRqt55BAAGQ6eICx_ja4x8UGGrUdAm8,2428
37
37
  pycoze/utils/text_or_file.py,sha256=gpxZVWt2DW6YiEg_MnMuwg36VNf3TX383QD_1oZNB0Y,551
38
- pycoze-0.1.279.dist-info/LICENSE,sha256=QStd_Qsd0-kAam_-sOesCIp_uKrGWeoKwt9M49NVkNU,1090
39
- pycoze-0.1.279.dist-info/METADATA,sha256=kCMpc0ItijrWiZigjVP1T_126Zn5d7CrB2DYSQI-sK8,755
40
- pycoze-0.1.279.dist-info/WHEEL,sha256=ewwEueio1C2XeHTvT17n8dZUJgOvyCWCt0WVNLClP9o,92
41
- pycoze-0.1.279.dist-info/top_level.txt,sha256=76dPeDhKvOCleL3ZC5gl1-y4vdS1tT_U1hxWVAn7sFo,7
42
- pycoze-0.1.279.dist-info/RECORD,,
38
+ pycoze-0.1.281.dist-info/LICENSE,sha256=QStd_Qsd0-kAam_-sOesCIp_uKrGWeoKwt9M49NVkNU,1090
39
+ pycoze-0.1.281.dist-info/METADATA,sha256=gRDvFXAP3MK6MxGBidAvlkFmo8cm-xBMMGCeKSyVetY,755
40
+ pycoze-0.1.281.dist-info/WHEEL,sha256=ewwEueio1C2XeHTvT17n8dZUJgOvyCWCt0WVNLClP9o,92
41
+ pycoze-0.1.281.dist-info/top_level.txt,sha256=76dPeDhKvOCleL3ZC5gl1-y4vdS1tT_U1hxWVAn7sFo,7
42
+ pycoze-0.1.281.dist-info/RECORD,,