aient 1.1.85__tar.gz → 1.1.86__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.
- {aient-1.1.85 → aient-1.1.86}/PKG-INFO +1 -1
- {aient-1.1.85 → aient-1.1.86}/aient/models/chatgpt.py +18 -0
- {aient-1.1.85 → aient-1.1.86}/aient.egg-info/PKG-INFO +1 -1
- {aient-1.1.85 → aient-1.1.86}/pyproject.toml +1 -1
- {aient-1.1.85 → aient-1.1.86}/LICENSE +0 -0
- {aient-1.1.85 → aient-1.1.86}/README.md +0 -0
- {aient-1.1.85 → aient-1.1.86}/aient/__init__.py +0 -0
- {aient-1.1.85 → aient-1.1.86}/aient/core/__init__.py +0 -0
- {aient-1.1.85 → aient-1.1.86}/aient/core/log_config.py +0 -0
- {aient-1.1.85 → aient-1.1.86}/aient/core/models.py +0 -0
- {aient-1.1.85 → aient-1.1.86}/aient/core/request.py +0 -0
- {aient-1.1.85 → aient-1.1.86}/aient/core/response.py +0 -0
- {aient-1.1.85 → aient-1.1.86}/aient/core/test/test_base_api.py +0 -0
- {aient-1.1.85 → aient-1.1.86}/aient/core/test/test_geminimask.py +0 -0
- {aient-1.1.85 → aient-1.1.86}/aient/core/test/test_image.py +0 -0
- {aient-1.1.85 → aient-1.1.86}/aient/core/test/test_payload.py +0 -0
- {aient-1.1.85 → aient-1.1.86}/aient/core/utils.py +0 -0
- {aient-1.1.85 → aient-1.1.86}/aient/models/__init__.py +0 -0
- {aient-1.1.85 → aient-1.1.86}/aient/models/audio.py +0 -0
- {aient-1.1.85 → aient-1.1.86}/aient/models/base.py +0 -0
- {aient-1.1.85 → aient-1.1.86}/aient/plugins/__init__.py +0 -0
- {aient-1.1.85 → aient-1.1.86}/aient/plugins/arXiv.py +0 -0
- {aient-1.1.85 → aient-1.1.86}/aient/plugins/config.py +0 -0
- {aient-1.1.85 → aient-1.1.86}/aient/plugins/excute_command.py +0 -0
- {aient-1.1.85 → aient-1.1.86}/aient/plugins/get_time.py +0 -0
- {aient-1.1.85 → aient-1.1.86}/aient/plugins/image.py +0 -0
- {aient-1.1.85 → aient-1.1.86}/aient/plugins/list_directory.py +0 -0
- {aient-1.1.85 → aient-1.1.86}/aient/plugins/read_file.py +0 -0
- {aient-1.1.85 → aient-1.1.86}/aient/plugins/read_image.py +0 -0
- {aient-1.1.85 → aient-1.1.86}/aient/plugins/readonly.py +0 -0
- {aient-1.1.85 → aient-1.1.86}/aient/plugins/registry.py +0 -0
- {aient-1.1.85 → aient-1.1.86}/aient/plugins/run_python.py +0 -0
- {aient-1.1.85 → aient-1.1.86}/aient/plugins/websearch.py +0 -0
- {aient-1.1.85 → aient-1.1.86}/aient/plugins/write_file.py +0 -0
- {aient-1.1.85 → aient-1.1.86}/aient/utils/__init__.py +0 -0
- {aient-1.1.85 → aient-1.1.86}/aient/utils/prompt.py +0 -0
- {aient-1.1.85 → aient-1.1.86}/aient/utils/scripts.py +0 -0
- {aient-1.1.85 → aient-1.1.86}/aient.egg-info/SOURCES.txt +0 -0
- {aient-1.1.85 → aient-1.1.86}/aient.egg-info/dependency_links.txt +0 -0
- {aient-1.1.85 → aient-1.1.86}/aient.egg-info/requires.txt +0 -0
- {aient-1.1.85 → aient-1.1.86}/aient.egg-info/top_level.txt +0 -0
- {aient-1.1.85 → aient-1.1.86}/setup.cfg +0 -0
- {aient-1.1.85 → aient-1.1.86}/test/test_Web_crawler.py +0 -0
- {aient-1.1.85 → aient-1.1.86}/test/test_ddg_search.py +0 -0
- {aient-1.1.85 → aient-1.1.86}/test/test_google_search.py +0 -0
- {aient-1.1.85 → aient-1.1.86}/test/test_ollama.py +0 -0
- {aient-1.1.85 → aient-1.1.86}/test/test_plugin.py +0 -0
- {aient-1.1.85 → aient-1.1.86}/test/test_search.py +0 -0
- {aient-1.1.85 → aient-1.1.86}/test/test_url.py +0 -0
- {aient-1.1.85 → aient-1.1.86}/test/test_whisper.py +0 -0
- {aient-1.1.85 → aient-1.1.86}/test/test_yjh.py +0 -0
@@ -37,10 +37,18 @@ class RateLimitError(Exception):
|
|
37
37
|
"""Custom exception for rate limit (429) errors."""
|
38
38
|
pass
|
39
39
|
|
40
|
+
class BadRequestError(Exception):
|
41
|
+
"""Custom exception for bad request (400) errors."""
|
42
|
+
pass
|
43
|
+
|
40
44
|
class HTTPError(Exception):
|
41
45
|
"""Custom exception for HTTP 500 errors."""
|
42
46
|
pass
|
43
47
|
|
48
|
+
class InputTokenCountExceededError(Exception):
|
49
|
+
"""Custom exception for input token count exceeding the maximum."""
|
50
|
+
pass
|
51
|
+
|
44
52
|
class ConfigurationError(Exception):
|
45
53
|
"""Custom exception for configuration errors."""
|
46
54
|
pass
|
@@ -802,6 +810,10 @@ class chatgpt(BaseLLM):
|
|
802
810
|
raise ModelNotFoundError(f"Model: {model or self.engine} not found!")
|
803
811
|
if "HTTP Error', 'status_code': 429" in processed_chunk:
|
804
812
|
raise RateLimitError(f"Rate limit exceeded for model: {model or self.engine}")
|
813
|
+
if "HTTP Error', 'status_code': 413" in processed_chunk:
|
814
|
+
raise InputTokenCountExceededError(processed_chunk)
|
815
|
+
if "HTTP Error', 'status_code': 400" in processed_chunk:
|
816
|
+
raise BadRequestError(f"Bad Request: {processed_chunk}")
|
805
817
|
if "HTTP Error', 'status_code': " in processed_chunk:
|
806
818
|
raise HTTPError(f"HTTP Error: {processed_chunk}")
|
807
819
|
yield processed_chunk
|
@@ -826,6 +838,12 @@ class chatgpt(BaseLLM):
|
|
826
838
|
except RateLimitError as e:
|
827
839
|
self.logger.warning(f"{e}, retrying...")
|
828
840
|
continue
|
841
|
+
except InputTokenCountExceededError as e:
|
842
|
+
self.logger.error(f"The request body is too long: {e}")
|
843
|
+
raise
|
844
|
+
except BadRequestError as e:
|
845
|
+
self.logger.error(f"Bad request error: {e}")
|
846
|
+
raise
|
829
847
|
except ValidationError as e:
|
830
848
|
self.logger.warning(f"Validation failed: {e}. Retrying with corrective prompt.")
|
831
849
|
need_done_prompt = [
|
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
|