chainlit 1.2.0rc0__py3-none-any.whl → 1.3.0rc0__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.

Files changed (51) hide show
  1. chainlit/__init__.py +0 -10
  2. chainlit/auth.py +7 -7
  3. chainlit/callbacks.py +0 -32
  4. chainlit/cli/__init__.py +2 -0
  5. chainlit/config.py +7 -11
  6. chainlit/copilot/dist/index.js +253 -253
  7. chainlit/data/__init__.py +11 -6
  8. chainlit/data/dynamodb.py +7 -3
  9. chainlit/data/literalai.py +168 -59
  10. chainlit/data/sql_alchemy.py +89 -15
  11. chainlit/element.py +2 -1
  12. chainlit/emitter.py +0 -7
  13. chainlit/frontend/dist/assets/{DailyMotion-aa368b7e.js → DailyMotion-deaa038d.js} +1 -1
  14. chainlit/frontend/dist/assets/{Facebook-0335db46.js → Facebook-07c55425.js} +1 -1
  15. chainlit/frontend/dist/assets/{FilePlayer-8d04256c.js → FilePlayer-2acc46b1.js} +1 -1
  16. chainlit/frontend/dist/assets/{Kaltura-67c9dd31.js → Kaltura-c2689eb3.js} +1 -1
  17. chainlit/frontend/dist/assets/{Mixcloud-6bbaccf5.js → Mixcloud-79d681a7.js} +1 -1
  18. chainlit/frontend/dist/assets/{Mux-c2bcb757.js → Mux-549353dc.js} +1 -1
  19. chainlit/frontend/dist/assets/{Preview-210f3955.js → Preview-000efdea.js} +1 -1
  20. chainlit/frontend/dist/assets/{SoundCloud-a0276b84.js → SoundCloud-81b2bf43.js} +1 -1
  21. chainlit/frontend/dist/assets/{Streamable-a007323d.js → Streamable-032d3cc5.js} +1 -1
  22. chainlit/frontend/dist/assets/{Twitch-e6a88aa3.js → Twitch-43744e0a.js} +1 -1
  23. chainlit/frontend/dist/assets/{Vidyard-dfb88a35.js → Vidyard-4ac486dc.js} +1 -1
  24. chainlit/frontend/dist/assets/{Vimeo-3baa13d9.js → Vimeo-7f1f7543.js} +1 -1
  25. chainlit/frontend/dist/assets/{Wistia-e52f7bef.js → Wistia-d0d070c9.js} +1 -1
  26. chainlit/frontend/dist/assets/{YouTube-1715f22b.js → YouTube-8a2bf9cd.js} +1 -1
  27. chainlit/frontend/dist/assets/index-a0fa87f1.js +729 -0
  28. chainlit/frontend/dist/assets/{react-plotly-55648373.js → react-plotly-39a45803.js} +1 -1
  29. chainlit/frontend/dist/index.html +1 -1
  30. chainlit/haystack/callbacks.py +1 -3
  31. chainlit/input_widget.py +0 -22
  32. chainlit/langchain/callbacks.py +1 -2
  33. chainlit/message.py +1 -1
  34. chainlit/mistralai/__init__.py +0 -1
  35. chainlit/oauth_providers.py +12 -3
  36. chainlit/server.py +1 -23
  37. chainlit/session.py +5 -36
  38. chainlit/socket.py +2 -51
  39. chainlit/step.py +4 -3
  40. chainlit/translations/en-US.json +0 -6
  41. chainlit/types.py +1 -1
  42. chainlit/user_session.py +0 -4
  43. {chainlit-1.2.0rc0.dist-info → chainlit-1.3.0rc0.dist-info}/METADATA +6 -6
  44. chainlit-1.3.0rc0.dist-info/RECORD +96 -0
  45. chainlit/assistant.py +0 -16
  46. chainlit/assistant_settings.py +0 -35
  47. chainlit/frontend/dist/assets/index-bfdd8585.js +0 -729
  48. chainlit/translations/fr-FR.json +0 -236
  49. chainlit-1.2.0rc0.dist-info/RECORD +0 -99
  50. {chainlit-1.2.0rc0.dist-info → chainlit-1.3.0rc0.dist-info}/WHEEL +0 -0
  51. {chainlit-1.2.0rc0.dist-info → chainlit-1.3.0rc0.dist-info}/entry_points.txt +0 -0
chainlit/__init__.py CHANGED
@@ -16,8 +16,6 @@ from typing import TYPE_CHECKING, Any, Dict
16
16
 
17
17
  import chainlit.input_widget as input_widget
18
18
  from chainlit.action import Action
19
- from chainlit.assistant import Assistant
20
- from chainlit.assistant_settings import AssistantSettings
21
19
  from chainlit.cache import cache
22
20
  from chainlit.chat_context import chat_context
23
21
  from chainlit.chat_settings import ChatSettings
@@ -63,8 +61,6 @@ from .callbacks import (
63
61
  on_chat_end,
64
62
  on_chat_resume,
65
63
  on_chat_start,
66
- on_create_assistant,
67
- on_list_assistants,
68
64
  on_logout,
69
65
  on_message,
70
66
  on_settings_update,
@@ -138,10 +134,6 @@ __all__ = [
138
134
  "TaskStatus",
139
135
  "Video",
140
136
  "ChatSettings",
141
- # Experimental
142
- "AssistantSettings",
143
- # Experimental
144
- "Assistant",
145
137
  "input_widget",
146
138
  "Message",
147
139
  "ErrorMessage",
@@ -161,8 +153,6 @@ __all__ = [
161
153
  "action_callback",
162
154
  "author_rename",
163
155
  "on_settings_update",
164
- "on_create_assistant",
165
- "on_list_assistants",
166
156
  "password_auth_callback",
167
157
  "header_auth_callback",
168
158
  "sleep",
chainlit/auth.py CHANGED
@@ -42,14 +42,14 @@ def get_configuration():
42
42
  "requireLogin": require_login(),
43
43
  "passwordAuth": config.code.password_auth_callback is not None,
44
44
  "headerAuth": config.code.header_auth_callback is not None,
45
- "oauthProviders": get_configured_oauth_providers()
46
- if is_oauth_enabled()
47
- else [],
45
+ "oauthProviders": (
46
+ get_configured_oauth_providers() if is_oauth_enabled() else []
47
+ ),
48
48
  }
49
49
 
50
50
 
51
51
  def create_jwt(data: User) -> str:
52
- to_encode = data.to_dict() # type: Dict[str, Any]
52
+ to_encode: Dict[str, Any] = data.to_dict()
53
53
  to_encode.update(
54
54
  {
55
55
  "exp": datetime.utcnow() + timedelta(minutes=60 * 24 * 15), # 15 days
@@ -69,14 +69,14 @@ async def authenticate_user(token: str = Depends(reuseable_oauth)):
69
69
  )
70
70
  del dict["exp"]
71
71
  user = User(**dict)
72
- except Exception as e:
72
+ except Exception:
73
73
  raise HTTPException(status_code=401, detail="Invalid authentication token")
74
74
  if data_layer := get_data_layer():
75
75
  try:
76
76
  persisted_user = await data_layer.get_user(user.identifier)
77
- if persisted_user == None:
77
+ if persisted_user is None:
78
78
  persisted_user = await data_layer.create_user(user)
79
- except Exception as e:
79
+ except Exception:
80
80
  return user
81
81
 
82
82
  return persisted_user
chainlit/callbacks.py CHANGED
@@ -1,10 +1,7 @@
1
- import functools
2
1
  import inspect
3
2
  from typing import Any, Awaitable, Callable, Dict, List, Optional
4
3
 
5
4
  from chainlit.action import Action
6
- from chainlit.assistant import Assistant
7
- from chainlit.assistant_settings import AssistantSettings
8
5
  from chainlit.config import config
9
6
  from chainlit.message import Message
10
7
  from chainlit.oauth_providers import get_configured_oauth_providers
@@ -17,15 +14,6 @@ from fastapi import Request, Response
17
14
  from starlette.datastructures import Headers
18
15
 
19
16
 
20
- def experimental(func):
21
- @functools.wraps(func)
22
- def wrapper(*args, **kwargs):
23
- print(f"\033[1;33mexperimental feature: {func.__name__}\033[0m")
24
- return func(*args, **kwargs)
25
-
26
- return wrapper
27
-
28
-
29
17
  @trace
30
18
  def password_auth_callback(
31
19
  func: Callable[[str, str], Awaitable[Optional[User]]]
@@ -318,23 +306,3 @@ def on_settings_update(
318
306
 
319
307
  config.code.on_settings_update = wrap_user_function(func, with_task=True)
320
308
  return func
321
-
322
-
323
- # Experimental
324
- @trace
325
- @experimental
326
- def on_create_assistant(
327
- func: Callable[[Optional[User], AssistantSettings], Any]
328
- ) -> Callable[[Optional[User], AssistantSettings], Any]:
329
- config.code.on_create_assistant = wrap_user_function(func)
330
- return func
331
-
332
-
333
- # Experimental
334
- @trace
335
- @experimental
336
- def on_list_assistants(
337
- func: Callable[[Optional[User]], List[Assistant]]
338
- ) -> Callable[[Optional[User]], List[Assistant]]:
339
- config.code.on_list_assistants = wrap_user_function(func)
340
- return func
chainlit/cli/__init__.py CHANGED
@@ -5,8 +5,10 @@ import click
5
5
  import nest_asyncio
6
6
  import uvicorn
7
7
 
8
+ # Not sure if it is necessary to call nest_asyncio.apply() before the other imports
8
9
  nest_asyncio.apply()
9
10
 
11
+ # ruff: noqa: E402
10
12
  from chainlit.cache import init_lc_cache
11
13
  from chainlit.config import (
12
14
  BACKEND_ROOT,
chainlit/config.py CHANGED
@@ -28,13 +28,13 @@ from ._utils import is_path_inside
28
28
 
29
29
  if TYPE_CHECKING:
30
30
  from chainlit.action import Action
31
- from chainlit.assistant import Assistant
32
31
  from chainlit.element import ElementBased
33
32
  from chainlit.message import Message
34
33
  from chainlit.types import AudioChunk, ChatProfile, Starter, ThreadDict
35
34
  from chainlit.user import User
36
35
  from fastapi import Request, Response
37
36
 
37
+
38
38
  BACKEND_ROOT = os.path.dirname(__file__)
39
39
  PACKAGE_ROOT = os.path.dirname(os.path.dirname(BACKEND_ROOT))
40
40
  TRANSLATIONS_DIR = os.path.join(BACKEND_ROOT, "translations")
@@ -285,9 +285,9 @@ class CodeSettings:
285
285
  password_auth_callback: Optional[
286
286
  Callable[[str, str], Awaitable[Optional["User"]]]
287
287
  ] = None
288
- header_auth_callback: Optional[Callable[[Headers], Awaitable[Optional["User"]]]] = (
289
- None
290
- )
288
+ header_auth_callback: Optional[
289
+ Callable[[Headers], Awaitable[Optional["User"]]]
290
+ ] = None
291
291
  oauth_callback: Optional[
292
292
  Callable[[str, str, Dict[str, str], "User"], Awaitable[Optional["User"]]]
293
293
  ] = None
@@ -305,13 +305,9 @@ class CodeSettings:
305
305
  set_chat_profiles: Optional[
306
306
  Callable[[Optional["User"]], Awaitable[List["ChatProfile"]]]
307
307
  ] = None
308
- set_starters: Optional[Callable[[Optional["User"]], Awaitable[List["Starter"]]]] = (
309
- None
310
- )
311
-
312
- # assistant-related callback function
313
- on_create_assistant: Optional[Callable[[Optional["User"], Any], Any]] = None
314
- on_list_assistants: Optional[Callable[[Optional["User"]], List["Assistant"]]] = None
308
+ set_starters: Optional[
309
+ Callable[[Optional["User"]], Awaitable[List["Starter"]]]
310
+ ] = None
315
311
 
316
312
 
317
313
  @dataclass()