agent-builder-gateway-sdk 0.2.0__py3-none-any.whl → 0.3.0__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.
Potentially problematic release.
This version of agent-builder-gateway-sdk might be problematic. Click here for more details.
- {agent_builder_gateway_sdk-0.2.0.dist-info → agent_builder_gateway_sdk-0.3.0.dist-info}/METADATA +1 -1
- {agent_builder_gateway_sdk-0.2.0.dist-info → agent_builder_gateway_sdk-0.3.0.dist-info}/RECORD +5 -5
- gateway_sdk/models.py +104 -5
- {agent_builder_gateway_sdk-0.2.0.dist-info → agent_builder_gateway_sdk-0.3.0.dist-info}/WHEEL +0 -0
- {agent_builder_gateway_sdk-0.2.0.dist-info → agent_builder_gateway_sdk-0.3.0.dist-info}/licenses/LICENSE +0 -0
{agent_builder_gateway_sdk-0.2.0.dist-info → agent_builder_gateway_sdk-0.3.0.dist-info}/RECORD
RENAMED
|
@@ -2,9 +2,9 @@ gateway_sdk/__init__.py,sha256=lgBWm1gkpX8nGx-weoJbpQeHRYygJu5XBhB-ienHq5I,655
|
|
|
2
2
|
gateway_sdk/auth.py,sha256=Nx0p9FYZHBoQeN8SO2nn7MKH2y02v3UR3M8bYqhQG0w,1165
|
|
3
3
|
gateway_sdk/client.py,sha256=GZh2SyQ_598ex1LebSy6ajN9F3APckn7O1u0TrpmpsU,7708
|
|
4
4
|
gateway_sdk/exceptions.py,sha256=fIrhKC8vIaocXvyK56OEKPGHn8drvGh6nElnyR0Z71A,1897
|
|
5
|
-
gateway_sdk/models.py,sha256=
|
|
5
|
+
gateway_sdk/models.py,sha256=ge96k0Qcii7ESEwJQoO5fZwUZBcVbe2Ccgna3kPOAB8,6072
|
|
6
6
|
gateway_sdk/streaming.py,sha256=nwRWxKP5bU8uIMIv_82DyFws9djnEKdAxW6S4L9KtPI,1092
|
|
7
|
-
agent_builder_gateway_sdk-0.
|
|
8
|
-
agent_builder_gateway_sdk-0.
|
|
9
|
-
agent_builder_gateway_sdk-0.
|
|
10
|
-
agent_builder_gateway_sdk-0.
|
|
7
|
+
agent_builder_gateway_sdk-0.3.0.dist-info/METADATA,sha256=Vgp8EOkRYF_Z3ZAtbN7U6fvVNzuXhvx7XI3Hy12l96w,5966
|
|
8
|
+
agent_builder_gateway_sdk-0.3.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
9
|
+
agent_builder_gateway_sdk-0.3.0.dist-info/licenses/LICENSE,sha256=C3JXUJe4vPtoVe1lp7O4WeGtH71JWYrRaCufEoJ84K0,1076
|
|
10
|
+
agent_builder_gateway_sdk-0.3.0.dist-info/RECORD,,
|
gateway_sdk/models.py
CHANGED
|
@@ -66,13 +66,112 @@ class PrefabResult:
|
|
|
66
66
|
return default
|
|
67
67
|
|
|
68
68
|
def get_result(self) -> Any:
|
|
69
|
-
"""
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
69
|
+
"""
|
|
70
|
+
获取完整的 output 字典(保持向后兼容)
|
|
71
|
+
|
|
72
|
+
Returns:
|
|
73
|
+
完整的 output 字典,包含 status, output, files 等
|
|
74
|
+
"""
|
|
75
|
+
return self.output
|
|
76
|
+
|
|
77
|
+
def get_function_result(self) -> Dict[str, Any]:
|
|
78
|
+
"""
|
|
79
|
+
获取预制件函数的返回值(对应 manifest.returns)
|
|
80
|
+
|
|
81
|
+
这是响应的嵌套结构:
|
|
82
|
+
- result.output 是 Gateway 的响应
|
|
83
|
+
- result.output['output'] 是预制件函数的实际返回值
|
|
84
|
+
|
|
85
|
+
Returns:
|
|
86
|
+
预制件函数的返回值字典
|
|
87
|
+
|
|
88
|
+
Example:
|
|
89
|
+
>>> result = client.run(...)
|
|
90
|
+
>>> function_result = result.get_function_result()
|
|
91
|
+
>>> if function_result.get('success'):
|
|
92
|
+
... print(function_result.get('message'))
|
|
93
|
+
"""
|
|
94
|
+
if self.output and isinstance(self.output, dict):
|
|
95
|
+
return self.output.get('output', {})
|
|
96
|
+
return {}
|
|
97
|
+
|
|
98
|
+
def get_business_success(self) -> bool:
|
|
99
|
+
"""
|
|
100
|
+
判断业务是否成功(检查函数返回值中的 success 字段)
|
|
101
|
+
|
|
102
|
+
注意:
|
|
103
|
+
- result.is_success() 表示 SDK 调用成功
|
|
104
|
+
- result.get_business_success() 表示业务逻辑成功
|
|
105
|
+
|
|
106
|
+
Returns:
|
|
107
|
+
业务是否成功
|
|
108
|
+
|
|
109
|
+
Example:
|
|
110
|
+
>>> result = client.run(...)
|
|
111
|
+
>>> if result.is_success() and result.get_business_success():
|
|
112
|
+
... print("调用成功且业务成功")
|
|
113
|
+
"""
|
|
114
|
+
function_result = self.get_function_result()
|
|
115
|
+
return function_result.get('success', False)
|
|
116
|
+
|
|
117
|
+
def get_business_message(self) -> str:
|
|
118
|
+
"""
|
|
119
|
+
获取业务消息
|
|
120
|
+
|
|
121
|
+
Returns:
|
|
122
|
+
业务消息字符串,如果没有消息则返回空字符串
|
|
123
|
+
|
|
124
|
+
Example:
|
|
125
|
+
>>> result = client.run(...)
|
|
126
|
+
>>> print(f"消息: {result.get_business_message()}")
|
|
127
|
+
"""
|
|
128
|
+
function_result = self.get_function_result()
|
|
129
|
+
return function_result.get('message', '')
|
|
130
|
+
|
|
131
|
+
def get_business_error(self) -> Optional[str]:
|
|
132
|
+
"""
|
|
133
|
+
获取业务错误信息
|
|
134
|
+
|
|
135
|
+
Returns:
|
|
136
|
+
错误信息字符串,如果没有错误则返回 None
|
|
137
|
+
|
|
138
|
+
Example:
|
|
139
|
+
>>> result = client.run(...)
|
|
140
|
+
>>> if not result.get_business_success():
|
|
141
|
+
... print(f"错误: {result.get_business_error()}")
|
|
142
|
+
"""
|
|
143
|
+
function_result = self.get_function_result()
|
|
144
|
+
return function_result.get('error')
|
|
145
|
+
|
|
146
|
+
def get_business_error_code(self) -> Optional[str]:
|
|
147
|
+
"""
|
|
148
|
+
获取业务错误代码
|
|
149
|
+
|
|
150
|
+
Returns:
|
|
151
|
+
错误代码字符串,如果没有错误码则返回 None
|
|
152
|
+
|
|
153
|
+
Example:
|
|
154
|
+
>>> result = client.run(...)
|
|
155
|
+
>>> if not result.get_business_success():
|
|
156
|
+
... print(f"错误码: {result.get_business_error_code()}")
|
|
157
|
+
"""
|
|
158
|
+
function_result = self.get_function_result()
|
|
159
|
+
return function_result.get('error_code')
|
|
73
160
|
|
|
74
161
|
def get_files(self) -> Dict[str, List[str]]:
|
|
75
|
-
"""
|
|
162
|
+
"""
|
|
163
|
+
获取输出文件(S3 URL 列表)
|
|
164
|
+
|
|
165
|
+
Returns:
|
|
166
|
+
文件字典,key 对应 manifest.files 中定义的 key
|
|
167
|
+
|
|
168
|
+
Example:
|
|
169
|
+
>>> result = client.run(...)
|
|
170
|
+
>>> output_files = result.get_files()
|
|
171
|
+
>>> # 获取特定 key 的输出文件
|
|
172
|
+
>>> if 'output' in output_files:
|
|
173
|
+
... s3_url = output_files['output'][0]
|
|
174
|
+
"""
|
|
76
175
|
if self.output:
|
|
77
176
|
return self.output.get("files", {})
|
|
78
177
|
return {}
|
{agent_builder_gateway_sdk-0.2.0.dist-info → agent_builder_gateway_sdk-0.3.0.dist-info}/WHEEL
RENAMED
|
File without changes
|
|
File without changes
|