beamlit 0.0.37__py3-none-any.whl → 0.0.38rc82__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.
@@ -1,5 +1,5 @@
1
- from .chat import get_chat_model
1
+ from .chat import get_chat_model, get_chat_model_full
2
2
  from .decorator import agent
3
3
  from .thread import get_default_thread
4
4
 
5
- __all__ = ["agent", "get_chat_model", "get_default_thread"]
5
+ __all__ = ["agent", "get_chat_model", "get_chat_model_full", "get_default_thread"]
beamlit/agents/chat.py CHANGED
@@ -1,12 +1,11 @@
1
1
  from logging import getLogger
2
2
  from typing import Tuple, Union
3
3
 
4
- from langchain_core.language_models import BaseChatModel
5
-
6
4
  from beamlit.api.models import get_model
7
5
  from beamlit.authentication import get_authentication_headers, new_client
8
6
  from beamlit.common.settings import get_settings
9
7
  from beamlit.models import Model
8
+ from langchain_core.language_models import BaseChatModel
10
9
 
11
10
  logger = getLogger(__name__)
12
11
 
@@ -43,7 +42,16 @@ def get_cohere_chat_model(**kwargs):
43
42
 
44
43
  return ChatCohere(**kwargs)
45
44
 
46
- def get_chat_model(name: str, agent_model: Union[Model, None] = None) -> Tuple[BaseChatModel, str, str]:
45
+ def get_deepseek_chat_model(**kwargs):
46
+ from langchain_deepseek import ChatDeepSeek # type: ignore
47
+
48
+ return ChatDeepSeek(**kwargs)
49
+
50
+ def get_chat_model(name: str, agent_model: Union[Model, None] = None) -> BaseChatModel:
51
+ [chat_model, _, __] = get_chat_model_full(name, agent_model)
52
+ return chat_model
53
+
54
+ def get_chat_model_full(name: str, agent_model: Union[Model, None] = None) -> Tuple[BaseChatModel, str, str]:
47
55
  settings = get_settings()
48
56
  client = new_client()
49
57
 
@@ -91,6 +99,12 @@ def get_chat_model(name: str, agent_model: Union[Model, None] = None) -> Tuple[B
91
99
  "cohere_api_key": jwt,
92
100
  },
93
101
  },
102
+ "deepseek": {
103
+ "func": get_deepseek_chat_model,
104
+ "kwargs": {
105
+ "api_key": jwt,
106
+ },
107
+ },
94
108
  }
95
109
 
96
110
  provider = (
@@ -3,23 +3,23 @@ import functools
3
3
  import inspect
4
4
  from logging import getLogger
5
5
 
6
- from langgraph.checkpoint.memory import MemorySaver
7
- from langgraph.prebuilt import create_react_agent
8
-
9
6
  from beamlit.api.models import get_model, list_models
10
7
  from beamlit.authentication import new_client
11
8
  from beamlit.common.settings import init
12
9
  from beamlit.errors import UnexpectedStatus
13
10
  from beamlit.functions import get_functions
14
11
  from beamlit.models import Agent, AgentMetadata, AgentSpec
12
+ from langgraph.checkpoint.memory import MemorySaver
13
+ from langgraph.prebuilt import create_react_agent
15
14
 
16
- from .chat import get_chat_model
15
+ from .chat import get_chat_model_full
17
16
 
18
17
 
19
18
  def agent(
20
19
  agent: Agent | dict = None,
21
20
  override_model=None,
22
21
  override_agent=None,
22
+ override_functions=None,
23
23
  mcp_hub=None,
24
24
  remote_functions=None,
25
25
  ):
@@ -85,19 +85,23 @@ def agent(
85
85
  raise e
86
86
 
87
87
  if settings.agent.model:
88
- chat_model, provider, model = get_chat_model(agent.spec.model, settings.agent.model)
88
+ chat_model, provider, model = get_chat_model_full(agent.spec.model, settings.agent.model)
89
89
  settings.agent.chat_model = chat_model
90
90
  logger.info(f"Chat model configured, using: {provider}:{model}")
91
91
 
92
- functions = get_functions(
93
- client=client,
94
- dir=settings.agent.functions_directory,
95
- mcp_hub=mcp_hub,
96
- remote_functions=remote_functions,
97
- chain=agent.spec.agent_chain,
92
+ if override_functions is not None:
93
+ functions = override_functions
94
+ else:
95
+ functions = get_functions(
96
+ client=client,
97
+ dir=settings.agent.functions_directory,
98
+ mcp_hub=mcp_hub,
99
+ remote_functions=remote_functions,
100
+ chain=agent.spec.agent_chain,
98
101
  remote_functions_empty=not remote_functions,
99
102
  warning=chat_model is not None,
100
103
  )
104
+
101
105
  settings.agent.functions = functions
102
106
 
103
107
  if override_agent is None:
@@ -111,7 +115,7 @@ def agent(
111
115
  models_select = f"You can select one from the your models: {models}"
112
116
  except Exception:
113
117
  pass
114
-
118
+
115
119
  raise ValueError(f"You must provide a model.\n"
116
120
  f"{models_select}\n"
117
121
  f"You can create one at {settings.app_url}/{settings.workspace}/global-inference-network/models/create\n"
@@ -269,11 +269,11 @@ def instrument_app(app: FastAPI):
269
269
  if instrumentor_class:
270
270
  try:
271
271
  instrumentor_class().instrument()
272
- log.info(f"Successfully instrumented {name}")
272
+ log.debug(f"Successfully instrumented {name}")
273
273
  except Exception as e:
274
- log.error(f"Failed to instrument {name}: {str(e)}")
274
+ log.debug(f"Failed to instrument {name}: {str(e)}")
275
275
  else:
276
- log.error(f"Could not load instrumentor for {name}")
276
+ log.debug(f"Could not load instrumentor for {name}")
277
277
  else:
278
278
  log.debug(
279
279
  f"Skipping {name} instrumentation - required package '{required_package}' not installed"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: beamlit
3
- Version: 0.0.37
3
+ Version: 0.0.38rc82
4
4
  Summary: Add your description here
5
5
  Author-email: cploujoux <ch.ploujoux@gmail.com>
6
6
  Requires-Python: >=3.12
@@ -10,7 +10,7 @@ Requires-Dist: fastapi[standard]<0.116.0,>=0.115.4
10
10
  Requires-Dist: httpx<0.28.0,>=0.20.0
11
11
  Requires-Dist: langchain-community<0.4.0,>=0.3.3
12
12
  Requires-Dist: langchain-core<0.4.0,>=0.3.13
13
- Requires-Dist: langchain-openai<0.3.0,>=0.2.4
13
+ Requires-Dist: langchain-openai<0.4.0,>=0.3.0
14
14
  Requires-Dist: langgraph<0.3.0,>=0.2.40
15
15
  Requires-Dist: mcp>=1.1.2
16
16
  Requires-Dist: opentelemetry-api>=1.28.2
@@ -4,10 +4,10 @@ beamlit/errors.py,sha256=gO8GBmKqmSNgAg-E5oT-oOyxztvp7V_6XG7OUTT15q0,546
4
4
  beamlit/py.typed,sha256=8ZJUsxZiuOy1oJeVhsTWQhTG_6pTVHVXk5hJL79ebTk,25
5
5
  beamlit/run.py,sha256=HtDYDjD7oVfQ8r3T5_t4qN5UDJOJfsQILi45Z21ArAg,1446
6
6
  beamlit/types.py,sha256=E1hhDh_zXfsSQ0NCt9-uw90_Mr5iIlsdfnfvxv5HarU,1005
7
- beamlit/agents/__init__.py,sha256=4aXI1Sp8NuKJ8yVw9qUFRmFhSrWdT5b0bniqRKzZ42U,162
7
+ beamlit/agents/__init__.py,sha256=bWsFaXUbAps3IsL3Prti89m1s714vICXodbQi77h3vY,206
8
8
  beamlit/agents/chain.py,sha256=vfCjiFHuu02uTTGicxMlFzjyICQkIjpXrBGs-7uJEsg,2826
9
- beamlit/agents/chat.py,sha256=6PE2f_tf6l4_-9mZ---ZHvxN52pmLkHkgh1ebPoG1BY,4052
10
- beamlit/agents/decorator.py,sha256=_N5uYircuULo2EZ1B0vaD1Rsc64534DtojmUVAJGUAw,5921
9
+ beamlit/agents/chat.py,sha256=OflLpRrJjN9w4O2hW6u0tubjYA6ur73JKfj7ioSfrDk,4520
10
+ beamlit/agents/decorator.py,sha256=e9ajjak6fYrDBkQvfQhzHncYuxuDuEmpWdBbloG5ueE,6064
11
11
  beamlit/agents/thread.py,sha256=LN5Ss-uOf5_hdB0WV1dqpn-N-pDJB3C2hUvlCzdqtdk,519
12
12
  beamlit/api/__init__.py,sha256=zTSiG_ujSjAqWPyc435YXaX9XTlpMjiJWBbV-f-YtdA,45
13
13
  beamlit/api/agents/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -132,7 +132,7 @@ beamlit/authentication/credentials.py,sha256=p_1xenabCbQuRz7BiFk7oTK4uCxAt_zoyku
132
132
  beamlit/authentication/device_mode.py,sha256=LNHjoKe3u4TWApLKO34cJjN92UsVkHSYSbXr6eKxo64,3721
133
133
  beamlit/common/__init__.py,sha256=saX5X3hRCJ9erSlXuSkZ2VGgquvpgdcofAU_9sM4bCE,354
134
134
  beamlit/common/error.py,sha256=f9oJDFxhoHK-vpjxBgEp0NwWIk0N_THPemUI7uQxVzU,270
135
- beamlit/common/instrumentation.py,sha256=TKBbLNSPz0TKGufxSbVuLdJ9Tunh7-Y967SxwIX4j-o,9287
135
+ beamlit/common/instrumentation.py,sha256=L4Y6Xu7rQwIHngfp-d0LtWxReaPte6rIzykvkDaIyzE,9288
136
136
  beamlit/common/logger.py,sha256=nN_dSOl4bs13QU3Rod-w3e3jYOnlSrHx3_bs-ACY6Aw,1115
137
137
  beamlit/common/secrets.py,sha256=sid81bOe3LflkMKDHwBsBs9nIju8bp5-v9qU9gkyNMc,212
138
138
  beamlit/common/settings.py,sha256=OL1pZLB3BgN7QPCz9VR7gjYb-LoYpelilS7rU7FubCE,3962
@@ -285,6 +285,6 @@ beamlit/serve/app.py,sha256=ROS_tb9cO4GvOQKCwloyAzpYraTdIb3oG6sChXikeNw,3285
285
285
  beamlit/serve/middlewares/__init__.py,sha256=1dVmnOmhAQWvWktqHkKSIX-YoF6fmMU8xkUQuhg_rJU,148
286
286
  beamlit/serve/middlewares/accesslog.py,sha256=Mu4T4_9OvHybjA0ApzZFpgi2C8f3X1NbUk-76v634XM,631
287
287
  beamlit/serve/middlewares/processtime.py,sha256=lDAaIasZ4bwvN-HKHvZpaD9r-yrkVNZYx4abvbjbrCg,411
288
- beamlit-0.0.37.dist-info/METADATA,sha256=qJFiMr8EeCEeqoM8COtZf9cPo_IPrLZDbAKfUK8mRlI,3502
289
- beamlit-0.0.37.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
290
- beamlit-0.0.37.dist-info/RECORD,,
288
+ beamlit-0.0.38rc82.dist-info/METADATA,sha256=bAh_-6uEppvr_CBdGW8THTBI408jPaiTK_OC1aIBKoA,3506
289
+ beamlit-0.0.38rc82.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
290
+ beamlit-0.0.38rc82.dist-info/RECORD,,