beamlit 0.0.60rc128__py3-none-any.whl → 0.0.61__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.
@@ -34,6 +34,22 @@ from beamlit.models import AgentChain
34
34
 
35
35
  logger = getLogger(__name__)
36
36
 
37
+ MAX_RETRIES = 10
38
+ RETRY_DELAY = 1 # 1 second delay between retries
39
+
40
+ async def initialize_with_retry(toolkit, function_name: str, max_retries: int):
41
+ for attempt in range(1, max_retries + 1):
42
+ try:
43
+ await toolkit.initialize()
44
+ return await toolkit.get_tools()
45
+ except Exception as e:
46
+ if attempt == max_retries:
47
+ logger.warn(f"Failed to initialize function {function_name} after {max_retries} attempts: {e!s}")
48
+ raise
49
+ logger.info(f"Attempt {attempt} failed for {function_name}, retrying...")
50
+ await asyncio.sleep(RETRY_DELAY)
51
+ return []
52
+
37
53
  async def get_functions(
38
54
  remote_functions: Union[list[str], None] = None,
39
55
  local_functions: Union[list[dict], None] = None,
@@ -178,13 +194,12 @@ async def get_functions(
178
194
  )
179
195
  except Exception as e:
180
196
  logger.warning(f"Error processing {file_path}: {e!s}")
181
-
182
197
  if remote_functions:
183
198
  for function in remote_functions:
184
199
  try:
185
200
  toolkit = RemoteToolkit(client, function)
186
- await toolkit.initialize()
187
- functions.extend(await toolkit.get_tools())
201
+ tools = await initialize_with_retry(toolkit, function, MAX_RETRIES)
202
+ functions.extend(tools)
188
203
  except Exception as e:
189
204
  if not isinstance(e, RuntimeError):
190
205
  logger.debug(
@@ -196,8 +211,8 @@ async def get_functions(
196
211
  for function in local_functions:
197
212
  try:
198
213
  toolkit = LocalToolKit(client, function)
199
- await toolkit.initialize()
200
- functions.extend(await toolkit.get_tools())
214
+ tools = await initialize_with_retry(toolkit, function["name"], MAX_RETRIES)
215
+ functions.extend(tools)
201
216
  except Exception as e:
202
217
  logger.debug(
203
218
  f"Failed to initialize local function {function}: {e!s}\n"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: beamlit
3
- Version: 0.0.60rc128
3
+ Version: 0.0.61
4
4
  Summary: Add your description here
5
5
  Author-email: cploujoux <ch.ploujoux@gmail.com>
6
6
  License-File: LICENSE
@@ -131,7 +131,7 @@ beamlit/deploy/deploy.py,sha256=AP1FjmoqE3tdKcNKtRZLojTaJ1PR73hwrk6ORRSgRmQ,1165
131
131
  beamlit/deploy/format.py,sha256=W3ESUHyFv-iZDjVnHOf9YFDDXZSXYIFFbwCoL1GInE0,1162
132
132
  beamlit/deploy/parser.py,sha256=gjRUhOVtfKnc1UNc_FhXsEfj9zrMNuq8W93pNsJBpo0,7586
133
133
  beamlit/functions/__init__.py,sha256=Mnoqpa1dm7TXwjodBbF_40JyD78aXsOYWmqjDSnA1lU,317
134
- beamlit/functions/common.py,sha256=v4nmLP9Wotpb5e6hV30XbItgZjr5lwXcF0EOotxRngI,10127
134
+ beamlit/functions/common.py,sha256=ssCtIR6oTq2JR2FRuZIgW7uH8IwP2DDsZX7AwBgDGdg,10819
135
135
  beamlit/functions/decorator.py,sha256=iQbLwUo0K83DFJ3ub8O5jKtkbSINnku6GZcKJ9h7-5E,2292
136
136
  beamlit/functions/local/local.py,sha256=qkd-RGObyjZD0KIwaze_TnTuiJ3lyluCcM97nbyPNBk,1897
137
137
  beamlit/functions/mcp/client.py,sha256=enLo0dzWMBHJEQf6as3UWM8tN3CjUN1YO3UPn67DLac,4072
@@ -254,8 +254,8 @@ beamlit/serve/app.py,sha256=5XZci-R95Zjl97wMtQd1BRtonnkJJ2AeoTVFPKGAOfA,4283
254
254
  beamlit/serve/middlewares/__init__.py,sha256=O7fyfE1DIYmajFY9WWdzxCgeAQWZzJfeUjzHGbpWaAk,309
255
255
  beamlit/serve/middlewares/accesslog.py,sha256=lcu33j4epFSHRBaeTpyt8deNb3kaM3K91-andw4fp80,1112
256
256
  beamlit/serve/middlewares/processtime.py,sha256=3x5w1yQexB0xFNKK6fgLbINxT-eLLunfZ6UDV0bIIF4,944
257
- beamlit-0.0.60rc128.dist-info/METADATA,sha256=B3MFxSnd094ye9cY7XsjIi7NU_k-jrm9fwgRYPPGL7E,3547
258
- beamlit-0.0.60rc128.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
259
- beamlit-0.0.60rc128.dist-info/entry_points.txt,sha256=zxhgdn7SP-Otk4rEv7LMPAAa9w4TUCLbu9TJi9-K3xg,115
260
- beamlit-0.0.60rc128.dist-info/licenses/LICENSE,sha256=p5PNQvpvyDT_0aYBDgmV1fFI_vAD2aSV0wWG7VTgRis,1069
261
- beamlit-0.0.60rc128.dist-info/RECORD,,
257
+ beamlit-0.0.61.dist-info/METADATA,sha256=khTDKpuZB6tg94YRpH_CCmqaW12DZrYzTRU8g4Yf1Vc,3542
258
+ beamlit-0.0.61.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
259
+ beamlit-0.0.61.dist-info/entry_points.txt,sha256=zxhgdn7SP-Otk4rEv7LMPAAa9w4TUCLbu9TJi9-K3xg,115
260
+ beamlit-0.0.61.dist-info/licenses/LICENSE,sha256=p5PNQvpvyDT_0aYBDgmV1fFI_vAD2aSV0wWG7VTgRis,1069
261
+ beamlit-0.0.61.dist-info/RECORD,,