agently 4.0.5.4__tar.gz → 4.0.5.5__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.
- {agently-4.0.5.4 → agently-4.0.5.5}/PKG-INFO +1 -1
- {agently-4.0.5.4 → agently-4.0.5.5}/agently/builtins/plugins/ModelRequester/OpenAICompatible.py +50 -17
- {agently-4.0.5.4 → agently-4.0.5.5}/pyproject.toml +1 -1
- {agently-4.0.5.4 → agently-4.0.5.5}/LICENSE +0 -0
- {agently-4.0.5.4 → agently-4.0.5.5}/README.md +0 -0
- {agently-4.0.5.4 → agently-4.0.5.5}/agently/__init__.py +0 -0
- {agently-4.0.5.4 → agently-4.0.5.5}/agently/_default_init.py +0 -0
- {agently-4.0.5.4 → agently-4.0.5.5}/agently/_default_settings.yaml +0 -0
- {agently-4.0.5.4 → agently-4.0.5.5}/agently/base.py +0 -0
- {agently-4.0.5.4 → agently-4.0.5.5}/agently/builtins/agent_extensions/AutoFuncExtension.py +0 -0
- {agently-4.0.5.4 → agently-4.0.5.5}/agently/builtins/agent_extensions/ChatSessionExtension.py +0 -0
- {agently-4.0.5.4 → agently-4.0.5.5}/agently/builtins/agent_extensions/ConfigurePromptExtension.py +0 -0
- {agently-4.0.5.4 → agently-4.0.5.5}/agently/builtins/agent_extensions/KeyWaiterExtension.py +0 -0
- {agently-4.0.5.4 → agently-4.0.5.5}/agently/builtins/agent_extensions/ToolExtension.py +0 -0
- {agently-4.0.5.4 → agently-4.0.5.5}/agently/builtins/agent_extensions/__init__.py +0 -0
- {agently-4.0.5.4 → agently-4.0.5.5}/agently/builtins/hookers/ConsoleHooker.py +0 -0
- {agently-4.0.5.4 → agently-4.0.5.5}/agently/builtins/hookers/PureLoggerHooker.py +0 -0
- {agently-4.0.5.4 → agently-4.0.5.5}/agently/builtins/hookers/SystemMessageHooker.py +0 -0
- {agently-4.0.5.4 → agently-4.0.5.5}/agently/builtins/plugins/PromptGenerator/AgentlyPromptGenerator.py +0 -0
- {agently-4.0.5.4 → agently-4.0.5.5}/agently/builtins/plugins/ResponseParser/AgentlyResponseParser.py +0 -0
- {agently-4.0.5.4 → agently-4.0.5.5}/agently/builtins/plugins/ToolManager/AgentlyToolManager.py +0 -0
- {agently-4.0.5.4 → agently-4.0.5.5}/agently/builtins/plugins/__init__.py +0 -0
- {agently-4.0.5.4 → agently-4.0.5.5}/agently/builtins/tools/Browse.py +0 -0
- {agently-4.0.5.4 → agently-4.0.5.5}/agently/builtins/tools/Search.py +0 -0
- {agently-4.0.5.4 → agently-4.0.5.5}/agently/builtins/tools/__init__.py +0 -0
- {agently-4.0.5.4 → agently-4.0.5.5}/agently/core/Agent.py +0 -0
- {agently-4.0.5.4 → agently-4.0.5.5}/agently/core/EventCenter.py +0 -0
- {agently-4.0.5.4 → agently-4.0.5.5}/agently/core/ExtensionHandlers.py +0 -0
- {agently-4.0.5.4 → agently-4.0.5.5}/agently/core/ModelRequest.py +0 -0
- {agently-4.0.5.4 → agently-4.0.5.5}/agently/core/PluginManager.py +0 -0
- {agently-4.0.5.4 → agently-4.0.5.5}/agently/core/Prompt.py +0 -0
- {agently-4.0.5.4 → agently-4.0.5.5}/agently/core/Tool.py +0 -0
- {agently-4.0.5.4 → agently-4.0.5.5}/agently/core/TriggerFlow/BluePrint.py +0 -0
- {agently-4.0.5.4 → agently-4.0.5.5}/agently/core/TriggerFlow/Chunk.py +0 -0
- {agently-4.0.5.4 → agently-4.0.5.5}/agently/core/TriggerFlow/Execution.py +0 -0
- {agently-4.0.5.4 → agently-4.0.5.5}/agently/core/TriggerFlow/Process.py +0 -0
- {agently-4.0.5.4 → agently-4.0.5.5}/agently/core/TriggerFlow/TriggerFlow.py +0 -0
- {agently-4.0.5.4 → agently-4.0.5.5}/agently/core/TriggerFlow/__init__.py +0 -0
- {agently-4.0.5.4 → agently-4.0.5.5}/agently/core/TriggerFlow/process/BaseProcess.py +0 -0
- {agently-4.0.5.4 → agently-4.0.5.5}/agently/core/TriggerFlow/process/ForEachProcess.py +0 -0
- {agently-4.0.5.4 → agently-4.0.5.5}/agently/core/TriggerFlow/process/MatchCaseProcess.py +0 -0
- {agently-4.0.5.4 → agently-4.0.5.5}/agently/core/TriggerFlow/process/__init__.py +0 -0
- {agently-4.0.5.4 → agently-4.0.5.5}/agently/core/__init__.py +0 -0
- {agently-4.0.5.4 → agently-4.0.5.5}/agently/types/__init__.py +0 -0
- {agently-4.0.5.4 → agently-4.0.5.5}/agently/types/data/__init__.py +0 -0
- {agently-4.0.5.4 → agently-4.0.5.5}/agently/types/data/event.py +0 -0
- {agently-4.0.5.4 → agently-4.0.5.5}/agently/types/data/prompt.py +0 -0
- {agently-4.0.5.4 → agently-4.0.5.5}/agently/types/data/request.py +0 -0
- {agently-4.0.5.4 → agently-4.0.5.5}/agently/types/data/response.py +0 -0
- {agently-4.0.5.4 → agently-4.0.5.5}/agently/types/data/serializable.py +0 -0
- {agently-4.0.5.4 → agently-4.0.5.5}/agently/types/data/tool.py +0 -0
- {agently-4.0.5.4 → agently-4.0.5.5}/agently/types/plugins/EventHooker.py +0 -0
- {agently-4.0.5.4 → agently-4.0.5.5}/agently/types/plugins/ModelRequester.py +0 -0
- {agently-4.0.5.4 → agently-4.0.5.5}/agently/types/plugins/PromptGenerator.py +0 -0
- {agently-4.0.5.4 → agently-4.0.5.5}/agently/types/plugins/ResponseParser.py +0 -0
- {agently-4.0.5.4 → agently-4.0.5.5}/agently/types/plugins/ToolManager.py +0 -0
- {agently-4.0.5.4 → agently-4.0.5.5}/agently/types/plugins/__init__.py +0 -0
- {agently-4.0.5.4 → agently-4.0.5.5}/agently/types/plugins/base.py +0 -0
- {agently-4.0.5.4 → agently-4.0.5.5}/agently/types/trigger_flow/__init__.py +0 -0
- {agently-4.0.5.4 → agently-4.0.5.5}/agently/types/trigger_flow/trigger_flow.py +0 -0
- {agently-4.0.5.4 → agently-4.0.5.5}/agently/utils/DataFormatter.py +0 -0
- {agently-4.0.5.4 → agently-4.0.5.5}/agently/utils/DataLocator.py +0 -0
- {agently-4.0.5.4 → agently-4.0.5.5}/agently/utils/DataPathBuilder.py +0 -0
- {agently-4.0.5.4 → agently-4.0.5.5}/agently/utils/FunctionShifter.py +0 -0
- {agently-4.0.5.4 → agently-4.0.5.5}/agently/utils/GeneratorConsumer.py +0 -0
- {agently-4.0.5.4 → agently-4.0.5.5}/agently/utils/LazyImport.py +0 -0
- {agently-4.0.5.4 → agently-4.0.5.5}/agently/utils/Logger.py +0 -0
- {agently-4.0.5.4 → agently-4.0.5.5}/agently/utils/Messenger.py +0 -0
- {agently-4.0.5.4 → agently-4.0.5.5}/agently/utils/RuntimeData.py +0 -0
- {agently-4.0.5.4 → agently-4.0.5.5}/agently/utils/SerializableRuntimeData.py +0 -0
- {agently-4.0.5.4 → agently-4.0.5.5}/agently/utils/Settings.py +0 -0
- {agently-4.0.5.4 → agently-4.0.5.5}/agently/utils/Storage.py +0 -0
- {agently-4.0.5.4 → agently-4.0.5.5}/agently/utils/StreamingJSONCompleter.py +0 -0
- {agently-4.0.5.4 → agently-4.0.5.5}/agently/utils/StreamingJSONParser.py +0 -0
- {agently-4.0.5.4 → agently-4.0.5.5}/agently/utils/__init__.py +0 -0
{agently-4.0.5.4 → agently-4.0.5.5}/agently/builtins/plugins/ModelRequester/OpenAICompatible.py
RENAMED
|
@@ -84,6 +84,8 @@ class OpenAICompatible(ModelRequester):
|
|
|
84
84
|
"$mappings": {
|
|
85
85
|
"path_mappings": {
|
|
86
86
|
"OpenAICompatible": "plugins.ModelRequester.OpenAICompatible",
|
|
87
|
+
"OpenAI": "plugins.ModelRequester.OpenAICompatible",
|
|
88
|
+
"OAIClient": "plugins.ModelRequester.OpenAICompatible",
|
|
87
89
|
},
|
|
88
90
|
},
|
|
89
91
|
"model_type": "chat",
|
|
@@ -98,6 +100,7 @@ class OpenAICompatible(ModelRequester):
|
|
|
98
100
|
"proxy": None,
|
|
99
101
|
"request_options": {},
|
|
100
102
|
"base_url": "https://api.openai.com/v1",
|
|
103
|
+
"full_url": None,
|
|
101
104
|
"path_mapping": {
|
|
102
105
|
"chat": "/chat/completions",
|
|
103
106
|
"completions": "/completions",
|
|
@@ -261,12 +264,16 @@ class OpenAICompatible(ModelRequester):
|
|
|
261
264
|
}
|
|
262
265
|
)
|
|
263
266
|
## !: ensure stream
|
|
264
|
-
is_stream = self.plugin_settings.get("stream"
|
|
267
|
+
is_stream = self.plugin_settings.get("stream")
|
|
268
|
+
if is_stream is None:
|
|
269
|
+
is_stream = True
|
|
265
270
|
request_options.update({"stream": is_stream})
|
|
266
271
|
## set
|
|
267
272
|
agently_request_dict["request_options"] = request_options
|
|
268
273
|
|
|
269
274
|
# request url
|
|
275
|
+
## get full url
|
|
276
|
+
full_url = self.plugin_settings.get("full_url")
|
|
270
277
|
## get base url
|
|
271
278
|
base_url = str(self.plugin_settings.get("base_url"))
|
|
272
279
|
base_url = base_url[:-1] if base_url[-1] == "/" else base_url
|
|
@@ -278,7 +285,10 @@ class OpenAICompatible(ModelRequester):
|
|
|
278
285
|
)
|
|
279
286
|
path_mapping = {k: v if v[0] == "/" else f"/{ v }" for k, v in path_mapping.items()}
|
|
280
287
|
## set
|
|
281
|
-
|
|
288
|
+
if isinstance(full_url, str):
|
|
289
|
+
request_url = full_url
|
|
290
|
+
else:
|
|
291
|
+
request_url = f"{ base_url }{ path_mapping[self.model_type] }"
|
|
282
292
|
agently_request_dict["request_url"] = request_url
|
|
283
293
|
|
|
284
294
|
return AgentlyRequestData(**agently_request_dict)
|
|
@@ -357,22 +367,34 @@ class OpenAICompatible(ModelRequester):
|
|
|
357
367
|
json=full_request_data,
|
|
358
368
|
headers=headers_with_auth,
|
|
359
369
|
)
|
|
360
|
-
|
|
361
|
-
if
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
error_json = await response.aread()
|
|
366
|
-
error_json = json.loads(error_json.decode())
|
|
367
|
-
error = error_json["error"]
|
|
368
|
-
error_title = f"{ error['code'] if 'code' in error else 'unknown_code' } - { error['type'] if 'type' in error else 'unknown_type' }"
|
|
369
|
-
error_detail = error["message"] if "message" in error else ""
|
|
370
|
-
yield "error", error_detail
|
|
371
|
-
else:
|
|
370
|
+
# Raise status code >= 400
|
|
371
|
+
if response.status_code >= 400:
|
|
372
|
+
e = RequestError(
|
|
373
|
+
f"Status Code: { response.status_code }\n" f"Request Data: {full_request_data}"
|
|
374
|
+
)
|
|
372
375
|
self._messenger.error(
|
|
373
|
-
|
|
376
|
+
e,
|
|
377
|
+
status="FAILED",
|
|
374
378
|
)
|
|
375
379
|
yield "error", e
|
|
380
|
+
else:
|
|
381
|
+
content_type = response.headers.get("Content-Type", "")
|
|
382
|
+
if content_type.startswith("application/json"):
|
|
383
|
+
try:
|
|
384
|
+
error_json = response.json()
|
|
385
|
+
except Exception:
|
|
386
|
+
error_json = await response.aread()
|
|
387
|
+
error_json = json.loads(error_json.decode())
|
|
388
|
+
error = error_json["error"]
|
|
389
|
+
error_title = f"{ error['code'] if 'code' in error else 'unknown_code' } - { error['type'] if 'type' in error else 'unknown_type' }"
|
|
390
|
+
error_detail = error["message"] if "message" in error else ""
|
|
391
|
+
yield "error", error_detail
|
|
392
|
+
else:
|
|
393
|
+
self._messenger.error(
|
|
394
|
+
"Error: SSE Error\n" f"Detail: {e}\n" f"Request Data: {full_request_data}",
|
|
395
|
+
status="FAILED",
|
|
396
|
+
)
|
|
397
|
+
yield "error", e
|
|
376
398
|
except HTTPStatusError as e:
|
|
377
399
|
self._messenger.error(
|
|
378
400
|
"Error: HTTP Status Error\n"
|
|
@@ -410,8 +432,18 @@ class OpenAICompatible(ModelRequester):
|
|
|
410
432
|
request_data.request_url,
|
|
411
433
|
json=full_request_data,
|
|
412
434
|
)
|
|
413
|
-
|
|
414
|
-
|
|
435
|
+
if response.status_code >= 400:
|
|
436
|
+
e = RequestError(
|
|
437
|
+
f"Status Code: { response.status_code }\n" f"Request Data: {full_request_data}"
|
|
438
|
+
)
|
|
439
|
+
self._messenger.error(
|
|
440
|
+
e,
|
|
441
|
+
status="FAILED",
|
|
442
|
+
)
|
|
443
|
+
yield "error", e
|
|
444
|
+
else:
|
|
445
|
+
yield "message", response.content.decode()
|
|
446
|
+
yield "message", "[DONE]"
|
|
415
447
|
except HTTPStatusError as e:
|
|
416
448
|
self._messenger.error(
|
|
417
449
|
"Error: HTTP Status Error\n"
|
|
@@ -480,6 +512,7 @@ class OpenAICompatible(ModelRequester):
|
|
|
480
512
|
loaded_message,
|
|
481
513
|
role_mapping,
|
|
482
514
|
style=content_mapping_style,
|
|
515
|
+
default="assistant",
|
|
483
516
|
)
|
|
484
517
|
if role:
|
|
485
518
|
meta.update({"role": role})
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{agently-4.0.5.4 → agently-4.0.5.5}/agently/builtins/agent_extensions/ChatSessionExtension.py
RENAMED
|
File without changes
|
{agently-4.0.5.4 → agently-4.0.5.5}/agently/builtins/agent_extensions/ConfigurePromptExtension.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
|
{agently-4.0.5.4 → agently-4.0.5.5}/agently/builtins/plugins/ResponseParser/AgentlyResponseParser.py
RENAMED
|
File without changes
|
{agently-4.0.5.4 → agently-4.0.5.5}/agently/builtins/plugins/ToolManager/AgentlyToolManager.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
|
|
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
|