chainlit 1.1.306__py3-none-any.whl → 1.1.400rc0__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.
Potentially problematic release.
This version of chainlit might be problematic. Click here for more details.
- chainlit/__init__.py +16 -3
- chainlit/config.py +4 -4
- chainlit/context.py +9 -0
- chainlit/copilot/dist/index.js +131 -129
- chainlit/data/__init__.py +2 -4
- chainlit/data/sql_alchemy.py +0 -4
- chainlit/discord/app.py +34 -6
- chainlit/emitter.py +5 -9
- chainlit/frontend/dist/assets/{DailyMotion-4ebdfef1.js → DailyMotion-5ec5da99.js} +1 -1
- chainlit/frontend/dist/assets/{Facebook-40982be3.js → Facebook-5a35cd37.js} +1 -1
- chainlit/frontend/dist/assets/{FilePlayer-5b3a4ad0.js → FilePlayer-57960f33.js} +1 -1
- chainlit/frontend/dist/assets/{Kaltura-6c5cb748.js → Kaltura-4e536514.js} +1 -1
- chainlit/frontend/dist/assets/{Mixcloud-7a304880.js → Mixcloud-dcf9d9d8.js} +1 -1
- chainlit/frontend/dist/assets/{Mux-1bd85c69.js → Mux-9eeb2f85.js} +1 -1
- chainlit/frontend/dist/assets/{Preview-e91eb05e.js → Preview-e47b3c35.js} +1 -1
- chainlit/frontend/dist/assets/{SoundCloud-2f2116b2.js → SoundCloud-ceb64ec3.js} +1 -1
- chainlit/frontend/dist/assets/{Streamable-b92c07ce.js → Streamable-917b74f2.js} +1 -1
- chainlit/frontend/dist/assets/{Twitch-58a2eb9a.js → Twitch-bb9e2900.js} +1 -1
- chainlit/frontend/dist/assets/{Vidyard-ad5bffa0.js → Vidyard-01a5b6c5.js} +1 -1
- chainlit/frontend/dist/assets/{Vimeo-8fb43e9c.js → Vimeo-c31b01d5.js} +1 -1
- chainlit/frontend/dist/assets/{Wistia-d03e6237.js → Wistia-17e84a59.js} +1 -1
- chainlit/frontend/dist/assets/{YouTube-6b7d1dae.js → YouTube-e58540d7.js} +1 -1
- chainlit/frontend/dist/assets/{index-4f01eb67.js → index-bfba5bbb.js} +103 -101
- chainlit/frontend/dist/assets/{react-plotly-ef3ac5f0.js → react-plotly-78a75e40.js} +1 -1
- chainlit/frontend/dist/index.html +1 -1
- chainlit/haystack/callbacks.py +1 -3
- chainlit/langchain/callbacks.py +0 -8
- chainlit/llama_index/callbacks.py +0 -6
- chainlit/message.py +0 -16
- chainlit/mistralai/__init__.py +2 -5
- chainlit/openai/__init__.py +0 -2
- chainlit/server.py +1 -1
- chainlit/session.py +2 -12
- chainlit/slack/app.py +18 -7
- chainlit/socket.py +10 -10
- chainlit/step.py +18 -26
- chainlit/teams/app.py +15 -6
- chainlit/user_session.py +0 -3
- {chainlit-1.1.306.dist-info → chainlit-1.1.400rc0.dist-info}/METADATA +1 -1
- chainlit-1.1.400rc0.dist-info/RECORD +81 -0
- chainlit-1.1.306.dist-info/RECORD +0 -81
- {chainlit-1.1.306.dist-info → chainlit-1.1.400rc0.dist-info}/WHEEL +0 -0
- {chainlit-1.1.306.dist-info → chainlit-1.1.400rc0.dist-info}/entry_points.txt +0 -0
chainlit/__init__.py
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import inspect
|
|
1
2
|
import os
|
|
2
3
|
|
|
3
4
|
from dotenv import load_dotenv
|
|
@@ -156,7 +157,15 @@ def on_message(func: Callable) -> Callable:
|
|
|
156
157
|
Callable[[str], Any]: The decorated on_message function.
|
|
157
158
|
"""
|
|
158
159
|
|
|
159
|
-
|
|
160
|
+
async def with_parent_id(message: Message):
|
|
161
|
+
async with Step(name="on_message", type="run", parent_id=message.id) as s:
|
|
162
|
+
s.input = message.content
|
|
163
|
+
if len(inspect.signature(func).parameters) > 0:
|
|
164
|
+
await func(message)
|
|
165
|
+
else:
|
|
166
|
+
await func()
|
|
167
|
+
|
|
168
|
+
config.code.on_message = wrap_user_function(with_parent_id)
|
|
160
169
|
return func
|
|
161
170
|
|
|
162
171
|
|
|
@@ -172,7 +181,9 @@ def on_chat_start(func: Callable) -> Callable:
|
|
|
172
181
|
Callable[], Any]: The decorated hook.
|
|
173
182
|
"""
|
|
174
183
|
|
|
175
|
-
config.code.on_chat_start = wrap_user_function(
|
|
184
|
+
config.code.on_chat_start = wrap_user_function(
|
|
185
|
+
step(func, name="on_chat_start", type="run"), with_task=True
|
|
186
|
+
)
|
|
176
187
|
return func
|
|
177
188
|
|
|
178
189
|
|
|
@@ -270,7 +281,9 @@ def on_audio_end(func: Callable) -> Callable:
|
|
|
270
281
|
Callable[], Any]: The decorated hook.
|
|
271
282
|
"""
|
|
272
283
|
|
|
273
|
-
config.code.on_audio_end = wrap_user_function(
|
|
284
|
+
config.code.on_audio_end = wrap_user_function(
|
|
285
|
+
step(func, name="on_audio_end", type="run"), with_task=True
|
|
286
|
+
)
|
|
274
287
|
return func
|
|
275
288
|
|
|
276
289
|
|
chainlit/config.py
CHANGED
|
@@ -103,8 +103,8 @@ name = "Assistant"
|
|
|
103
103
|
# Large size content are by default collapsed for a cleaner ui
|
|
104
104
|
default_collapse_content = true
|
|
105
105
|
|
|
106
|
-
#
|
|
107
|
-
|
|
106
|
+
# Chain of Thought (CoT) display mode. Can be "hidden", "tool_call" or "full".
|
|
107
|
+
cot = "full"
|
|
108
108
|
|
|
109
109
|
# Link to your github repo. This will add a github button in the UI's header.
|
|
110
110
|
# github = ""
|
|
@@ -240,14 +240,14 @@ class FeaturesSettings(DataClassJsonMixin):
|
|
|
240
240
|
latex: bool = False
|
|
241
241
|
unsafe_allow_html: bool = False
|
|
242
242
|
auto_tag_thread: bool = True
|
|
243
|
-
edit_message:bool = True
|
|
243
|
+
edit_message: bool = True
|
|
244
244
|
|
|
245
245
|
|
|
246
246
|
@dataclass()
|
|
247
247
|
class UISettings(DataClassJsonMixin):
|
|
248
248
|
name: str
|
|
249
249
|
description: str = ""
|
|
250
|
-
|
|
250
|
+
cot: Literal["hidden", "tool_call", "full"] = "full"
|
|
251
251
|
# Large size content are by default collapsed for a cleaner ui
|
|
252
252
|
default_collapse_content: bool = True
|
|
253
253
|
github: Optional[str] = None
|
chainlit/context.py
CHANGED
|
@@ -11,6 +11,8 @@ if TYPE_CHECKING:
|
|
|
11
11
|
from chainlit.step import Step
|
|
12
12
|
from chainlit.user import PersistedUser, User
|
|
13
13
|
|
|
14
|
+
CL_RUN_NAMES = ["on_chat_start", "on_message", "on_audio_end"]
|
|
15
|
+
|
|
14
16
|
|
|
15
17
|
class ChainlitContextException(Exception):
|
|
16
18
|
def __init__(self, msg="Chainlit context not found", *args, **kwargs):
|
|
@@ -28,6 +30,13 @@ class ChainlitContext:
|
|
|
28
30
|
if self.active_steps:
|
|
29
31
|
return self.active_steps[-1]
|
|
30
32
|
|
|
33
|
+
@property
|
|
34
|
+
def current_run(self):
|
|
35
|
+
if self.active_steps:
|
|
36
|
+
return next(
|
|
37
|
+
(step for step in self.active_steps if step.name in CL_RUN_NAMES), None
|
|
38
|
+
)
|
|
39
|
+
|
|
31
40
|
def __init__(
|
|
32
41
|
self,
|
|
33
42
|
session: Union["HTTPSession", "WebsocketSession"],
|