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.
Files changed (75) hide show
  1. {agently-4.0.5.4 → agently-4.0.5.5}/PKG-INFO +1 -1
  2. {agently-4.0.5.4 → agently-4.0.5.5}/agently/builtins/plugins/ModelRequester/OpenAICompatible.py +50 -17
  3. {agently-4.0.5.4 → agently-4.0.5.5}/pyproject.toml +1 -1
  4. {agently-4.0.5.4 → agently-4.0.5.5}/LICENSE +0 -0
  5. {agently-4.0.5.4 → agently-4.0.5.5}/README.md +0 -0
  6. {agently-4.0.5.4 → agently-4.0.5.5}/agently/__init__.py +0 -0
  7. {agently-4.0.5.4 → agently-4.0.5.5}/agently/_default_init.py +0 -0
  8. {agently-4.0.5.4 → agently-4.0.5.5}/agently/_default_settings.yaml +0 -0
  9. {agently-4.0.5.4 → agently-4.0.5.5}/agently/base.py +0 -0
  10. {agently-4.0.5.4 → agently-4.0.5.5}/agently/builtins/agent_extensions/AutoFuncExtension.py +0 -0
  11. {agently-4.0.5.4 → agently-4.0.5.5}/agently/builtins/agent_extensions/ChatSessionExtension.py +0 -0
  12. {agently-4.0.5.4 → agently-4.0.5.5}/agently/builtins/agent_extensions/ConfigurePromptExtension.py +0 -0
  13. {agently-4.0.5.4 → agently-4.0.5.5}/agently/builtins/agent_extensions/KeyWaiterExtension.py +0 -0
  14. {agently-4.0.5.4 → agently-4.0.5.5}/agently/builtins/agent_extensions/ToolExtension.py +0 -0
  15. {agently-4.0.5.4 → agently-4.0.5.5}/agently/builtins/agent_extensions/__init__.py +0 -0
  16. {agently-4.0.5.4 → agently-4.0.5.5}/agently/builtins/hookers/ConsoleHooker.py +0 -0
  17. {agently-4.0.5.4 → agently-4.0.5.5}/agently/builtins/hookers/PureLoggerHooker.py +0 -0
  18. {agently-4.0.5.4 → agently-4.0.5.5}/agently/builtins/hookers/SystemMessageHooker.py +0 -0
  19. {agently-4.0.5.4 → agently-4.0.5.5}/agently/builtins/plugins/PromptGenerator/AgentlyPromptGenerator.py +0 -0
  20. {agently-4.0.5.4 → agently-4.0.5.5}/agently/builtins/plugins/ResponseParser/AgentlyResponseParser.py +0 -0
  21. {agently-4.0.5.4 → agently-4.0.5.5}/agently/builtins/plugins/ToolManager/AgentlyToolManager.py +0 -0
  22. {agently-4.0.5.4 → agently-4.0.5.5}/agently/builtins/plugins/__init__.py +0 -0
  23. {agently-4.0.5.4 → agently-4.0.5.5}/agently/builtins/tools/Browse.py +0 -0
  24. {agently-4.0.5.4 → agently-4.0.5.5}/agently/builtins/tools/Search.py +0 -0
  25. {agently-4.0.5.4 → agently-4.0.5.5}/agently/builtins/tools/__init__.py +0 -0
  26. {agently-4.0.5.4 → agently-4.0.5.5}/agently/core/Agent.py +0 -0
  27. {agently-4.0.5.4 → agently-4.0.5.5}/agently/core/EventCenter.py +0 -0
  28. {agently-4.0.5.4 → agently-4.0.5.5}/agently/core/ExtensionHandlers.py +0 -0
  29. {agently-4.0.5.4 → agently-4.0.5.5}/agently/core/ModelRequest.py +0 -0
  30. {agently-4.0.5.4 → agently-4.0.5.5}/agently/core/PluginManager.py +0 -0
  31. {agently-4.0.5.4 → agently-4.0.5.5}/agently/core/Prompt.py +0 -0
  32. {agently-4.0.5.4 → agently-4.0.5.5}/agently/core/Tool.py +0 -0
  33. {agently-4.0.5.4 → agently-4.0.5.5}/agently/core/TriggerFlow/BluePrint.py +0 -0
  34. {agently-4.0.5.4 → agently-4.0.5.5}/agently/core/TriggerFlow/Chunk.py +0 -0
  35. {agently-4.0.5.4 → agently-4.0.5.5}/agently/core/TriggerFlow/Execution.py +0 -0
  36. {agently-4.0.5.4 → agently-4.0.5.5}/agently/core/TriggerFlow/Process.py +0 -0
  37. {agently-4.0.5.4 → agently-4.0.5.5}/agently/core/TriggerFlow/TriggerFlow.py +0 -0
  38. {agently-4.0.5.4 → agently-4.0.5.5}/agently/core/TriggerFlow/__init__.py +0 -0
  39. {agently-4.0.5.4 → agently-4.0.5.5}/agently/core/TriggerFlow/process/BaseProcess.py +0 -0
  40. {agently-4.0.5.4 → agently-4.0.5.5}/agently/core/TriggerFlow/process/ForEachProcess.py +0 -0
  41. {agently-4.0.5.4 → agently-4.0.5.5}/agently/core/TriggerFlow/process/MatchCaseProcess.py +0 -0
  42. {agently-4.0.5.4 → agently-4.0.5.5}/agently/core/TriggerFlow/process/__init__.py +0 -0
  43. {agently-4.0.5.4 → agently-4.0.5.5}/agently/core/__init__.py +0 -0
  44. {agently-4.0.5.4 → agently-4.0.5.5}/agently/types/__init__.py +0 -0
  45. {agently-4.0.5.4 → agently-4.0.5.5}/agently/types/data/__init__.py +0 -0
  46. {agently-4.0.5.4 → agently-4.0.5.5}/agently/types/data/event.py +0 -0
  47. {agently-4.0.5.4 → agently-4.0.5.5}/agently/types/data/prompt.py +0 -0
  48. {agently-4.0.5.4 → agently-4.0.5.5}/agently/types/data/request.py +0 -0
  49. {agently-4.0.5.4 → agently-4.0.5.5}/agently/types/data/response.py +0 -0
  50. {agently-4.0.5.4 → agently-4.0.5.5}/agently/types/data/serializable.py +0 -0
  51. {agently-4.0.5.4 → agently-4.0.5.5}/agently/types/data/tool.py +0 -0
  52. {agently-4.0.5.4 → agently-4.0.5.5}/agently/types/plugins/EventHooker.py +0 -0
  53. {agently-4.0.5.4 → agently-4.0.5.5}/agently/types/plugins/ModelRequester.py +0 -0
  54. {agently-4.0.5.4 → agently-4.0.5.5}/agently/types/plugins/PromptGenerator.py +0 -0
  55. {agently-4.0.5.4 → agently-4.0.5.5}/agently/types/plugins/ResponseParser.py +0 -0
  56. {agently-4.0.5.4 → agently-4.0.5.5}/agently/types/plugins/ToolManager.py +0 -0
  57. {agently-4.0.5.4 → agently-4.0.5.5}/agently/types/plugins/__init__.py +0 -0
  58. {agently-4.0.5.4 → agently-4.0.5.5}/agently/types/plugins/base.py +0 -0
  59. {agently-4.0.5.4 → agently-4.0.5.5}/agently/types/trigger_flow/__init__.py +0 -0
  60. {agently-4.0.5.4 → agently-4.0.5.5}/agently/types/trigger_flow/trigger_flow.py +0 -0
  61. {agently-4.0.5.4 → agently-4.0.5.5}/agently/utils/DataFormatter.py +0 -0
  62. {agently-4.0.5.4 → agently-4.0.5.5}/agently/utils/DataLocator.py +0 -0
  63. {agently-4.0.5.4 → agently-4.0.5.5}/agently/utils/DataPathBuilder.py +0 -0
  64. {agently-4.0.5.4 → agently-4.0.5.5}/agently/utils/FunctionShifter.py +0 -0
  65. {agently-4.0.5.4 → agently-4.0.5.5}/agently/utils/GeneratorConsumer.py +0 -0
  66. {agently-4.0.5.4 → agently-4.0.5.5}/agently/utils/LazyImport.py +0 -0
  67. {agently-4.0.5.4 → agently-4.0.5.5}/agently/utils/Logger.py +0 -0
  68. {agently-4.0.5.4 → agently-4.0.5.5}/agently/utils/Messenger.py +0 -0
  69. {agently-4.0.5.4 → agently-4.0.5.5}/agently/utils/RuntimeData.py +0 -0
  70. {agently-4.0.5.4 → agently-4.0.5.5}/agently/utils/SerializableRuntimeData.py +0 -0
  71. {agently-4.0.5.4 → agently-4.0.5.5}/agently/utils/Settings.py +0 -0
  72. {agently-4.0.5.4 → agently-4.0.5.5}/agently/utils/Storage.py +0 -0
  73. {agently-4.0.5.4 → agently-4.0.5.5}/agently/utils/StreamingJSONCompleter.py +0 -0
  74. {agently-4.0.5.4 → agently-4.0.5.5}/agently/utils/StreamingJSONParser.py +0 -0
  75. {agently-4.0.5.4 → agently-4.0.5.5}/agently/utils/__init__.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: agently
3
- Version: 4.0.5.4
3
+ Version: 4.0.5.5
4
4
  Summary:
5
5
  License: Apache-2.0
6
6
  License-File: LICENSE
@@ -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", True)
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
- request_url = f"{ base_url }{ path_mapping[self.model_type] }"
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
- content_type = response.headers.get("Content-Type", "")
361
- if content_type.startswith("application/json"):
362
- try:
363
- error_json = response.json()
364
- except Exception:
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
- "Error: SSE Error\n" f"Detail: {e}\n" f"Request Data: {full_request_data}", status="FAILED"
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
- yield "message", response.content.decode()
414
- yield "message", "[DONE]"
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})
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "agently"
3
- version = "4.0.5.4"
3
+ version = "4.0.5.5"
4
4
  description = ""
5
5
  authors = [
6
6
  {name = "Agently Team",email = "developer@agently.tech"},
File without changes
File without changes
File without changes
File without changes