beamlit 0.0.24rc19__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.
beamlit/functions/decorator.py
CHANGED
@@ -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
|
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={
|
44
|
+
f" RESPONSE={content} ENVIRONMENT={settings.environment}"
|
42
45
|
)
|
43
|
-
|
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
|
@@ -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=
|
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.
|
302
|
-
beamlit-0.0.
|
303
|
-
beamlit-0.0.
|
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,,
|
File without changes
|