coze-coding-utils 0.2.3a1__tar.gz → 0.2.3a2__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.
- {coze_coding_utils-0.2.3a1 → coze_coding_utils-0.2.3a2}/PKG-INFO +1 -1
- {coze_coding_utils-0.2.3a1 → coze_coding_utils-0.2.3a2}/pyproject.toml +1 -1
- {coze_coding_utils-0.2.3a1 → coze_coding_utils-0.2.3a2}/src/coze_coding_utils/error/codes.py +2 -0
- {coze_coding_utils-0.2.3a1 → coze_coding_utils-0.2.3a2}/src/coze_coding_utils/error/patterns.py +13 -1
- {coze_coding_utils-0.2.3a1 → coze_coding_utils-0.2.3a2}/src/coze_coding_utils/file/file.py +0 -8
- {coze_coding_utils-0.2.3a1 → coze_coding_utils-0.2.3a2}/src/coze_coding_utils/helper/stream_runner.py +5 -7
- {coze_coding_utils-0.2.3a1 → coze_coding_utils-0.2.3a2}/.gitignore +0 -0
- {coze_coding_utils-0.2.3a1 → coze_coding_utils-0.2.3a2}/LICENSE +0 -0
- {coze_coding_utils-0.2.3a1 → coze_coding_utils-0.2.3a2}/README.md +0 -0
- {coze_coding_utils-0.2.3a1 → coze_coding_utils-0.2.3a2}/src/coze_coding_utils/__init__.py +0 -0
- {coze_coding_utils-0.2.3a1 → coze_coding_utils-0.2.3a2}/src/coze_coding_utils/error/__init__.py +0 -0
- {coze_coding_utils-0.2.3a1 → coze_coding_utils-0.2.3a2}/src/coze_coding_utils/error/classifier.py +0 -0
- {coze_coding_utils-0.2.3a1 → coze_coding_utils-0.2.3a2}/src/coze_coding_utils/error/exceptions.py +0 -0
- {coze_coding_utils-0.2.3a1 → coze_coding_utils-0.2.3a2}/src/coze_coding_utils/error/test_classifier.py +0 -0
- {coze_coding_utils-0.2.3a1 → coze_coding_utils-0.2.3a2}/src/coze_coding_utils/file/__init__.py +0 -0
- {coze_coding_utils-0.2.3a1 → coze_coding_utils-0.2.3a2}/src/coze_coding_utils/helper/__init__.py +0 -0
- {coze_coding_utils-0.2.3a1 → coze_coding_utils-0.2.3a2}/src/coze_coding_utils/helper/agent_helper.py +0 -0
- {coze_coding_utils-0.2.3a1 → coze_coding_utils-0.2.3a2}/src/coze_coding_utils/helper/graph_helper.py +0 -0
- {coze_coding_utils-0.2.3a1 → coze_coding_utils-0.2.3a2}/src/coze_coding_utils/log/__init__.py +0 -0
- {coze_coding_utils-0.2.3a1 → coze_coding_utils-0.2.3a2}/src/coze_coding_utils/log/common.py +0 -0
- {coze_coding_utils-0.2.3a1 → coze_coding_utils-0.2.3a2}/src/coze_coding_utils/log/config.py +0 -0
- {coze_coding_utils-0.2.3a1 → coze_coding_utils-0.2.3a2}/src/coze_coding_utils/log/err_trace.py +0 -0
- {coze_coding_utils-0.2.3a1 → coze_coding_utils-0.2.3a2}/src/coze_coding_utils/log/loop_trace.py +0 -0
- {coze_coding_utils-0.2.3a1 → coze_coding_utils-0.2.3a2}/src/coze_coding_utils/log/node_log.py +0 -0
- {coze_coding_utils-0.2.3a1 → coze_coding_utils-0.2.3a2}/src/coze_coding_utils/log/parser.py +0 -0
- {coze_coding_utils-0.2.3a1 → coze_coding_utils-0.2.3a2}/src/coze_coding_utils/log/write_log.py +0 -0
- {coze_coding_utils-0.2.3a1 → coze_coding_utils-0.2.3a2}/src/coze_coding_utils/messages/__init__.py +0 -0
- {coze_coding_utils-0.2.3a1 → coze_coding_utils-0.2.3a2}/src/coze_coding_utils/messages/client.py +0 -0
- {coze_coding_utils-0.2.3a1 → coze_coding_utils-0.2.3a2}/src/coze_coding_utils/messages/server.py +0 -0
- {coze_coding_utils-0.2.3a1 → coze_coding_utils-0.2.3a2}/src/coze_coding_utils/openai/__init__.py +0 -0
- {coze_coding_utils-0.2.3a1 → coze_coding_utils-0.2.3a2}/src/coze_coding_utils/openai/converter/__init__.py +0 -0
- {coze_coding_utils-0.2.3a1 → coze_coding_utils-0.2.3a2}/src/coze_coding_utils/openai/converter/request_converter.py +0 -0
- {coze_coding_utils-0.2.3a1 → coze_coding_utils-0.2.3a2}/src/coze_coding_utils/openai/converter/response_converter.py +0 -0
- {coze_coding_utils-0.2.3a1 → coze_coding_utils-0.2.3a2}/src/coze_coding_utils/openai/handler.py +0 -0
- {coze_coding_utils-0.2.3a1 → coze_coding_utils-0.2.3a2}/src/coze_coding_utils/openai/types/__init__.py +0 -0
- {coze_coding_utils-0.2.3a1 → coze_coding_utils-0.2.3a2}/src/coze_coding_utils/openai/types/request.py +0 -0
- {coze_coding_utils-0.2.3a1 → coze_coding_utils-0.2.3a2}/src/coze_coding_utils/openai/types/response.py +0 -0
- {coze_coding_utils-0.2.3a1 → coze_coding_utils-0.2.3a2}/src/coze_coding_utils/runtime_ctx/__init__.py +0 -0
- {coze_coding_utils-0.2.3a1 → coze_coding_utils-0.2.3a2}/src/coze_coding_utils/runtime_ctx/context.py +0 -0
{coze_coding_utils-0.2.3a1 → coze_coding_utils-0.2.3a2}/src/coze_coding_utils/error/codes.py
RENAMED
|
@@ -84,6 +84,7 @@ class ErrorCode(IntEnum):
|
|
|
84
84
|
API_LLM_CONTENT_FILTER = 301007 # 内容过滤
|
|
85
85
|
API_LLM_IMAGE_FORMAT = 301008 # 图片格式不支持
|
|
86
86
|
API_LLM_VIDEO_FORMAT = 301009 # 视频格式不支持
|
|
87
|
+
API_PROJECT_NOT_FOUND = 301010 # 项目不存在
|
|
87
88
|
|
|
88
89
|
# 302xxx - 图片生成API错误
|
|
89
90
|
API_IMAGE_GEN_FAILED = 302001 # 图片生成失败
|
|
@@ -136,6 +137,7 @@ class ErrorCode(IntEnum):
|
|
|
136
137
|
INTEGRATION_FEISHU_AUTH_FAILED = 501001 # 飞书认证失败
|
|
137
138
|
INTEGRATION_FEISHU_API_FAILED = 501002 # 飞书API调用失败
|
|
138
139
|
INTEGRATION_FEISHU_DOC_FAILED = 501003 # 飞书文档操作失败
|
|
140
|
+
INTEGRATION_FEISHU_TABLE_FAILED = 501004 # 飞书表格调用失败
|
|
139
141
|
|
|
140
142
|
# 502xxx - 微信集成错误
|
|
141
143
|
INTEGRATION_WECHAT_AUTH_FAILED = 502001 # 微信认证失败
|
{coze_coding_utils-0.2.3a1 → coze_coding_utils-0.2.3a2}/src/coze_coding_utils/error/patterns.py
RENAMED
|
@@ -112,6 +112,14 @@ ERROR_PATTERNS: List[ErrorPattern] = [
|
|
|
112
112
|
(['headobject operation', 'not found'],
|
|
113
113
|
ErrorCode.RESOURCE_S3_DOWNLOAD_FAILED, "S3对象不存在"),
|
|
114
114
|
|
|
115
|
+
# ==================== 权益类错误 ====================
|
|
116
|
+
(['因触发限流调用内置集成失败',"限流"],
|
|
117
|
+
ErrorCode.API_LLM_RATE_LIMIT, "限流"),
|
|
118
|
+
|
|
119
|
+
(['project not found'],
|
|
120
|
+
ErrorCode.API_PROJECT_NOT_FOUND, "项目不存在"),
|
|
121
|
+
|
|
122
|
+
|
|
115
123
|
# ==================== OCR/文档处理错误 ====================
|
|
116
124
|
(['ocr识别失败', '无法从响应中提取有效的json'],
|
|
117
125
|
ErrorCode.RESOURCE_FILE_FORMAT_ERROR, "OCR识别失败"),
|
|
@@ -261,7 +269,7 @@ ERROR_PATTERNS: List[ErrorPattern] = [
|
|
|
261
269
|
ErrorCode.CONFIG_API_KEY_MISSING, "AWS凭证缺失"),
|
|
262
270
|
(['生成pdf报告失败', 'stylesheet'],
|
|
263
271
|
ErrorCode.RESOURCE_FILE_FORMAT_ERROR, "PDF样式错误"),
|
|
264
|
-
(['从数据库查询'
|
|
272
|
+
(['从数据库查询'],
|
|
265
273
|
ErrorCode.INTEGRATION_DB_QUERY, "数据库查询失败"),
|
|
266
274
|
(['excel文件解析', '表格结构检测失败'],
|
|
267
275
|
ErrorCode.RESOURCE_FILE_FORMAT_ERROR, "Excel解析失败"),
|
|
@@ -293,6 +301,8 @@ ERROR_PATTERNS: List[ErrorPattern] = [
|
|
|
293
301
|
ErrorCode.INTEGRATION_DB_CONNECTION, "数据库连接已关闭"),
|
|
294
302
|
(['psycopg2', 'postgresql'],
|
|
295
303
|
ErrorCode.INTEGRATION_DB_QUERY, "数据库错误"),
|
|
304
|
+
(['数据库读取失败'],
|
|
305
|
+
ErrorCode.INTEGRATION_DB_CONNECTION, "数据库连接失败"),
|
|
296
306
|
|
|
297
307
|
# ==================== 网络相关错误 ====================
|
|
298
308
|
(['broken pipe', 'errno 32'],
|
|
@@ -365,6 +375,8 @@ ERROR_PATTERNS: List[ErrorPattern] = [
|
|
|
365
375
|
ErrorCode.API_AUDIO_GEN_FAILED, "腾讯云TTS生成失败"),
|
|
366
376
|
|
|
367
377
|
# ==================== 飞书相关错误 ====================
|
|
378
|
+
(['FeishuBitable API error'],
|
|
379
|
+
ErrorCode.INTEGRATION_FEISHU_TABLE_FAILED, "飞书Bitable API错误"),
|
|
368
380
|
(['获取草稿列表失败'],
|
|
369
381
|
ErrorCode.INTEGRATION_FEISHU_API_FAILED, "飞书获取草稿列表失败"),
|
|
370
382
|
(['飞书api错误'],
|
|
@@ -92,14 +92,6 @@ def infer_file_category(path_or_url: str) -> tuple[str, str]:
|
|
|
92
92
|
class FileOps:
|
|
93
93
|
DOWNLOAD_DIR = "/tmp"
|
|
94
94
|
|
|
95
|
-
@staticmethod
|
|
96
|
-
def read_content(file_obj:File, max_length=10000) -> str:
|
|
97
|
-
return ""
|
|
98
|
-
|
|
99
|
-
@staticmethod
|
|
100
|
-
def get_local_path(file_obj:File) -> str:
|
|
101
|
-
return file_obj.url
|
|
102
|
-
|
|
103
95
|
@staticmethod
|
|
104
96
|
def _get_bytes_stream(file_obj:File) -> tuple[bytes, str]:
|
|
105
97
|
"""
|
|
@@ -15,7 +15,7 @@ from coze_coding_utils.helper.agent_helper import (
|
|
|
15
15
|
)
|
|
16
16
|
from coze_coding_utils.messages.server import (
|
|
17
17
|
MESSAGE_END_CODE_CANCELED,
|
|
18
|
-
create_message_end_dict,
|
|
18
|
+
create_message_end_dict, create_message_error_dict,
|
|
19
19
|
)
|
|
20
20
|
from coze_coding_utils.error import classify_error
|
|
21
21
|
|
|
@@ -84,13 +84,12 @@ class AgentStreamRunner(BaseStreamRunner):
|
|
|
84
84
|
raise
|
|
85
85
|
except Exception as ex:
|
|
86
86
|
err = classify_error(ex, {"node_name": "stream"})
|
|
87
|
-
end_msg =
|
|
87
|
+
end_msg = create_message_error_dict(
|
|
88
88
|
code=str(err.code),
|
|
89
89
|
message=err.message,
|
|
90
90
|
session_id=client_msg.session_id,
|
|
91
91
|
query_msg_id=client_msg.local_msg_id,
|
|
92
92
|
log_id=ctx.logid,
|
|
93
|
-
time_cost_ms=int((time.time() - t0) * 1000),
|
|
94
93
|
reply_id="",
|
|
95
94
|
sequence_id=1,
|
|
96
95
|
)
|
|
@@ -161,13 +160,12 @@ class AgentStreamRunner(BaseStreamRunner):
|
|
|
161
160
|
logger.info(f"Producer exception after cancel for run_id: {ctx.run_id}, ignoring: {ex}")
|
|
162
161
|
return
|
|
163
162
|
err = classify_error(ex, {"node_name": "astream"})
|
|
164
|
-
end_msg =
|
|
163
|
+
end_msg = create_message_error_dict(
|
|
165
164
|
code=str(err.code),
|
|
166
165
|
message=err.message,
|
|
167
166
|
session_id=client_msg.session_id,
|
|
168
167
|
query_msg_id=client_msg.local_msg_id,
|
|
169
168
|
log_id=ctx.logid,
|
|
170
|
-
time_cost_ms=int((time.time() - start_time) * 1000),
|
|
171
169
|
reply_id="",
|
|
172
170
|
sequence_id=last_seq + 1,
|
|
173
171
|
)
|
|
@@ -305,7 +303,7 @@ class WorkflowStreamRunner(BaseStreamRunner):
|
|
|
305
303
|
except Exception as ex:
|
|
306
304
|
err = classify_error(ex, {"node_name": "workflow_stream"})
|
|
307
305
|
seq += 1
|
|
308
|
-
yield (seq, self._build_event(WorkflowEventType.ERROR, ctx, code=str(err.code),
|
|
306
|
+
yield (seq, self._build_event(WorkflowEventType.ERROR, ctx, code=str(err.code), error_msg=err.message))
|
|
309
307
|
|
|
310
308
|
async def astream(self, payload: Dict[str, Any], graph: CompiledStateGraph, run_config: RunnableConfig, ctx: Context) -> AsyncIterable[Any]:
|
|
311
309
|
run_config["recursion_limit"] = 100
|
|
@@ -415,7 +413,7 @@ class WorkflowStreamRunner(BaseStreamRunner):
|
|
|
415
413
|
return
|
|
416
414
|
err = classify_error(ex, {"node_name": "workflow_astream"})
|
|
417
415
|
seq[0] += 1
|
|
418
|
-
loop.call_soon_threadsafe(q.put_nowait, (seq[0], self._build_event(WorkflowEventType.ERROR, ctx, code=str(err.code),
|
|
416
|
+
loop.call_soon_threadsafe(q.put_nowait, (seq[0], self._build_event(WorkflowEventType.ERROR, ctx, code=str(err.code), error_msg=err.message)))
|
|
419
417
|
finally:
|
|
420
418
|
loop.call_soon_threadsafe(q.put_nowait, None)
|
|
421
419
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{coze_coding_utils-0.2.3a1 → coze_coding_utils-0.2.3a2}/src/coze_coding_utils/error/__init__.py
RENAMED
|
File without changes
|
{coze_coding_utils-0.2.3a1 → coze_coding_utils-0.2.3a2}/src/coze_coding_utils/error/classifier.py
RENAMED
|
File without changes
|
{coze_coding_utils-0.2.3a1 → coze_coding_utils-0.2.3a2}/src/coze_coding_utils/error/exceptions.py
RENAMED
|
File without changes
|
|
File without changes
|
{coze_coding_utils-0.2.3a1 → coze_coding_utils-0.2.3a2}/src/coze_coding_utils/file/__init__.py
RENAMED
|
File without changes
|
{coze_coding_utils-0.2.3a1 → coze_coding_utils-0.2.3a2}/src/coze_coding_utils/helper/__init__.py
RENAMED
|
File without changes
|
{coze_coding_utils-0.2.3a1 → coze_coding_utils-0.2.3a2}/src/coze_coding_utils/helper/agent_helper.py
RENAMED
|
File without changes
|
{coze_coding_utils-0.2.3a1 → coze_coding_utils-0.2.3a2}/src/coze_coding_utils/helper/graph_helper.py
RENAMED
|
File without changes
|
{coze_coding_utils-0.2.3a1 → coze_coding_utils-0.2.3a2}/src/coze_coding_utils/log/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{coze_coding_utils-0.2.3a1 → coze_coding_utils-0.2.3a2}/src/coze_coding_utils/log/err_trace.py
RENAMED
|
File without changes
|
{coze_coding_utils-0.2.3a1 → coze_coding_utils-0.2.3a2}/src/coze_coding_utils/log/loop_trace.py
RENAMED
|
File without changes
|
{coze_coding_utils-0.2.3a1 → coze_coding_utils-0.2.3a2}/src/coze_coding_utils/log/node_log.py
RENAMED
|
File without changes
|
|
File without changes
|
{coze_coding_utils-0.2.3a1 → coze_coding_utils-0.2.3a2}/src/coze_coding_utils/log/write_log.py
RENAMED
|
File without changes
|
{coze_coding_utils-0.2.3a1 → coze_coding_utils-0.2.3a2}/src/coze_coding_utils/messages/__init__.py
RENAMED
|
File without changes
|
{coze_coding_utils-0.2.3a1 → coze_coding_utils-0.2.3a2}/src/coze_coding_utils/messages/client.py
RENAMED
|
File without changes
|
{coze_coding_utils-0.2.3a1 → coze_coding_utils-0.2.3a2}/src/coze_coding_utils/messages/server.py
RENAMED
|
File without changes
|
{coze_coding_utils-0.2.3a1 → coze_coding_utils-0.2.3a2}/src/coze_coding_utils/openai/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{coze_coding_utils-0.2.3a1 → coze_coding_utils-0.2.3a2}/src/coze_coding_utils/openai/handler.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{coze_coding_utils-0.2.3a1 → coze_coding_utils-0.2.3a2}/src/coze_coding_utils/runtime_ctx/context.py
RENAMED
|
File without changes
|