beamlit 0.0.57rc115__py3-none-any.whl → 0.0.57rc117__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
@@ -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
  from .voice.openai import OpenAIVoiceReactAgent
12
11
 
@@ -120,6 +119,14 @@ def get_azure_marketplace_chat_model(**kwargs):
120
119
  **kwargs
121
120
  ) # It seems to use a compatible endpoint, so we can use the classic OpenAI interface
122
121
 
122
+ def get_gemini_chat_model(**kwargs):
123
+ from langchain_google_genai import ChatGoogleGenerativeAI # type: ignore
124
+
125
+ print(kwargs)
126
+ return ChatGoogleGenerativeAI(
127
+ **kwargs,
128
+ )
129
+
123
130
  def get_chat_model(name: str, agent_model: Union[Model, None] = None) -> BaseChatModel:
124
131
  """
125
132
  Gets a chat model instance for the specified model name.
@@ -215,6 +222,19 @@ def get_chat_model_full(name: str, agent_model: Union[Model, None] = None) -> Tu
215
222
  "func": get_azure_marketplace_chat_model,
216
223
  "kwargs": {},
217
224
  },
225
+ "gemini": {
226
+ "func": get_gemini_chat_model,
227
+ "kwargs": {
228
+ "api_key": "fake_api_key",
229
+ "client_options": {
230
+ # "api_endpoint": get_base_url(name).replace("/v1", "")
231
+ "api_endpoint": f"http://localhost:8787/{settings.workspace}/models/{name}",
232
+ },
233
+ "transport": "rest",
234
+ "additional_headers": {"X-Beamlit-Authorization": f"Bearer {jwt}"},
235
+ },
236
+ "remove_kwargs": ["api_key", "default_headers"]
237
+ },
218
238
  }
219
239
 
220
240
  provider = (
@@ -10,15 +10,14 @@ import inspect
10
10
  from logging import getLogger
11
11
  from typing import Callable
12
12
 
13
- from langgraph.checkpoint.memory import MemorySaver
14
- from langgraph.prebuilt import create_react_agent
15
-
16
13
  from beamlit.api.models import get_model, list_models
17
14
  from beamlit.authentication import new_client
18
15
  from beamlit.common.settings import Settings, init
19
16
  from beamlit.errors import UnexpectedStatus
20
17
  from beamlit.functions import get_functions
21
18
  from beamlit.models import Agent, AgentSpec, Metadata
19
+ from langgraph.checkpoint.memory import MemorySaver
20
+ from langgraph.prebuilt import create_react_agent
22
21
 
23
22
  from .chat import get_chat_model_full
24
23
  from .voice.openai import OpenAIVoiceReactAgent
@@ -116,7 +115,7 @@ async def initialize_agent(
116
115
  _agent = create_react_agent(chat_model, functions, checkpointer=memory, state_modifier=agent.spec.prompt or "")
117
116
  except AttributeError: # special case for azure-marketplace where it uses the old OpenAI interface (no tools)
118
117
  logger.warning("Using the old OpenAI interface for Azure Marketplace, no tools available")
119
- _agent = create_react_agent(chat_model, [], checkpointer=memory, state_modifier=agent.spec.prompt or "")
118
+ _agent = create_react_agent(chat_model, [], checkpointer=memory, state_modifier=(agent and agent.spec and agent.spec.prompt) or "")
120
119
 
121
120
  settings.agent.agent = _agent
122
121
  else:
beamlit/agents/thread.py CHANGED
@@ -20,14 +20,6 @@ def get_default_thread(request: Request) -> str:
20
20
  """
21
21
  if request.headers.get("X-Beamlit-Thread-Id"):
22
22
  return request.headers.get("X-Beamlit-Thread-Id")
23
- if request.headers.get("X-Beamlit-Sub"):
24
- return request.headers.get("X-Beamlit-Sub")
25
- authorization = request.headers.get("Authorization", request.headers.get("X-Beamlit-Authorization"))
26
- if authorization and len(authorization.split("Bearer ")) > 1:
27
- try:
28
- token = authorization.split(" ")[1]
29
- decoded = jwt.decode(token, options={"verify_signature": False})
30
- return decoded["sub"]
31
- except Exception:
32
- return ""
33
- return ""
23
+ if request.headers.get("Thread-Id"):
24
+ return request.headers.get("Thread-Id")
25
+ return ""
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: beamlit
3
- Version: 0.0.57rc115
3
+ Version: 0.0.57rc117
4
4
  Summary: Add your description here
5
5
  Author-email: cploujoux <ch.ploujoux@gmail.com>
6
6
  License-File: LICENSE
@@ -6,9 +6,9 @@ beamlit/run.py,sha256=YMI8iTPB1M9gd_1FG958tw-Prf9EwIcca4jK4igi7MM,4448
6
6
  beamlit/types.py,sha256=E1hhDh_zXfsSQ0NCt9-uw90_Mr5iIlsdfnfvxv5HarU,1005
7
7
  beamlit/agents/__init__.py,sha256=bWsFaXUbAps3IsL3Prti89m1s714vICXodbQi77h3vY,206
8
8
  beamlit/agents/chain.py,sha256=JsinjAYBr3oaM4heouZaiaV2jMmi779LHAMtD_4P59s,4867
9
- beamlit/agents/chat.py,sha256=ufuydptucLNe_Jyr7lQO1WfQ5pe0I5YKh-y0smwWABM,8301
10
- beamlit/agents/decorator.py,sha256=yRxzrLOMhXW0S4ThRD7cm6UqUarw6gdB_ZP2jnZanvM,8311
11
- beamlit/agents/thread.py,sha256=fbQUsnEOPqr-E-Gx-YhmP-c26XCpjqDeVdbNbqdGpDE,1196
9
+ beamlit/agents/chat.py,sha256=3yd5ptQ-TlHGkK1GQ4Gw69YmhtuQCxtlpuBsCMiJ2Kw,9059
10
+ beamlit/agents/decorator.py,sha256=wgdbgJ65LfmhldGWxG8PBYU_7datnVpqKRzom6Ok3GU,8337
11
+ beamlit/agents/thread.py,sha256=QecahZCH8_U91cvCw2X6cYn9N1liVXVl3u3lFxVDdNg,798
12
12
  beamlit/agents/voice/openai.py,sha256=-RDBwl16i4TbUhFo5-77Ci3zmI3Y8U2yf2MmvXR2haQ,9479
13
13
  beamlit/agents/voice/utils.py,sha256=tQidyM40Ewuy12wKqpvJLvfJgneQ0sZf50dqnerPGHg,836
14
14
  beamlit/api/__init__.py,sha256=zTSiG_ujSjAqWPyc435YXaX9XTlpMjiJWBbV-f-YtdA,45
@@ -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.57rc115.dist-info/METADATA,sha256=-4QXAnnZZ9N1D6GkBoJnpIbzthjSFdu9TLQY_NpJraI,3547
258
- beamlit-0.0.57rc115.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
259
- beamlit-0.0.57rc115.dist-info/entry_points.txt,sha256=zxhgdn7SP-Otk4rEv7LMPAAa9w4TUCLbu9TJi9-K3xg,115
260
- beamlit-0.0.57rc115.dist-info/licenses/LICENSE,sha256=p5PNQvpvyDT_0aYBDgmV1fFI_vAD2aSV0wWG7VTgRis,1069
261
- beamlit-0.0.57rc115.dist-info/RECORD,,
257
+ beamlit-0.0.57rc117.dist-info/METADATA,sha256=bFmOkATbRNyO8DL3GQ9k61uWV9wnm8vOBEtMV8ndpWE,3547
258
+ beamlit-0.0.57rc117.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
259
+ beamlit-0.0.57rc117.dist-info/entry_points.txt,sha256=zxhgdn7SP-Otk4rEv7LMPAAa9w4TUCLbu9TJi9-K3xg,115
260
+ beamlit-0.0.57rc117.dist-info/licenses/LICENSE,sha256=p5PNQvpvyDT_0aYBDgmV1fFI_vAD2aSV0wWG7VTgRis,1069
261
+ beamlit-0.0.57rc117.dist-info/RECORD,,