aient 1.1.85__py3-none-any.whl → 1.1.86__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.
aient/models/chatgpt.py CHANGED
@@ -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 = [
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: aient
3
- Version: 1.1.85
3
+ Version: 1.1.86
4
4
  Summary: Aient: The Awakening of Agent.
5
5
  Requires-Python: >=3.11
6
6
  Description-Content-Type: text/markdown
@@ -12,7 +12,7 @@ aient/core/test/test_payload.py,sha256=8jBiJY1uidm1jzL-EiK0s6UGmW9XkdsuuKFGrwFhF
12
12
  aient/models/__init__.py,sha256=ZTiZgbfBPTjIPSKURE7t6hlFBVLRS9lluGbmqc1WjxQ,43
13
13
  aient/models/audio.py,sha256=kRd-8-WXzv4vwvsTGwnstK-WR8--vr9CdfCZzu8y9LA,1934
14
14
  aient/models/base.py,sha256=-nnihYnx-vHZMqeVO9ljjt3k4FcD3n-iMk4tT-10nRQ,7232
15
- aient/models/chatgpt.py,sha256=Jb0g9FsTitM7U_qG4RZilSgRY18fJ3-1a5GueetjQ8I,46227
15
+ aient/models/chatgpt.py,sha256=-3bOA_jLsePy3B77Q5C1C3UglY0NDc9dRMDi7bAdcNw,47056
16
16
  aient/plugins/__init__.py,sha256=p3KO6Aa3Lupos4i2SjzLQw1hzQTigOAfEHngsldrsyk,986
17
17
  aient/plugins/arXiv.py,sha256=yHjb6PS3GUWazpOYRMKMzghKJlxnZ5TX8z9F6UtUVow,1461
18
18
  aient/plugins/config.py,sha256=TGgZ5SnNKZ8MmdznrZ-TEq7s2ulhAAwTSKH89bci3dA,7079
@@ -30,8 +30,8 @@ aient/plugins/write_file.py,sha256=Jt8fOEwqhYiSWpCbwfAr1xoi_BmFnx3076GMhuL06uI,3
30
30
  aient/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
31
31
  aient/utils/prompt.py,sha256=UcSzKkFE4-h_1b6NofI6xgk3GoleqALRKY8VBaXLjmI,11311
32
32
  aient/utils/scripts.py,sha256=VqtK4RFEx7KxkmcqG3lFDS1DxoNlFFGErEjopVcc8IE,40974
33
- aient-1.1.85.dist-info/licenses/LICENSE,sha256=XNdbcWldt0yaNXXWB_Bakoqnxb3OVhUft4MgMA_71ds,1051
34
- aient-1.1.85.dist-info/METADATA,sha256=HxXc6ppmpfa3xS-UYSmYsvoB9xennfmJ8SlJns5X5_U,4842
35
- aient-1.1.85.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
36
- aient-1.1.85.dist-info/top_level.txt,sha256=3oXzrP5sAVvyyqabpeq8A2_vfMtY554r4bVE-OHBrZk,6
37
- aient-1.1.85.dist-info/RECORD,,
33
+ aient-1.1.86.dist-info/licenses/LICENSE,sha256=XNdbcWldt0yaNXXWB_Bakoqnxb3OVhUft4MgMA_71ds,1051
34
+ aient-1.1.86.dist-info/METADATA,sha256=WTsDczZLe_c5md4EyuWASjIGxISX3QUrMl9LFygjXJ0,4842
35
+ aient-1.1.86.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
36
+ aient-1.1.86.dist-info/top_level.txt,sha256=3oXzrP5sAVvyyqabpeq8A2_vfMtY554r4bVE-OHBrZk,6
37
+ aient-1.1.86.dist-info/RECORD,,
File without changes