lm-deluge 0.0.18__py3-none-any.whl → 0.0.20__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 lm-deluge might be problematic. Click here for more details.

@@ -185,6 +185,7 @@ class AnthropicRequest(APIRequestBase):
185
185
  error_message = text
186
186
 
187
187
  # handle special kinds of errors. TODO: make sure these are correct for anthropic
188
+ retry_with_different_model = status_code in [529, 429, 400, 401, 403, 413]
188
189
  if is_error and error_message is not None:
189
190
  if (
190
191
  "rate limit" in error_message.lower()
@@ -195,6 +196,7 @@ class AnthropicRequest(APIRequestBase):
195
196
  if "context length" in error_message:
196
197
  error_message += " (Context length exceeded, set retries to 0.)"
197
198
  self.context.attempts_left = 0
199
+ retry_with_different_model = True
198
200
 
199
201
  return APIResponse(
200
202
  id=self.context.task_id,
@@ -208,4 +210,5 @@ class AnthropicRequest(APIRequestBase):
208
210
  sampling_params=self.context.sampling_params,
209
211
  usage=usage,
210
212
  raw_response=data,
213
+ retry_with_different_model=retry_with_different_model,
211
214
  )
@@ -159,6 +159,7 @@ class OpenAIRequest(APIRequestBase):
159
159
  error_message = text
160
160
 
161
161
  # handle special kinds of errors
162
+ retry_with_different_model = status_code in [529, 429, 400, 401, 403, 413]
162
163
  if is_error and error_message is not None:
163
164
  if "rate limit" in error_message.lower() or status_code == 429:
164
165
  error_message += " (Rate limit error, triggering cooldown.)"
@@ -166,6 +167,7 @@ class OpenAIRequest(APIRequestBase):
166
167
  if "context length" in error_message:
167
168
  error_message += " (Context length exceeded, set retries to 0.)"
168
169
  self.context.attempts_left = 0
170
+ retry_with_different_model = True
169
171
 
170
172
  return APIResponse(
171
173
  id=self.context.task_id,
@@ -181,6 +183,7 @@ class OpenAIRequest(APIRequestBase):
181
183
  usage=usage,
182
184
  raw_response=data,
183
185
  finish_reason=finish_reason,
186
+ retry_with_different_model=retry_with_different_model,
184
187
  )
185
188
 
186
189
 
lm_deluge/client.py CHANGED
@@ -104,6 +104,8 @@ class LLMClient(BaseModel):
104
104
  top_logprobs=data.get("top_logprobs", None),
105
105
  )
106
106
  ]
107
+ if len(data["model_names"]) > 1 and len(data["sampling_params"]) == 1:
108
+ data["sampling_params"] = data["sampling_params"] * len(data["model_names"])
107
109
  return data
108
110
 
109
111
  @model_validator(mode="after")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: lm_deluge
3
- Version: 0.0.18
3
+ Version: 0.0.20
4
4
  Summary: Python utility for using LLM API models.
5
5
  Author-email: Benjamin Anderson <ben@trytaylor.ai>
6
6
  Requires-Python: >=3.10
@@ -2,7 +2,7 @@ lm_deluge/__init__.py,sha256=mAztMuxINmh7dGbYnT8tsmw1eryQAvd0jpY8yHzd0EE,315
2
2
  lm_deluge/agent.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
3
  lm_deluge/batches.py,sha256=05t8UL1xCKjLRKtZLkfbexLqro6T_ufFVsaNIMk05Fw,17725
4
4
  lm_deluge/cache.py,sha256=VB1kv8rM2t5XWPR60uhszFcxLDnVKOe1oA5hYjVDjIo,4375
5
- lm_deluge/client.py,sha256=KFkI8uzHxwIvDS1PV4KjykHUMQ48wo6h-Yn4IJKUDbg,25682
5
+ lm_deluge/client.py,sha256=H7rNqq9pOeyoqK2PyHbHUCIOygxXWJmRNj4WQA8qawE,25850
6
6
  lm_deluge/config.py,sha256=H1tQyJDNHGFuwxqQNL5Z-CjWAC0luHSBA3iY_pxmACM,932
7
7
  lm_deluge/embed.py,sha256=CO-TOlC5kOTAM8lcnicoG4u4K664vCBwHF1vHa-nAGg,13382
8
8
  lm_deluge/errors.py,sha256=oHjt7YnxWbh-eXMScIzov4NvpJMo0-2r5J6Wh5DQ1tk,209
@@ -17,13 +17,13 @@ lm_deluge/tool.py,sha256=X6NDabz53BVe1pokaKCeTLCF1-AlMAxOn1_KWiCSb7c,12407
17
17
  lm_deluge/tracker.py,sha256=-EkFDAklh5mclIFR-5SthAwNL4p1yKS8LUN7rhpOVPQ,9266
18
18
  lm_deluge/usage.py,sha256=VMEKghePFIID5JFBObqYxFpgYxnbYm_dnHy7V1-_T6M,4866
19
19
  lm_deluge/api_requests/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
20
- lm_deluge/api_requests/anthropic.py,sha256=pgDJLS98R59ZBLUGZxEPuuagEKS3UgjPgvr3LPvsndA,7815
20
+ lm_deluge/api_requests/anthropic.py,sha256=Tc_LuovLEAXsqWlzJe08YCKighBXadp-cZztqoiBb1Y,8011
21
21
  lm_deluge/api_requests/base.py,sha256=O3-Dsl_hr-xtLTekPLdrNnL5mTTfnfsN6Fcwq0-eKMg,5355
22
22
  lm_deluge/api_requests/bedrock.py,sha256=kZtKp6GqF73RpmLJKzEj4XTbllB8Kyq9-QydUuh2iu0,10977
23
23
  lm_deluge/api_requests/common.py,sha256=BZ3vRO5TB669_UsNKugkkuFSzoLHOYJIKt4nV4sf4vc,422
24
24
  lm_deluge/api_requests/gemini.py,sha256=N_94TpjpBLyekdrBjax2w0jPqYf70JycaRgZUNSsAAY,7531
25
25
  lm_deluge/api_requests/mistral.py,sha256=5EqYZgu9AfGrWs5-ucr8uJK_0cMEoUKKlEjBV3O6EPc,4561
26
- lm_deluge/api_requests/openai.py,sha256=vunVsUKW-YwMQ_p7DlVBBUMldjxQUaMinpzl0TyIXm4,21228
26
+ lm_deluge/api_requests/openai.py,sha256=fEIBchry-tLqkf0fhdFsS3CIjXbB_AV39Ig-PwAsT1I,21424
27
27
  lm_deluge/api_requests/response.py,sha256=JFSwHAs-yaJYkscOgTAyHkt-v8FDZ5mgER9NmueXTGk,5866
28
28
  lm_deluge/api_requests/deprecated/bedrock.py,sha256=WrcIShCoO8JCUSlFOCHxg6KQCNTZfw3TpYTvSpYk4mA,11320
29
29
  lm_deluge/api_requests/deprecated/cohere.py,sha256=KgDScD6_bWhAzOY5BHZQKSA3kurt4KGENqC4wLsGmcU,5142
@@ -48,8 +48,8 @@ lm_deluge/util/logprobs.py,sha256=UkBZakOxWluaLqHrjARu7xnJ0uCHVfLGHJdnYlEcutk,11
48
48
  lm_deluge/util/spatial.py,sha256=BsF_UKhE-x0xBirc-bV1xSKZRTUhsOBdGqsMKme20C8,4099
49
49
  lm_deluge/util/validation.py,sha256=hz5dDb3ebvZrZhnaWxOxbNSVMI6nmaOODBkk0htAUhs,1575
50
50
  lm_deluge/util/xml.py,sha256=Ft4zajoYBJR3HHCt2oHwGfymGLdvp_gegVmJ-Wqk4Ck,10547
51
- lm_deluge-0.0.18.dist-info/licenses/LICENSE,sha256=uNNXGXPCw2TC7CUs7SEBkA-Mz6QBQFWUUEWDMgEs1dU,1058
52
- lm_deluge-0.0.18.dist-info/METADATA,sha256=ipVPBfU_QURIDLXW3V-dwTFw_5luECxLTs3_bxku1oc,12978
53
- lm_deluge-0.0.18.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
54
- lm_deluge-0.0.18.dist-info/top_level.txt,sha256=hqU-TJX93yBwpgkDtYcXyLr3t7TLSCCZ_reytJjwBaE,10
55
- lm_deluge-0.0.18.dist-info/RECORD,,
51
+ lm_deluge-0.0.20.dist-info/licenses/LICENSE,sha256=uNNXGXPCw2TC7CUs7SEBkA-Mz6QBQFWUUEWDMgEs1dU,1058
52
+ lm_deluge-0.0.20.dist-info/METADATA,sha256=Mj5z1W2c3YWVVL-Vh2M8q0cmiCM4mWIwlbf3jExRnjk,12978
53
+ lm_deluge-0.0.20.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
54
+ lm_deluge-0.0.20.dist-info/top_level.txt,sha256=hqU-TJX93yBwpgkDtYcXyLr3t7TLSCCZ_reytJjwBaE,10
55
+ lm_deluge-0.0.20.dist-info/RECORD,,