grasp_agents 0.3.10__py3-none-any.whl → 0.3.11__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.
grasp_agents/cloud_llm.py CHANGED
@@ -21,7 +21,11 @@ from .llm import LLM, ConvertT_co, LLMSettings, SettingsT_co
21
21
  from .message_history import MessageHistory
22
22
  from .rate_limiting.rate_limiter_chunked import RateLimiterC, limit_rate_chunked
23
23
  from .typing.completion import Completion
24
- from .typing.completion_chunk import CompletionChunk, combine_completion_chunks
24
+ from .typing.completion_chunk import (
25
+ CompletionChoice,
26
+ CompletionChunk,
27
+ combine_completion_chunks,
28
+ )
25
29
  from .typing.events import CompletionChunkEvent, CompletionEvent
26
30
  from .typing.message import AssistantMessage, Messages
27
31
  from .typing.tool import BaseTool, ToolChoice
@@ -61,12 +65,12 @@ PROVIDERS: dict[APIProvider, APIProviderInfo] = {
61
65
  }
62
66
 
63
67
 
64
- def retry_error_callback(retry_state: RetryCallState) -> None:
68
+ def retry_error_callback(retry_state: RetryCallState) -> Completion:
65
69
  assert retry_state.outcome is not None
66
70
  exception = retry_state.outcome.exception()
67
71
  if exception:
68
72
  if retry_state.attempt_number == 1:
69
- logger.error(
73
+ logger.warning(
70
74
  f"CloudLLM completion request failed:\n{exception}",
71
75
  exc_info=exception,
72
76
  )
@@ -75,6 +79,12 @@ def retry_error_callback(retry_state: RetryCallState) -> None:
75
79
  f"CloudLLM completion request failed after retrying:\n{exception}",
76
80
  exc_info=exception,
77
81
  )
82
+ failed_message = AssistantMessage(content=None, refusal=str(exception))
83
+
84
+ return Completion(
85
+ model="",
86
+ choices=[CompletionChoice(message=failed_message, finish_reason=None, index=0)],
87
+ )
78
88
 
79
89
 
80
90
  def retry_before_callback(retry_state: RetryCallState) -> None:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: grasp_agents
3
- Version: 0.3.10
3
+ Version: 0.3.11
4
4
  Summary: Grasp Agents Library
5
5
  License-File: LICENSE.md
6
6
  Requires-Python: <4,>=3.11.4
@@ -1,5 +1,5 @@
1
1
  grasp_agents/__init__.py,sha256=CIsyUasb9HBC3M4olg6ATAwKXtVNmmtpyGJrt7hpZW4,947
2
- grasp_agents/cloud_llm.py,sha256=S3yl-bKhAyThs5drHS_hmkmWa_mTlaC-guTX84v6KXM,13798
2
+ grasp_agents/cloud_llm.py,sha256=IQa2yX9q8zWtB377PHrGepv8F-gjxgyal6olG1uF11Y,14054
3
3
  grasp_agents/comm_processor.py,sha256=w1Ix33K_1NALh1eLOwCpQbW5MDZDuP4eXOwEwPCBDJw,6790
4
4
  grasp_agents/costs_dict.yaml,sha256=2MFNWtkv5W5WSCcv1Cj13B1iQLVv5Ot9pS_KW2Gu2DA,2510
5
5
  grasp_agents/generics_utils.py,sha256=5Pw3I9dlnKC2VGqYKC4ZZUO3Z_vTNT-NPFovNfPkl6I,6542
@@ -45,7 +45,7 @@ grasp_agents/workflow/looped_workflow.py,sha256=QqXclXYxsW6C8Rxkf3dRaMHi-DfCvCbj
45
45
  grasp_agents/workflow/parallel_processor.py,sha256=Xyzs2UR_mRe2GFgzzadHOhqgMu3rFjd3GUjvmZimt_k,3505
46
46
  grasp_agents/workflow/sequential_workflow.py,sha256=Pl7jl9ZVDu-rC5UMfympEaQN8iG3kZurVF5eIPG62XA,2130
47
47
  grasp_agents/workflow/workflow_processor.py,sha256=2-iaDIlgNXgj-ClGbiE3fYfSv-N_qRC49Gf_dF6M_40,2640
48
- grasp_agents-0.3.10.dist-info/METADATA,sha256=0TRQcYhukNlCH9iB7iaXL6wQRGbQV3PN_Ttf2-S-1mc,6807
49
- grasp_agents-0.3.10.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
50
- grasp_agents-0.3.10.dist-info/licenses/LICENSE.md,sha256=-nNNdWqGB8gJ2O-peFQ2Irshv5tW5pHKyTcYkwvH7CE,1201
51
- grasp_agents-0.3.10.dist-info/RECORD,,
48
+ grasp_agents-0.3.11.dist-info/METADATA,sha256=c5IZLKElzLGTU8UdAgpIjKsvqijaJnYJVAgiKOaA4JQ,6807
49
+ grasp_agents-0.3.11.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
50
+ grasp_agents-0.3.11.dist-info/licenses/LICENSE.md,sha256=-nNNdWqGB8gJ2O-peFQ2Irshv5tW5pHKyTcYkwvH7CE,1201
51
+ grasp_agents-0.3.11.dist-info/RECORD,,