beamlit 0.0.22rc11__py3-none-any.whl → 0.0.22rc12__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.
beamlit/agents/chat.py CHANGED
@@ -37,12 +37,13 @@ def get_chat_model(agent_model: AgentDeployment):
37
37
  headers = get_authentication_headers(settings)
38
38
  headers["X-Beamlit-Environment"] = agent_model.environment
39
39
 
40
- jwt = headers.pop("X-Beamlit-Authorization").replace("Bearer ", "")
40
+ jwt = headers.get("X-Beamlit-Authorization", "").replace("Bearer ", "")
41
41
  params = {"environment": agent_model.environment}
42
42
  chat_classes = {
43
43
  "openai": {
44
44
  "func": get_openai_chat_model,
45
45
  "kwargs": {
46
+ "http_async_client": client.get_async_httpx_client(),
46
47
  "http_client": client.get_httpx_client(),
47
48
  },
48
49
  },
@@ -1,9 +1,11 @@
1
1
  # Import necessary modules
2
2
  import ast
3
+ import asyncio
3
4
  import importlib
4
5
  import os
5
6
  from logging import getLogger
6
7
 
8
+ from langchain_core.tools import Tool
7
9
  from langgraph.checkpoint.memory import MemorySaver
8
10
  from langgraph.prebuilt import create_react_agent
9
11
 
@@ -35,7 +37,7 @@ def get_functions(dir="src/functions", from_decorator="function"):
35
37
  # Look for function definitions with decorators
36
38
  for node in ast.walk(tree):
37
39
  if (
38
- not isinstance(node, ast.FunctionDef)
40
+ (not isinstance(node, ast.FunctionDef) and not isinstance(node, ast.AsyncFunctionDef))
39
41
  or len(node.decorator_list) == 0
40
42
  ):
41
43
  continue
@@ -73,7 +75,10 @@ def get_functions(dir="src/functions", from_decorator="function"):
73
75
  # Get the decorated function
74
76
  if not is_kit and hasattr(module, func_name):
75
77
  func = getattr(module, func_name)
76
- functions.append(func)
78
+ if asyncio.iscoroutinefunction(func):
79
+ functions.append(Tool(name=func.__name__, description=func.__doc__, func=func, coroutine=func))
80
+ else:
81
+ functions.append(Tool(name=func.__name__, description=func.__doc__, func=func))
77
82
  except Exception as e:
78
83
  logger.warning(f"Error processing {file_path}: {e!s}")
79
84
  return functions
@@ -51,7 +51,6 @@ def new_client():
51
51
  else:
52
52
  settings = get_settings()
53
53
  credentials = load_credentials_from_settings(settings)
54
-
55
54
  client_config = RunClientWithCredentials(
56
55
  credentials=credentials,
57
56
  workspace=settings.workspace,
@@ -130,7 +130,7 @@ def load_credentials(workspace_name: str) -> Credentials:
130
130
  def load_credentials_from_settings(settings: Settings) -> Credentials:
131
131
  return Credentials(
132
132
  api_key=settings.authentication.api_key,
133
- client_credentials=settings.authentication.client_credentials,
133
+ client_credentials=settings.authentication.client.credentials,
134
134
  )
135
135
 
136
136
 
beamlit/client.py CHANGED
@@ -248,7 +248,6 @@ class AuthenticatedClient:
248
248
  def get_async_httpx_client(self) -> httpx.AsyncClient:
249
249
  """Get the underlying httpx.AsyncClient, constructing a new one if not previously set"""
250
250
  if self._async_client is None:
251
- self._headers[self.auth_header_name] = f"{self.prefix} {self.token}" if self.prefix else self.token
252
251
  self._async_client = httpx.AsyncClient(
253
252
  base_url=self._base_url,
254
253
  cookies=self._cookies,
@@ -39,10 +39,14 @@ class SettingsAgent(BaseSettings):
39
39
  module: str = Field(default="main.main")
40
40
 
41
41
 
42
+ class SettingsAuthenticationClient(BaseSettings):
43
+ credentials: Union[None, str] = None
44
+
45
+
42
46
  class SettingsAuthentication(BaseSettings):
43
47
  api_key: Union[None, str] = None
44
48
  jwt: Union[None, str] = None
45
- client_credentials: Union[None, str] = None
49
+ client: SettingsAuthenticationClient = SettingsAuthenticationClient()
46
50
 
47
51
 
48
52
  class SettingsServer(BaseSettings):
@@ -56,6 +60,7 @@ class Settings(BaseSettings):
56
60
  yaml_file="beamlit.yaml",
57
61
  env_prefix="bl_",
58
62
  env_nested_delimiter="_",
63
+ extra="ignore",
59
64
  )
60
65
 
61
66
  workspace: str
@@ -3,7 +3,7 @@
3
3
  from collections.abc import Callable
4
4
  from logging import getLogger
5
5
 
6
- from langchain_core.tools import create_schema_from_function, tool
6
+ from langchain_core.tools import create_schema_from_function
7
7
 
8
8
  from beamlit.authentication import new_client
9
9
  from beamlit.common.settings import get_settings
@@ -58,7 +58,7 @@ def kit(bl_kit: FunctionKit = None, **kwargs: dict) -> Callable:
58
58
  def wrapper(func: Callable) -> Callable:
59
59
  if bl_kit and not func.__doc__ and bl_kit.description:
60
60
  func.__doc__ = bl_kit.description
61
- return tool(func, **kwargs)
61
+ return func
62
62
 
63
63
  return wrapper
64
64
 
@@ -83,8 +83,7 @@ def function(
83
83
  func,
84
84
  parse_docstring=func.__doc__,
85
85
  )
86
- return tool(remote_func, **kwargs)
87
- return tool(func, **kwargs)
86
+ return remote_func
87
+ return func
88
88
 
89
89
  return wrapper
90
- return wrapper
beamlit/serve/app.py CHANGED
@@ -16,7 +16,6 @@ from .middlewares import AccessLogMiddleware, AddProcessTimeHeader
16
16
  sys.path.insert(0, os.getcwd())
17
17
  sys.path.insert(0, os.path.join(os.getcwd(), "src"))
18
18
 
19
-
20
19
  def import_module():
21
20
  settings = get_settings()
22
21
  main_module = importlib.import_module(".".join(settings.server.module.split(".")[0:-1]))
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: beamlit
3
- Version: 0.0.22rc11
3
+ Version: 0.0.22rc12
4
4
  Summary: Add your description here
5
5
  Author-email: cploujoux <ch.ploujoux@gmail.com>
6
6
  Requires-Python: >=3.12
@@ -1,12 +1,12 @@
1
1
  beamlit/__init__.py,sha256=545gFC-wLLwUktWcOAjUWe_Glha40tBetRTOYSfHnbI,164
2
- beamlit/client.py,sha256=vwvjAkUKHRySnA2tOVzXI8xtm9s1k2sEklCRE4j1Vc8,12543
2
+ beamlit/client.py,sha256=OdRbs5VVHF32HUd5RMcnkhe8YxamnAmgGlxO6pm1Xac,12431
3
3
  beamlit/errors.py,sha256=gO8GBmKqmSNgAg-E5oT-oOyxztvp7V_6XG7OUTT15q0,546
4
4
  beamlit/py.typed,sha256=8ZJUsxZiuOy1oJeVhsTWQhTG_6pTVHVXk5hJL79ebTk,25
5
5
  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
- beamlit/agents/chat.py,sha256=8KsUvIB-eaUApfKclT76_4HQu3VBa9nifMqmq_AAvcM,2630
9
- beamlit/agents/decorator.py,sha256=naeOsvfto74TZTcc15Ro98Hl8Bbe6Uhflof_SdyUkwY,6054
8
+ beamlit/agents/chat.py,sha256=aI7pObyywRyg3dBpubzHAUWTbTk1nwtxvpY7iIP1RLY,2704
9
+ beamlit/agents/decorator.py,sha256=sN-JsLaPwiL-zzH5eZak76y3ObluIy8NFC3xpHFcDWc,6469
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
@@ -130,18 +130,18 @@ beamlit/api/workspaces/update_workspace.py,sha256=qa5DV2UJSUYuB_ibALb4E9ghKpT1Ha
130
130
  beamlit/api/workspaces/update_workspace_user_role.py,sha256=Yn9iuJ4tKtauzBiJyU4-wYUMS9g98X2Om8zs7UkzrY8,4917
131
131
  beamlit/authentication/__init__.py,sha256=wiXqRbc7E-ulrH_ueA9duOGFvXeo7-RvhSD1XbFogMo,1020
132
132
  beamlit/authentication/apikey.py,sha256=jnz1FMRauI5qAInqeeDER8aCONx4O8ZPZGedvi3Ap_o,659
133
- beamlit/authentication/authentication.py,sha256=om26AteY2cCV9ctqbOCynX6PgS8YO-aCreNOFSnnWKc,3121
133
+ beamlit/authentication/authentication.py,sha256=tZu8GoVueKDuq1RLXMvtHcV95XLikmQ19PCxLWBn2Ek,3120
134
134
  beamlit/authentication/clientcredentials.py,sha256=6kbfTjwUkXUArJX8XZLe9ZzbEicQc19tSXBvsTpiXMk,3954
135
- beamlit/authentication/credentials.py,sha256=DBw598T6it7EgXKnS_qfsBM0mkC33iRDadWA70bg5X0,5349
135
+ beamlit/authentication/credentials.py,sha256=DlfiF_FfOosPVsRoa39JSR3XoICmhBqTlHXc6b4zWtE,5349
136
136
  beamlit/authentication/device_mode.py,sha256=oQVBCDsq-pdeXF31WSTAAEdaX6eACV7SYcOSyf3ea_Q,3728
137
137
  beamlit/common/__init__.py,sha256=yDoMJDKj-xjTGl7U1YI59KpWxiOV65HSiUulgO8xdTA,277
138
138
  beamlit/common/generate.py,sha256=VJ_MiRDulXdQdnlKdM4_Bod6CO6DOGlFiosGXOLuLGs,7227
139
139
  beamlit/common/logger.py,sha256=ayabnsoHS8ncXm8EpBS01FkvSe0XRcaNdQjKVuPI5z4,1025
140
140
  beamlit/common/secrets.py,sha256=sid81bOe3LflkMKDHwBsBs9nIju8bp5-v9qU9gkyNMc,212
141
- beamlit/common/settings.py,sha256=7PDfLPzTPN5Yeh2NnmAlSzpBi_u-qza2lUIX-i6N_lg,5252
141
+ beamlit/common/settings.py,sha256=6iLf_7SZ8LV72ZU88ACfac0EcgtEf79rox1jOY7RmQE,5395
142
142
  beamlit/common/utils.py,sha256=jouz5igBvT37Xn_e94-foCHyQczVim-UzVcoIF6RWJ4,657
143
143
  beamlit/functions/__init__.py,sha256=_RPG1Bfg54JGdIPnViAU6n9zD7E1cDNsdXi8oYGskzE,138
144
- beamlit/functions/decorator.py,sha256=-2newMBztweIgFuh0ABKOdxCfUzWaRxf0ym-YAgggJI,3168
144
+ beamlit/functions/decorator.py,sha256=qThFujZ3RSSQ2g9kSjrVtPs9SVbgp_jB3w5XaQOvFvk,3095
145
145
  beamlit/functions/github/__init__.py,sha256=gYnUkeegukOfbymdabuuJkScvH-_ZJygX05BoqkPn0o,49
146
146
  beamlit/functions/github/github.py,sha256=FajzLCNkpXcwfgnC0l9rOGT2eSPLCz8-qrMzK9N_ZNc,598
147
147
  beamlit/functions/github/kit/__init__.py,sha256=jBwPqZv6C23_utukohxqXZwrlicNlI7PYPUj0Den7Cw,136
@@ -292,10 +292,10 @@ beamlit/models/websocket_channel.py,sha256=tyNtsVR0cOwd6BK--ehBCH8bIjxtyPhiAkrxY
292
292
  beamlit/models/workspace.py,sha256=s7wS6ibswosB0FdUb3ry3BnlLa325axBdYPLI3ipe0Q,3986
293
293
  beamlit/models/workspace_labels.py,sha256=WbnUY6eCTkUNdY7hhhSF-KQCl8fWFfkCf7hzCTiNp4A,1246
294
294
  beamlit/models/workspace_user.py,sha256=70CcifQWYbeWG7TDui4pblTzUe5sVK0AS19vNCzKE8g,3423
295
- beamlit/serve/app.py,sha256=-CvUU7pqFDigndHpA01IR4_mxXaT8c0VsnVjMfIw6K8,2399
295
+ beamlit/serve/app.py,sha256=_0ZesKcczd1sYm8vs3ulbXO1M1boO_5DhFf3jSmjM4g,2398
296
296
  beamlit/serve/middlewares/__init__.py,sha256=1dVmnOmhAQWvWktqHkKSIX-YoF6fmMU8xkUQuhg_rJU,148
297
297
  beamlit/serve/middlewares/accesslog.py,sha256=wM52-hcwtO-_hdM1pnsEJzerzJf1MzEyN5m85BdDccE,609
298
298
  beamlit/serve/middlewares/processtime.py,sha256=lDAaIasZ4bwvN-HKHvZpaD9r-yrkVNZYx4abvbjbrCg,411
299
- beamlit-0.0.22rc11.dist-info/METADATA,sha256=AOUr4a-4i_HzlZwKbn12EyaSvGR2BJFEFdzs4WXPqRw,2027
300
- beamlit-0.0.22rc11.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
301
- beamlit-0.0.22rc11.dist-info/RECORD,,
299
+ beamlit-0.0.22rc12.dist-info/METADATA,sha256=Ohm2SYy1zaC33jdWLTI-BD6ic7tKXEnYjw9daGN77Q8,2027
300
+ beamlit-0.0.22rc12.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
301
+ beamlit-0.0.22rc12.dist-info/RECORD,,