chainlit 1.0.504__py3-none-any.whl → 1.0.505__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/config.py +7 -3
- chainlit/copilot/dist/index.js +262 -262
- chainlit/data/__init__.py +36 -8
- chainlit/data/sql_alchemy.py +246 -144
- chainlit/emitter.py +19 -9
- chainlit/frontend/dist/assets/{index-a8e1b559.js → index-d200e7ad.js} +119 -119
- chainlit/frontend/dist/assets/{react-plotly-b225b63c.js → react-plotly-10f4012e.js} +1 -1
- chainlit/frontend/dist/index.html +1 -1
- chainlit/llama_index/callbacks.py +2 -3
- chainlit/openai/__init__.py +5 -9
- chainlit/session.py +4 -0
- chainlit/socket.py +5 -1
- chainlit/types.py +19 -1
- chainlit/user_session.py +1 -0
- {chainlit-1.0.504.dist-info → chainlit-1.0.505.dist-info}/METADATA +2 -2
- {chainlit-1.0.504.dist-info → chainlit-1.0.505.dist-info}/RECORD +18 -18
- {chainlit-1.0.504.dist-info → chainlit-1.0.505.dist-info}/WHEEL +0 -0
- {chainlit-1.0.504.dist-info → chainlit-1.0.505.dist-info}/entry_points.txt +0 -0
chainlit/data/__init__.py
CHANGED
|
@@ -2,16 +2,35 @@ import functools
|
|
|
2
2
|
import json
|
|
3
3
|
import os
|
|
4
4
|
from collections import deque
|
|
5
|
-
from typing import
|
|
5
|
+
from typing import (
|
|
6
|
+
TYPE_CHECKING,
|
|
7
|
+
Any,
|
|
8
|
+
Dict,
|
|
9
|
+
List,
|
|
10
|
+
Literal,
|
|
11
|
+
Optional,
|
|
12
|
+
Protocol,
|
|
13
|
+
Union,
|
|
14
|
+
cast,
|
|
15
|
+
)
|
|
6
16
|
|
|
7
17
|
import aiofiles
|
|
8
18
|
from chainlit.config import config
|
|
9
19
|
from chainlit.context import context
|
|
10
20
|
from chainlit.logger import logger
|
|
11
21
|
from chainlit.session import WebsocketSession
|
|
12
|
-
from chainlit.types import
|
|
22
|
+
from chainlit.types import (
|
|
23
|
+
Feedback,
|
|
24
|
+
PageInfo,
|
|
25
|
+
PaginatedResponse,
|
|
26
|
+
Pagination,
|
|
27
|
+
ThreadDict,
|
|
28
|
+
ThreadFilter,
|
|
29
|
+
)
|
|
13
30
|
from chainlit.user import PersistedUser, User
|
|
14
|
-
from literalai import Attachment
|
|
31
|
+
from literalai import Attachment
|
|
32
|
+
from literalai import Score as LiteralScore
|
|
33
|
+
from literalai import Step as LiteralStep
|
|
15
34
|
from literalai.filter import threads_filters as LiteralThreadsFilters
|
|
16
35
|
from literalai.step import StepDict as LiteralStepDict
|
|
17
36
|
|
|
@@ -226,7 +245,7 @@ class ChainlitDataLayer(BaseDataLayer):
|
|
|
226
245
|
return PersistedUser(
|
|
227
246
|
id=_user.id or "",
|
|
228
247
|
identifier=_user.identifier or "",
|
|
229
|
-
metadata=
|
|
248
|
+
metadata=user.metadata,
|
|
230
249
|
createdAt=_user.created_at or "",
|
|
231
250
|
)
|
|
232
251
|
|
|
@@ -411,7 +430,7 @@ class ChainlitDataLayer(BaseDataLayer):
|
|
|
411
430
|
}
|
|
412
431
|
)
|
|
413
432
|
|
|
414
|
-
literal_response
|
|
433
|
+
literal_response = await self.client.api.list_threads(
|
|
415
434
|
first=pagination.first,
|
|
416
435
|
after=pagination.cursor,
|
|
417
436
|
filters=literal_filters,
|
|
@@ -421,8 +440,8 @@ class ChainlitDataLayer(BaseDataLayer):
|
|
|
421
440
|
pageInfo=PageInfo(
|
|
422
441
|
hasNextPage=literal_response.pageInfo.hasNextPage,
|
|
423
442
|
startCursor=literal_response.pageInfo.startCursor,
|
|
424
|
-
endCursor=literal_response.pageInfo.endCursor
|
|
425
|
-
|
|
443
|
+
endCursor=literal_response.pageInfo.endCursor,
|
|
444
|
+
),
|
|
426
445
|
data=literal_response.data,
|
|
427
446
|
)
|
|
428
447
|
|
|
@@ -470,11 +489,20 @@ class ChainlitDataLayer(BaseDataLayer):
|
|
|
470
489
|
tags=tags,
|
|
471
490
|
)
|
|
472
491
|
|
|
492
|
+
|
|
473
493
|
class BaseStorageClient(Protocol):
|
|
474
494
|
"""Base class for non-text data persistence like Azure Data Lake, S3, Google Storage, etc."""
|
|
475
|
-
|
|
495
|
+
|
|
496
|
+
async def upload_file(
|
|
497
|
+
self,
|
|
498
|
+
object_key: str,
|
|
499
|
+
data: Union[bytes, str],
|
|
500
|
+
mime: str = "application/octet-stream",
|
|
501
|
+
overwrite: bool = True,
|
|
502
|
+
) -> Dict[str, Any]:
|
|
476
503
|
pass
|
|
477
504
|
|
|
505
|
+
|
|
478
506
|
if api_key := os.environ.get("LITERAL_API_KEY"):
|
|
479
507
|
# support legacy LITERAL_SERVER variable as fallback
|
|
480
508
|
server = os.environ.get("LITERAL_API_URL") or os.environ.get("LITERAL_SERVER")
|