beamlit 0.0.37__py3-none-any.whl → 0.0.38__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/__init__.py +2 -2
- beamlit/agents/chat.py +22 -4
- beamlit/agents/decorator.py +16 -12
- beamlit/common/instrumentation.py +3 -3
- {beamlit-0.0.37.dist-info → beamlit-0.0.38.dist-info}/METADATA +7 -2
- {beamlit-0.0.37.dist-info → beamlit-0.0.38.dist-info}/RECORD +7 -7
- {beamlit-0.0.37.dist-info → beamlit-0.0.38.dist-info}/WHEEL +0 -0
beamlit/agents/__init__.py
CHANGED
@@ -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
|
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
|
|
@@ -69,7 +77,10 @@ def get_chat_model(name: str, agent_model: Union[Model, None] = None) -> Tuple[B
|
|
69
77
|
},
|
70
78
|
"anthropic": {
|
71
79
|
"func": get_anthropic_chat_model,
|
72
|
-
"kwargs": {
|
80
|
+
"kwargs": {
|
81
|
+
"base_url": get_base_url(name).replace("/v1", ""),
|
82
|
+
},
|
83
|
+
"remove_kwargs": ["default_query"]
|
73
84
|
},
|
74
85
|
"mistral": {
|
75
86
|
"func": get_mistral_chat_model,
|
@@ -89,6 +100,13 @@ def get_chat_model(name: str, agent_model: Union[Model, None] = None) -> Tuple[B
|
|
89
100
|
"func": get_cohere_chat_model,
|
90
101
|
"kwargs": {
|
91
102
|
"cohere_api_key": jwt,
|
103
|
+
"base_url": get_base_url(name).replace("/v1", ""),
|
104
|
+
},
|
105
|
+
},
|
106
|
+
"deepseek": {
|
107
|
+
"func": get_deepseek_chat_model,
|
108
|
+
"kwargs": {
|
109
|
+
"api_key": jwt,
|
92
110
|
},
|
93
111
|
},
|
94
112
|
}
|
beamlit/agents/decorator.py
CHANGED
@@ -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
|
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 =
|
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
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
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.
|
272
|
+
log.debug(f"Successfully instrumented {name}")
|
273
273
|
except Exception as e:
|
274
|
-
log.
|
274
|
+
log.debug(f"Failed to instrument {name}: {str(e)}")
|
275
275
|
else:
|
276
|
-
log.
|
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.
|
3
|
+
Version: 0.0.38
|
4
4
|
Summary: Add your description here
|
5
5
|
Author-email: cploujoux <ch.ploujoux@gmail.com>
|
6
6
|
Requires-Python: >=3.12
|
@@ -8,9 +8,14 @@ Requires-Dist: asgi-correlation-id<5.0.0,>=4.3.4
|
|
8
8
|
Requires-Dist: attrs>=21.3.0
|
9
9
|
Requires-Dist: fastapi[standard]<0.116.0,>=0.115.4
|
10
10
|
Requires-Dist: httpx<0.28.0,>=0.20.0
|
11
|
+
Requires-Dist: langchain-anthropic>=0.3.4
|
12
|
+
Requires-Dist: langchain-cohere>=0.4.2
|
11
13
|
Requires-Dist: langchain-community<0.4.0,>=0.3.3
|
12
14
|
Requires-Dist: langchain-core<0.4.0,>=0.3.13
|
13
|
-
Requires-Dist: langchain-
|
15
|
+
Requires-Dist: langchain-deepseek-official>=0.1.0
|
16
|
+
Requires-Dist: langchain-mistralai>=0.2.5
|
17
|
+
Requires-Dist: langchain-openai<0.4.0,>=0.3.0
|
18
|
+
Requires-Dist: langchain-xai>=0.2.0
|
14
19
|
Requires-Dist: langgraph<0.3.0,>=0.2.40
|
15
20
|
Requires-Dist: mcp>=1.1.2
|
16
21
|
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=
|
7
|
+
beamlit/agents/__init__.py,sha256=bWsFaXUbAps3IsL3Prti89m1s714vICXodbQi77h3vY,206
|
8
8
|
beamlit/agents/chain.py,sha256=vfCjiFHuu02uTTGicxMlFzjyICQkIjpXrBGs-7uJEsg,2826
|
9
|
-
beamlit/agents/chat.py,sha256=
|
10
|
-
beamlit/agents/decorator.py,sha256=
|
9
|
+
beamlit/agents/chat.py,sha256=5iv6dM7Xlg2oP2cGgAlpFreJl4P8GZAiN8MM3v0YVYs,4714
|
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=
|
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.
|
289
|
-
beamlit-0.0.
|
290
|
-
beamlit-0.0.
|
288
|
+
beamlit-0.0.38.dist-info/METADATA,sha256=of74Mv_sPBES0fa5d1vARpRk_BhCe-N7WnkzHvG7O8Y,3711
|
289
|
+
beamlit-0.0.38.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
290
|
+
beamlit-0.0.38.dist-info/RECORD,,
|
File without changes
|