chainlit 1.0.0rc1__py3-none-any.whl → 1.0.0rc3__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/data/__init__.py +10 -2
- chainlit/element.py +4 -1
- chainlit/emitter.py +18 -9
- chainlit/frontend/dist/assets/{index-6aee009a.js → index-15bb372a.js} +116 -116
- chainlit/frontend/dist/assets/{index-8942cb2d.css → index-d088547c.css} +1 -1
- chainlit/frontend/dist/assets/{react-plotly-2f07c02a.js → react-plotly-c9578a93.js} +1 -1
- chainlit/frontend/dist/index.html +2 -2
- chainlit/message.py +2 -2
- chainlit/playground/providers/langchain.py +1 -1
- chainlit/playground/providers/openai.py +0 -2
- chainlit/server.py +5 -2
- chainlit/session.py +1 -1
- chainlit/socket.py +3 -2
- chainlit/step.py +17 -2
- {chainlit-1.0.0rc1.dist-info → chainlit-1.0.0rc3.dist-info}/METADATA +4 -3
- {chainlit-1.0.0rc1.dist-info → chainlit-1.0.0rc3.dist-info}/RECORD +18 -18
- {chainlit-1.0.0rc1.dist-info → chainlit-1.0.0rc3.dist-info}/WHEEL +0 -0
- {chainlit-1.0.0rc1.dist-info → chainlit-1.0.0rc3.dist-info}/entry_points.txt +0 -0
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
<script>
|
|
21
21
|
const global = globalThis;
|
|
22
22
|
</script>
|
|
23
|
-
<script type="module" crossorigin src="/assets/index-
|
|
24
|
-
<link rel="stylesheet" href="/assets/index-
|
|
23
|
+
<script type="module" crossorigin src="/assets/index-15bb372a.js"></script>
|
|
24
|
+
<link rel="stylesheet" href="/assets/index-d088547c.css">
|
|
25
25
|
</head>
|
|
26
26
|
<body>
|
|
27
27
|
<div id="root"></div>
|
chainlit/message.py
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import asyncio
|
|
2
2
|
import json
|
|
3
|
+
import time
|
|
3
4
|
import uuid
|
|
4
5
|
from abc import ABC
|
|
5
6
|
from datetime import datetime
|
|
@@ -146,7 +147,6 @@ class MessageBase(ABC):
|
|
|
146
147
|
async def send(self):
|
|
147
148
|
if not self.created_at:
|
|
148
149
|
self.created_at = datetime.utcnow().isoformat()
|
|
149
|
-
|
|
150
150
|
if self.content is None:
|
|
151
151
|
self.content = ""
|
|
152
152
|
|
|
@@ -157,7 +157,6 @@ class MessageBase(ABC):
|
|
|
157
157
|
self.streaming = False
|
|
158
158
|
|
|
159
159
|
step_dict = await self._create()
|
|
160
|
-
|
|
161
160
|
await context.emitter.send_step(step_dict)
|
|
162
161
|
|
|
163
162
|
return self.id
|
|
@@ -209,6 +208,7 @@ class Message(MessageBase):
|
|
|
209
208
|
id: Optional[str] = None,
|
|
210
209
|
created_at: Union[str, None] = None,
|
|
211
210
|
):
|
|
211
|
+
time.sleep(0.001)
|
|
212
212
|
self.language = language
|
|
213
213
|
|
|
214
214
|
if isinstance(content, dict):
|
|
@@ -56,7 +56,7 @@ class LangchainGenericProvider(BaseProvider):
|
|
|
56
56
|
return self.prompt_message_to_langchain_message(message)
|
|
57
57
|
|
|
58
58
|
def message_to_string(self, message: BaseMessage) -> str: # type: ignore[override]
|
|
59
|
-
return message.content
|
|
59
|
+
return str(message.content)
|
|
60
60
|
|
|
61
61
|
async def create_completion(self, request):
|
|
62
62
|
from langchain.schema.messages import BaseMessageChunk
|
|
@@ -237,7 +237,6 @@ class AzureOpenAIProvider(BaseProvider):
|
|
|
237
237
|
api_version=env_settings["api_version"],
|
|
238
238
|
azure_endpoint=env_settings["azure_endpoint"],
|
|
239
239
|
azure_ad_token=self.get_var(request, "AZURE_AD_TOKEN"),
|
|
240
|
-
azure_ad_token_provider=self.get_var(request, "AZURE_AD_TOKEN_PROVIDER"),
|
|
241
240
|
azure_deployment=self.get_var(request, "AZURE_DEPLOYMENT"),
|
|
242
241
|
)
|
|
243
242
|
llm_settings = request.generation.settings
|
|
@@ -290,7 +289,6 @@ class AzureChatOpenAIProvider(BaseProvider):
|
|
|
290
289
|
api_version=env_settings["api_version"],
|
|
291
290
|
azure_endpoint=env_settings["azure_endpoint"],
|
|
292
291
|
azure_ad_token=self.get_var(request, "AZURE_AD_TOKEN"),
|
|
293
|
-
azure_ad_token_provider=self.get_var(request, "AZURE_AD_TOKEN_PROVIDER"),
|
|
294
292
|
azure_deployment=self.get_var(request, "AZURE_DEPLOYMENT"),
|
|
295
293
|
)
|
|
296
294
|
|
chainlit/server.py
CHANGED
|
@@ -3,7 +3,7 @@ import json
|
|
|
3
3
|
import mimetypes
|
|
4
4
|
import shutil
|
|
5
5
|
import urllib.parse
|
|
6
|
-
from typing import Optional, Union
|
|
6
|
+
from typing import Any, Optional, Union
|
|
7
7
|
|
|
8
8
|
from chainlit.oauth_providers import get_oauth_provider
|
|
9
9
|
from chainlit.secret import random_secret
|
|
@@ -317,7 +317,10 @@ async def oauth_login(provider_id: str, request: Request):
|
|
|
317
317
|
response = RedirectResponse(
|
|
318
318
|
url=f"{provider.authorize_url}?{params}",
|
|
319
319
|
)
|
|
320
|
-
|
|
320
|
+
samesite = os.environ.get("CHAINLIT_COOKIE_SAMESITE", "lax") # type: Any
|
|
321
|
+
response.set_cookie(
|
|
322
|
+
"oauth_state", random, httponly=True, samesite=samesite, max_age=3 * 60
|
|
323
|
+
)
|
|
321
324
|
return response
|
|
322
325
|
|
|
323
326
|
|
chainlit/session.py
CHANGED
|
@@ -56,7 +56,7 @@ class BaseSession:
|
|
|
56
56
|
self.user = user
|
|
57
57
|
self.token = token
|
|
58
58
|
self.root_message = root_message
|
|
59
|
-
self.
|
|
59
|
+
self.has_first_interaction = False
|
|
60
60
|
self.user_env = user_env or {}
|
|
61
61
|
self.chat_profile = chat_profile
|
|
62
62
|
self.active_steps = []
|
chainlit/socket.py
CHANGED
|
@@ -138,8 +138,9 @@ async def connection_successful(sid):
|
|
|
138
138
|
if context.session.thread_id_to_resume and config.code.on_chat_resume:
|
|
139
139
|
thread = await resume_thread(context.session)
|
|
140
140
|
if thread:
|
|
141
|
-
context.session.
|
|
141
|
+
context.session.has_first_interaction = True
|
|
142
142
|
await context.emitter.clear_ask()
|
|
143
|
+
await context.emitter.emit("first_interaction", "resume")
|
|
143
144
|
await context.emitter.resume_thread(thread)
|
|
144
145
|
await config.code.on_chat_resume(thread)
|
|
145
146
|
return
|
|
@@ -173,7 +174,7 @@ async def disconnect(sid):
|
|
|
173
174
|
if config.code.on_chat_end and session:
|
|
174
175
|
await config.code.on_chat_end()
|
|
175
176
|
|
|
176
|
-
if session and session.thread_id and session.
|
|
177
|
+
if session and session.thread_id and session.has_first_interaction:
|
|
177
178
|
await persist_user_session(session.thread_id, session.to_persistable())
|
|
178
179
|
|
|
179
180
|
async def disconnect_on_timeout(sid):
|
chainlit/step.py
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import asyncio
|
|
2
2
|
import inspect
|
|
3
3
|
import json
|
|
4
|
+
import time
|
|
4
5
|
import uuid
|
|
5
6
|
from datetime import datetime
|
|
6
7
|
from functools import wraps
|
|
@@ -158,6 +159,7 @@ class Step:
|
|
|
158
159
|
show_input: Union[bool, str] = False,
|
|
159
160
|
):
|
|
160
161
|
trace_event(f"init {self.__class__.__name__} {type}")
|
|
162
|
+
time.sleep(0.001)
|
|
161
163
|
self._input = ""
|
|
162
164
|
self._output = ""
|
|
163
165
|
self.thread_id = context.session.thread_id
|
|
@@ -264,6 +266,9 @@ class Step:
|
|
|
264
266
|
tasks = [el.send(for_id=self.id) for el in self.elements]
|
|
265
267
|
await asyncio.gather(*tasks)
|
|
266
268
|
|
|
269
|
+
if config.ui.hide_cot and self.parent_id:
|
|
270
|
+
return
|
|
271
|
+
|
|
267
272
|
if not config.features.prompt_playground and "generation" in step_dict:
|
|
268
273
|
step_dict.pop("generation", None)
|
|
269
274
|
|
|
@@ -318,6 +323,9 @@ class Step:
|
|
|
318
323
|
tasks = [el.send(for_id=self.id) for el in self.elements]
|
|
319
324
|
await asyncio.gather(*tasks)
|
|
320
325
|
|
|
326
|
+
if config.ui.hide_cot and self.parent_id:
|
|
327
|
+
return self.id
|
|
328
|
+
|
|
321
329
|
if not config.features.prompt_playground and "generation" in step_dict:
|
|
322
330
|
step_dict.pop("generation", None)
|
|
323
331
|
|
|
@@ -342,6 +350,10 @@ class Step:
|
|
|
342
350
|
self.output += token
|
|
343
351
|
|
|
344
352
|
assert self.id
|
|
353
|
+
|
|
354
|
+
if config.ui.hide_cot and self.parent_id:
|
|
355
|
+
return
|
|
356
|
+
|
|
345
357
|
await context.emitter.send_token(
|
|
346
358
|
id=self.id, token=token, is_sequence=is_sequence
|
|
347
359
|
)
|
|
@@ -372,7 +384,9 @@ class Step:
|
|
|
372
384
|
|
|
373
385
|
async def __aexit__(self, exc_type, exc_val, exc_tb):
|
|
374
386
|
self.end = datetime.utcnow().isoformat()
|
|
375
|
-
|
|
387
|
+
|
|
388
|
+
if self in context.session.active_steps:
|
|
389
|
+
context.session.active_steps.remove(self)
|
|
376
390
|
await self.update()
|
|
377
391
|
|
|
378
392
|
def __enter__(self):
|
|
@@ -389,5 +403,6 @@ class Step:
|
|
|
389
403
|
|
|
390
404
|
def __exit__(self, exc_type, exc_val, exc_tb):
|
|
391
405
|
self.end = datetime.utcnow().isoformat()
|
|
392
|
-
context.session.active_steps
|
|
406
|
+
if self in context.session.active_steps:
|
|
407
|
+
context.session.active_steps.remove(self)
|
|
393
408
|
asyncio.create_task(self.update())
|
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: chainlit
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.0rc3
|
|
4
4
|
Summary: A faster way to build chatbot UIs.
|
|
5
5
|
Home-page: https://github.com/Chainlit/chainlit
|
|
6
6
|
License: Apache-2.0 license
|
|
7
7
|
Keywords: LLM,Agents,gen ai,chat ui,chatbot ui,langchain
|
|
8
8
|
Author: Chainlit
|
|
9
|
-
Requires-Python: >=3.8.1,<
|
|
9
|
+
Requires-Python: >=3.8.1,<4.0.0
|
|
10
10
|
Classifier: License :: Other/Proprietary License
|
|
11
11
|
Classifier: Programming Language :: Python :: 3
|
|
12
12
|
Classifier: Programming Language :: Python :: 3.9
|
|
13
13
|
Classifier: Programming Language :: Python :: 3.10
|
|
14
14
|
Classifier: Programming Language :: Python :: 3.11
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
15
16
|
Requires-Dist: aiofiles (>=23.1.0,<24.0.0)
|
|
16
17
|
Requires-Dist: asyncer (>=0.0.2,<0.0.3)
|
|
17
|
-
Requires-Dist: chainlit_client (==0.1.
|
|
18
|
+
Requires-Dist: chainlit_client (==0.1.0rc7)
|
|
18
19
|
Requires-Dist: click (>=8.1.3,<9.0.0)
|
|
19
20
|
Requires-Dist: dataclasses_json (>=0.5.7,<0.6.0)
|
|
20
21
|
Requires-Dist: fastapi (>=0.100,<0.101)
|
|
@@ -8,17 +8,17 @@ chainlit/cli/__init__.py,sha256=aMynTbqbJEvxkoIzDjsdKL6wJ0HFgLfVrbxFkwqp1FU,4733
|
|
|
8
8
|
chainlit/cli/utils.py,sha256=mE2d9oOk-B2b9ZvDV1zENoDWxjfMriGP7bVwEFduZP4,717
|
|
9
9
|
chainlit/config.py,sha256=2DaQ51jHKHdwAH0yNbB3HkJhccU99eOqDXxvk19A1jU,10577
|
|
10
10
|
chainlit/context.py,sha256=Su3eabnD2sgLNx5IwlxEpG4pev64GLi-GlvbE5Mw7sM,2264
|
|
11
|
-
chainlit/data/__init__.py,sha256=
|
|
11
|
+
chainlit/data/__init__.py,sha256=UEIkeNn1b51OZlrfcXvKr9zuJFUw0LcLP8auvaT16nY,13142
|
|
12
12
|
chainlit/data/acl.py,sha256=hx7Othkx12EitonyZD4iFIRVHwxBmBY2TKdwjPuZMSo,461
|
|
13
|
-
chainlit/element.py,sha256=
|
|
14
|
-
chainlit/emitter.py,sha256=
|
|
15
|
-
chainlit/frontend/dist/assets/index-
|
|
16
|
-
chainlit/frontend/dist/assets/index-
|
|
13
|
+
chainlit/element.py,sha256=cjQDuCSv4OSI2Z0q9JNJf4jn08dAcym6jX8iiHaZrKA,10123
|
|
14
|
+
chainlit/emitter.py,sha256=JJNLCOJH8wn4ai1pvs6jCKLUFLMvZfTgGEzVPdAZ2FA,11105
|
|
15
|
+
chainlit/frontend/dist/assets/index-15bb372a.js,sha256=anV6Q0TCuk8ryrP7gLPQ7B3GjYZbWREJWtO2YfATxJQ,3097023
|
|
16
|
+
chainlit/frontend/dist/assets/index-d088547c.css,sha256=0IhUfCm_IY1kjvlTR2edW1qKXAFDya3LZ6mnZnP6ovk,6605
|
|
17
17
|
chainlit/frontend/dist/assets/logo_dark-bc7401f6.svg,sha256=vHQB9g-n5OqOmuH3Fduuc7ZMg0EmMsGyO9cEnYwLbHg,8889
|
|
18
18
|
chainlit/frontend/dist/assets/logo_light-f19fc2ea.svg,sha256=8Z_C6t-0V9QL9ldmLjaLfp2REcGDuaTeNynj6-6muNI,8891
|
|
19
|
-
chainlit/frontend/dist/assets/react-plotly-
|
|
19
|
+
chainlit/frontend/dist/assets/react-plotly-c9578a93.js,sha256=LwxrfZi-6Hy97YEflna7FLEhRCH-NtdWIVh_rt1aLes,3739251
|
|
20
20
|
chainlit/frontend/dist/favicon.svg,sha256=0Cy8x28obT5eWW3nxZRhsEvu6_zMqrqbg0y6hT3D0Q0,6455
|
|
21
|
-
chainlit/frontend/dist/index.html,sha256=
|
|
21
|
+
chainlit/frontend/dist/index.html,sha256=MyFb8vlkUbrqhtDzFDyhogbwMNWnSz4GCT680Tf2HjA,959
|
|
22
22
|
chainlit/haystack/__init__.py,sha256=uZ77YiPy-qleSTi3dQCDO9HE6S6F6GpJWmh7jO4cxXA,217
|
|
23
23
|
chainlit/haystack/callbacks.py,sha256=0tbevNVa5hqN7Num6PGwm_DU_-ZdhfsVp9srKciotNE,4055
|
|
24
24
|
chainlit/hello.py,sha256=LwENQWo5s5r8nNDn4iKSV77vX60Ky5r_qGjQhyi7qlY,416
|
|
@@ -30,7 +30,7 @@ chainlit/llama_index/__init__.py,sha256=c7wIUZmKTtZPU9zpdGpKTHctQaBWTuRGqTN0kkIk
|
|
|
30
30
|
chainlit/llama_index/callbacks.py,sha256=BAFyoL2VkoG5pt6_GHMJ58Xu39_T-trhBYL14XVsvWU,5595
|
|
31
31
|
chainlit/logger.py,sha256=wTwRSZsLfXwWy6U4351IgWAm4KCMThgxm9EZpjGUEr4,373
|
|
32
32
|
chainlit/markdown.py,sha256=L2IPPWxIlrhJZcKPfO1akomHdN3sgC2EvC2ilxR8MQs,1624
|
|
33
|
-
chainlit/message.py,sha256
|
|
33
|
+
chainlit/message.py,sha256=UGT22iZgWi99IfgXwvbbc7_HOEfQxZYOHynOZClaeUc,17506
|
|
34
34
|
chainlit/oauth_providers.py,sha256=M-kV0rq4HwhDHvzdVc7YvAV4xPj5ecHvWniMMUTJAOM,15209
|
|
35
35
|
chainlit/playground/__init__.py,sha256=igNRcBgqLKPTjOQtTNhhGNJFmZn-Dl1fHRQzQSjDGTQ,80
|
|
36
36
|
chainlit/playground/config.py,sha256=a6fnIU2IrYQDKU6zHF8qUD3ssUBD9UiTEN10pMxgnGY,998
|
|
@@ -38,15 +38,15 @@ chainlit/playground/provider.py,sha256=mO4mC--c4LXOYWBvNWse90iTD3288yd5TVuIeqSVO
|
|
|
38
38
|
chainlit/playground/providers/__init__.py,sha256=L4Y7Udpexm769Jnf-mIeN-YGh6xaaMjF3rPxSfReiN4,225
|
|
39
39
|
chainlit/playground/providers/anthropic.py,sha256=Fcozvo4I_hguOuQbI4XgdR8Y03SNNv9PhHZrVXm_4ZE,3447
|
|
40
40
|
chainlit/playground/providers/huggingface.py,sha256=AmBmIzvfqBjswEI40jifb0OrMQkTk5rXCkGX7nMJ-bk,2130
|
|
41
|
-
chainlit/playground/providers/langchain.py,sha256=
|
|
42
|
-
chainlit/playground/providers/openai.py,sha256=
|
|
41
|
+
chainlit/playground/providers/langchain.py,sha256=tS4z66CZKdT9ZzwbyrfcpBIzpjD3vS0r6kp8v0xjlMY,2818
|
|
42
|
+
chainlit/playground/providers/openai.py,sha256=ch2Eyoz696YJ6H2P1dT6n9RAw-PsiBLVK2_MhgEEcFo,12421
|
|
43
43
|
chainlit/playground/providers/vertexai.py,sha256=TwFyhNmbStUso0ShvoRzOQ5b4l8ErG1szxqjv4IRXE0,3678
|
|
44
44
|
chainlit/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
45
45
|
chainlit/secret.py,sha256=0MXq8YxTeL93K8IyAew5UgZmIIw9_yJ_Kg4iML6cdVM,296
|
|
46
|
-
chainlit/server.py,sha256=
|
|
47
|
-
chainlit/session.py,sha256=
|
|
48
|
-
chainlit/socket.py,sha256=
|
|
49
|
-
chainlit/step.py,sha256=
|
|
46
|
+
chainlit/server.py,sha256=CEA1pt_RKhDxkE9tWvYvfOGRZ2A0oWMnPEsOO0Y-3eY,20788
|
|
47
|
+
chainlit/session.py,sha256=WsTZYIKaMiCpXcxPHd2tKnhL6lk4mVdExwFPPqAUVbo,8341
|
|
48
|
+
chainlit/socket.py,sha256=yqLdBWwUymL86wPaHBP4juv6ElvPY6ip-TsGnx2JgDg,9146
|
|
49
|
+
chainlit/step.py,sha256=MrdylfS6ZEjmpBKoOyJga7MrCB7x2gv1YT1cUjsBLtg,12184
|
|
50
50
|
chainlit/sync.py,sha256=G1n-7-3WgXsN8y1bJkEyws_YwmHZIyDZoZUwhprigag,1235
|
|
51
51
|
chainlit/telemetry.py,sha256=sIZzYk0YEmtWbOS8B5tf6aQfW-uKzwvVtajpbj8bLMw,3210
|
|
52
52
|
chainlit/types.py,sha256=zEuxivoNAZg_3BzcWwGPpqz1xX8AoZQYpyWm9e8ZGTk,3361
|
|
@@ -54,7 +54,7 @@ chainlit/user.py,sha256=Cw4uGz0ffivWFszv8W__EHwkvTHQ3Lj9hqpRCPxFujo,619
|
|
|
54
54
|
chainlit/user_session.py,sha256=nyPx8vSICP8BhpPcW5h9vbHVf9ixj39SrkvJBUI_6zs,1368
|
|
55
55
|
chainlit/utils.py,sha256=3HzhfZ4XJhBIe9sJ_3Lxv3lMH4mFXsi6nLBGqm8Gtdw,2571
|
|
56
56
|
chainlit/version.py,sha256=iosXhlXclBwBqlADFKEilxAC2wWKbtuBKi87AmPi7s8,196
|
|
57
|
-
chainlit-1.0.
|
|
58
|
-
chainlit-1.0.
|
|
59
|
-
chainlit-1.0.
|
|
60
|
-
chainlit-1.0.
|
|
57
|
+
chainlit-1.0.0rc3.dist-info/METADATA,sha256=dVICEyySvIjlNxC1_Nv77VplNyKye2mGx373N5F8SLI,5560
|
|
58
|
+
chainlit-1.0.0rc3.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
|
|
59
|
+
chainlit-1.0.0rc3.dist-info/entry_points.txt,sha256=FrkqdjrFl8juSnvBndniyX7XuKojmUwO4ghRh-CFMQc,45
|
|
60
|
+
chainlit-1.0.0rc3.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|