beamlit 0.0.24rc18__py3-none-any.whl → 0.0.24rc20__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,7 @@
1
1
  # Import necessary modules
2
2
  import ast
3
3
  import asyncio
4
+ import functools
4
5
  import importlib
5
6
  import os
6
7
  from logging import getLogger
@@ -94,6 +95,7 @@ def agent(
94
95
  def wrapper(func):
95
96
  settings = get_settings()
96
97
 
98
+ @functools.wraps(func)
97
99
  def wrapped(*args, **kwargs):
98
100
  return func(
99
101
  settings.agent.agent,
@@ -1,5 +1,6 @@
1
1
  """Decorators for creating function tools with Beamlit and LangChain integration."""
2
2
 
3
+ import json
3
4
  from collections.abc import Callable
4
5
  from logging import getLogger
5
6
 
@@ -30,17 +31,21 @@ def get_remote_function(func: Callable, bl_function: FunctionDeployment):
30
31
  resource_name=name,
31
32
  environment=settings.environment,
32
33
  method="POST",
33
- headers={},
34
- json=kwargs,
34
+ headers={"Content-Type": "application/json"},
35
+ data=json.dumps(kwargs),
35
36
  )
37
+ content = response.text
36
38
  if response.status_code >= 400:
37
39
  content = f"{response.status_code}:{response.text}"
40
+ logger.error(f"Error calling remote function: {content}")
38
41
  return f"Error calling remote function: {content}"
39
42
  logger.debug(
40
43
  f"Response from remote function: NAME={name}"
41
- f" RESPONSE={response.json()} ENVIRONMENT={settings.environment}"
44
+ f" RESPONSE={content} ENVIRONMENT={settings.environment}"
42
45
  )
43
- return response.json()
46
+ if response.headers.get("content-type") == "application/json":
47
+ return response.json()
48
+ return content
44
49
  except Exception as e:
45
50
  logger.error(f"Error calling function {bl_function.id}: {e}")
46
51
  raise e
@@ -83,3 +88,4 @@ def function(
83
88
  return func
84
89
 
85
90
  return wrapper
91
+ return wrapper
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: beamlit
3
- Version: 0.0.24rc18
3
+ Version: 0.0.24rc20
4
4
  Summary: Add your description here
5
5
  Author-email: cploujoux <ch.ploujoux@gmail.com>
6
6
  Requires-Python: >=3.12
@@ -6,7 +6,7 @@ beamlit/run.py,sha256=y61iDBaR0917ihj5q-cJ_r3BFW1Rn5K_kDAISw5O6aU,1339
6
6
  beamlit/types.py,sha256=E1hhDh_zXfsSQ0NCt9-uw90_Mr5iIlsdfnfvxv5HarU,1005
7
7
  beamlit/agents/__init__.py,sha256=nf1iwQwGtCG6nDqyVhxfWoqR6dv6X3bvSpCeqkTCFaM,101
8
8
  beamlit/agents/chat.py,sha256=aI7pObyywRyg3dBpubzHAUWTbTk1nwtxvpY7iIP1RLY,2704
9
- beamlit/agents/decorator.py,sha256=XDrWN-Xx4czSy1sIkfQY4t9-UnsM21vMll58CP1TRLw,6468
9
+ beamlit/agents/decorator.py,sha256=VOiCUpGyzXgf2-KRmp4IMA6Y-CcL1NZEax5kXLGt8GY,6516
10
10
  beamlit/api/__init__.py,sha256=zTSiG_ujSjAqWPyc435YXaX9XTlpMjiJWBbV-f-YtdA,45
11
11
  beamlit/api/agents/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
12
12
  beamlit/api/agents/create_agent.py,sha256=HFExosu02JZqZz7I6U6WjN81TERz6p2i8CzQCyiRYXo,4112
@@ -143,7 +143,7 @@ beamlit/common/utils.py,sha256=jouz5igBvT37Xn_e94-foCHyQczVim-UzVcoIF6RWJ4,657
143
143
  beamlit/deploy/__init__.py,sha256=GS7l7Jtm2yKs7iNLKcfjYO-rAhUzggQ3xiYSf3oxLBY,91
144
144
  beamlit/deploy/deploy.py,sha256=bWUXG_5b_XhFcG5t75vel2EbEfZPIdg_YLXtzkfgXUs,18799
145
145
  beamlit/functions/__init__.py,sha256=_RPG1Bfg54JGdIPnViAU6n9zD7E1cDNsdXi8oYGskzE,138
146
- beamlit/functions/decorator.py,sha256=uYZOVxD-7ZNHORTQfCIn0qdNKPIZupsr7_QdUmWEKu0,2996
146
+ beamlit/functions/decorator.py,sha256=EnkvWvmJTFAbTzsoJZxWUemwv3j0FqyGlGmMhjrsp6c,3281
147
147
  beamlit/functions/github/__init__.py,sha256=gYnUkeegukOfbymdabuuJkScvH-_ZJygX05BoqkPn0o,49
148
148
  beamlit/functions/github/github.py,sha256=FajzLCNkpXcwfgnC0l9rOGT2eSPLCz8-qrMzK9N_ZNc,598
149
149
  beamlit/functions/github/kit/__init__.py,sha256=jBwPqZv6C23_utukohxqXZwrlicNlI7PYPUj0Den7Cw,136
@@ -298,6 +298,6 @@ beamlit/serve/app.py,sha256=Xoc_A-e9_4U9OZKoKXSc6qc_NTRPuVb6ddAZVENhd34,2617
298
298
  beamlit/serve/middlewares/__init__.py,sha256=1dVmnOmhAQWvWktqHkKSIX-YoF6fmMU8xkUQuhg_rJU,148
299
299
  beamlit/serve/middlewares/accesslog.py,sha256=wM52-hcwtO-_hdM1pnsEJzerzJf1MzEyN5m85BdDccE,609
300
300
  beamlit/serve/middlewares/processtime.py,sha256=lDAaIasZ4bwvN-HKHvZpaD9r-yrkVNZYx4abvbjbrCg,411
301
- beamlit-0.0.24rc18.dist-info/METADATA,sha256=0YDdLTLn8yDmAwzK9Mp4ubyUVklAvqF8O5_0T3wj_l4,2027
302
- beamlit-0.0.24rc18.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
303
- beamlit-0.0.24rc18.dist-info/RECORD,,
301
+ beamlit-0.0.24rc20.dist-info/METADATA,sha256=4MNBJTmEDnw74EEhTDiNOSbFwODc-BM1tarQjF32bFs,2027
302
+ beamlit-0.0.24rc20.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
303
+ beamlit-0.0.24rc20.dist-info/RECORD,,