chainlit 1.0.400__py3-none-any.whl → 2.0.3__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 (113) hide show
  1. chainlit/__init__.py +98 -279
  2. chainlit/_utils.py +8 -0
  3. chainlit/action.py +12 -10
  4. chainlit/{auth.py → auth/__init__.py} +28 -36
  5. chainlit/auth/cookie.py +122 -0
  6. chainlit/auth/jwt.py +39 -0
  7. chainlit/cache.py +4 -6
  8. chainlit/callbacks.py +362 -0
  9. chainlit/chat_context.py +64 -0
  10. chainlit/chat_settings.py +3 -1
  11. chainlit/cli/__init__.py +77 -8
  12. chainlit/config.py +181 -101
  13. chainlit/context.py +42 -13
  14. chainlit/copilot/dist/index.js +8750 -903
  15. chainlit/data/__init__.py +101 -416
  16. chainlit/data/acl.py +6 -2
  17. chainlit/data/base.py +107 -0
  18. chainlit/data/chainlit_data_layer.py +608 -0
  19. chainlit/data/dynamodb.py +590 -0
  20. chainlit/data/literalai.py +500 -0
  21. chainlit/data/sql_alchemy.py +721 -0
  22. chainlit/data/storage_clients/__init__.py +0 -0
  23. chainlit/data/storage_clients/azure.py +81 -0
  24. chainlit/data/storage_clients/azure_blob.py +89 -0
  25. chainlit/data/storage_clients/base.py +26 -0
  26. chainlit/data/storage_clients/gcs.py +88 -0
  27. chainlit/data/storage_clients/s3.py +75 -0
  28. chainlit/data/utils.py +29 -0
  29. chainlit/discord/__init__.py +6 -0
  30. chainlit/discord/app.py +354 -0
  31. chainlit/element.py +91 -33
  32. chainlit/emitter.py +80 -29
  33. chainlit/frontend/dist/assets/DailyMotion-C_XC7xJI.js +1 -0
  34. chainlit/frontend/dist/assets/Dataframe-Cs4l4hA1.js +22 -0
  35. chainlit/frontend/dist/assets/Facebook-CUeCH7hk.js +1 -0
  36. chainlit/frontend/dist/assets/FilePlayer-CB-fYkx8.js +1 -0
  37. chainlit/frontend/dist/assets/Kaltura-YX6qaq72.js +1 -0
  38. chainlit/frontend/dist/assets/Mixcloud-DGV0ldjP.js +1 -0
  39. chainlit/frontend/dist/assets/Mux-CmRss5oc.js +1 -0
  40. chainlit/frontend/dist/assets/Preview-DBVJn7-H.js +1 -0
  41. chainlit/frontend/dist/assets/SoundCloud-qLUb18oY.js +1 -0
  42. chainlit/frontend/dist/assets/Streamable-BvYP7bFp.js +1 -0
  43. chainlit/frontend/dist/assets/Twitch-CTHt-sGZ.js +1 -0
  44. chainlit/frontend/dist/assets/Vidyard-B-0mCJbm.js +1 -0
  45. chainlit/frontend/dist/assets/Vimeo-Dnp7ri8q.js +1 -0
  46. chainlit/frontend/dist/assets/Wistia-DW0x_UBn.js +1 -0
  47. chainlit/frontend/dist/assets/YouTube--98FipvA.js +1 -0
  48. chainlit/frontend/dist/assets/index-D71nZ46o.js +8665 -0
  49. chainlit/frontend/dist/assets/index-g8LTJwwr.css +1 -0
  50. chainlit/frontend/dist/assets/react-plotly-Cn_BQTQw.js +3484 -0
  51. chainlit/frontend/dist/index.html +2 -4
  52. chainlit/haystack/callbacks.py +4 -7
  53. chainlit/input_widget.py +8 -4
  54. chainlit/langchain/callbacks.py +107 -72
  55. chainlit/langflow/__init__.py +1 -0
  56. chainlit/llama_index/__init__.py +2 -2
  57. chainlit/llama_index/callbacks.py +67 -42
  58. chainlit/markdown.py +22 -6
  59. chainlit/message.py +54 -56
  60. chainlit/mistralai/__init__.py +50 -0
  61. chainlit/oauth_providers.py +266 -8
  62. chainlit/openai/__init__.py +10 -18
  63. chainlit/secret.py +1 -1
  64. chainlit/server.py +789 -228
  65. chainlit/session.py +108 -90
  66. chainlit/slack/__init__.py +6 -0
  67. chainlit/slack/app.py +397 -0
  68. chainlit/socket.py +199 -116
  69. chainlit/step.py +141 -89
  70. chainlit/sync.py +2 -1
  71. chainlit/teams/__init__.py +6 -0
  72. chainlit/teams/app.py +338 -0
  73. chainlit/translations/bn.json +235 -0
  74. chainlit/translations/en-US.json +83 -4
  75. chainlit/translations/gu.json +235 -0
  76. chainlit/translations/he-IL.json +235 -0
  77. chainlit/translations/hi.json +235 -0
  78. chainlit/translations/kn.json +235 -0
  79. chainlit/translations/ml.json +235 -0
  80. chainlit/translations/mr.json +235 -0
  81. chainlit/translations/nl-NL.json +233 -0
  82. chainlit/translations/ta.json +235 -0
  83. chainlit/translations/te.json +235 -0
  84. chainlit/translations/zh-CN.json +233 -0
  85. chainlit/translations.py +60 -0
  86. chainlit/types.py +133 -28
  87. chainlit/user.py +14 -3
  88. chainlit/user_session.py +6 -3
  89. chainlit/utils.py +52 -5
  90. chainlit/version.py +3 -2
  91. {chainlit-1.0.400.dist-info → chainlit-2.0.3.dist-info}/METADATA +48 -50
  92. chainlit-2.0.3.dist-info/RECORD +106 -0
  93. chainlit/cli/utils.py +0 -24
  94. chainlit/frontend/dist/assets/index-9711593e.js +0 -723
  95. chainlit/frontend/dist/assets/index-d088547c.css +0 -1
  96. chainlit/frontend/dist/assets/react-plotly-d8762cc2.js +0 -3602
  97. chainlit/playground/__init__.py +0 -2
  98. chainlit/playground/config.py +0 -40
  99. chainlit/playground/provider.py +0 -108
  100. chainlit/playground/providers/__init__.py +0 -13
  101. chainlit/playground/providers/anthropic.py +0 -118
  102. chainlit/playground/providers/huggingface.py +0 -75
  103. chainlit/playground/providers/langchain.py +0 -89
  104. chainlit/playground/providers/openai.py +0 -408
  105. chainlit/playground/providers/vertexai.py +0 -171
  106. chainlit/translations/pt-BR.json +0 -155
  107. chainlit-1.0.400.dist-info/RECORD +0 -66
  108. /chainlit/copilot/dist/assets/{logo_dark-2a3cf740.svg → logo_dark-IkGJ_IwC.svg} +0 -0
  109. /chainlit/copilot/dist/assets/{logo_light-b078e7bc.svg → logo_light-Bb_IPh6r.svg} +0 -0
  110. /chainlit/frontend/dist/assets/{logo_dark-2a3cf740.svg → logo_dark-IkGJ_IwC.svg} +0 -0
  111. /chainlit/frontend/dist/assets/{logo_light-b078e7bc.svg → logo_light-Bb_IPh6r.svg} +0 -0
  112. {chainlit-1.0.400.dist-info → chainlit-2.0.3.dist-info}/WHEEL +0 -0
  113. {chainlit-1.0.400.dist-info → chainlit-2.0.3.dist-info}/entry_points.txt +0 -0
chainlit/types.py CHANGED
@@ -1,13 +1,24 @@
1
1
  from enum import Enum
2
- from typing import TYPE_CHECKING, Dict, List, Literal, Optional, TypedDict, Union
2
+ from pathlib import Path
3
+ from typing import (
4
+ TYPE_CHECKING,
5
+ Any,
6
+ Dict,
7
+ Generic,
8
+ List,
9
+ Literal,
10
+ Optional,
11
+ Protocol,
12
+ TypedDict,
13
+ TypeVar,
14
+ Union,
15
+ )
3
16
 
4
17
  if TYPE_CHECKING:
5
18
  from chainlit.element import ElementDict
6
- from chainlit.user import UserDict
7
19
  from chainlit.step import StepDict
8
20
 
9
21
  from dataclasses_json import DataClassJsonMixin
10
- from literalai import ChatGeneration, CompletionGeneration
11
22
  from pydantic import BaseModel
12
23
  from pydantic.dataclasses import dataclass
13
24
 
@@ -20,7 +31,8 @@ class ThreadDict(TypedDict):
20
31
  id: str
21
32
  createdAt: str
22
33
  name: Optional[str]
23
- user: Optional["UserDict"]
34
+ userId: Optional[str]
35
+ userIdentifier: Optional[str]
24
36
  tags: Optional[List[str]]
25
37
  metadata: Optional[Dict]
26
38
  steps: List["StepDict"]
@@ -33,11 +45,68 @@ class Pagination(BaseModel):
33
45
 
34
46
 
35
47
  class ThreadFilter(BaseModel):
36
- feedback: Optional[Literal[-1, 0, 1]] = None
37
- userIdentifier: Optional[str] = None
48
+ feedback: Optional[Literal[0, 1]] = None
49
+ userId: Optional[str] = None
38
50
  search: Optional[str] = None
39
51
 
40
52
 
53
+ @dataclass
54
+ class PageInfo:
55
+ hasNextPage: bool
56
+ startCursor: Optional[str]
57
+ endCursor: Optional[str]
58
+
59
+ def to_dict(self):
60
+ return {
61
+ "hasNextPage": self.hasNextPage,
62
+ "startCursor": self.startCursor,
63
+ "endCursor": self.endCursor,
64
+ }
65
+
66
+ @classmethod
67
+ def from_dict(cls, page_info_dict: Dict) -> "PageInfo":
68
+ hasNextPage = page_info_dict.get("hasNextPage", False)
69
+ startCursor = page_info_dict.get("startCursor", None)
70
+ endCursor = page_info_dict.get("endCursor", None)
71
+ return cls(
72
+ hasNextPage=hasNextPage, startCursor=startCursor, endCursor=endCursor
73
+ )
74
+
75
+
76
+ T = TypeVar("T", covariant=True)
77
+
78
+
79
+ class HasFromDict(Protocol[T]):
80
+ @classmethod
81
+ def from_dict(cls, obj_dict: Any) -> T:
82
+ raise NotImplementedError
83
+
84
+
85
+ @dataclass
86
+ class PaginatedResponse(Generic[T]):
87
+ pageInfo: PageInfo
88
+ data: List[T]
89
+
90
+ def to_dict(self):
91
+ return {
92
+ "pageInfo": self.pageInfo.to_dict(),
93
+ "data": [
94
+ (d.to_dict() if hasattr(d, "to_dict") and callable(d.to_dict) else d)
95
+ for d in self.data
96
+ ],
97
+ }
98
+
99
+ @classmethod
100
+ def from_dict(
101
+ cls, paginated_response_dict: Dict, the_class: HasFromDict[T]
102
+ ) -> "PaginatedResponse[T]":
103
+ pageInfo = PageInfo.from_dict(paginated_response_dict.get("pageInfo", {}))
104
+
105
+ data = [the_class.from_dict(d) for d in paginated_response_dict.get("data", [])]
106
+
107
+ return cls(pageInfo=pageInfo, data=data)
108
+
109
+
41
110
  @dataclass
42
111
  class FileSpec(DataClassJsonMixin):
43
112
  accept: Union[List[str], Dict[str, List[str]]]
@@ -75,16 +144,37 @@ class FileReference(TypedDict):
75
144
  class FileDict(TypedDict):
76
145
  id: str
77
146
  name: str
78
- path: str
147
+ path: Path
79
148
  size: int
80
149
  type: str
81
150
 
82
151
 
83
- class UIMessagePayload(TypedDict):
152
+ class MessagePayload(TypedDict):
84
153
  message: "StepDict"
85
154
  fileReferences: Optional[List[FileReference]]
86
155
 
87
156
 
157
+ class InputAudioChunkPayload(TypedDict):
158
+ isStart: bool
159
+ mimeType: str
160
+ elapsedTime: float
161
+ data: bytes
162
+
163
+
164
+ @dataclass
165
+ class InputAudioChunk:
166
+ isStart: bool
167
+ mimeType: str
168
+ elapsedTime: float
169
+ data: bytes
170
+
171
+
172
+ class OutputAudioChunk(TypedDict):
173
+ track: str
174
+ mimeType: str
175
+ data: bytes
176
+
177
+
88
178
  @dataclass
89
179
  class AskFileResponse:
90
180
  id: str
@@ -96,43 +186,55 @@ class AskFileResponse:
96
186
 
97
187
  class AskActionResponse(TypedDict):
98
188
  name: str
99
- value: str
189
+ payload: Dict
100
190
  label: str
101
- description: str
191
+ tooltip: str
102
192
  forId: str
103
193
  id: str
104
- collapsed: bool
105
-
106
-
107
- class GenerationRequest(BaseModel):
108
- chatGeneration: Optional[ChatGeneration] = None
109
- completionGeneration: Optional[CompletionGeneration] = None
110
- userEnv: Dict[str, str]
111
194
 
112
- @property
113
- def generation(self):
114
- if self.chatGeneration:
115
- return self.chatGeneration
116
- return self.completionGeneration
117
195
 
118
- def is_chat(self):
119
- return self.chatGeneration is not None
196
+ class UpdateThreadRequest(BaseModel):
197
+ threadId: str
198
+ name: str
120
199
 
121
200
 
122
201
  class DeleteThreadRequest(BaseModel):
123
202
  threadId: str
124
203
 
125
204
 
205
+ class DeleteFeedbackRequest(BaseModel):
206
+ feedbackId: str
207
+
208
+
126
209
  class GetThreadsRequest(BaseModel):
127
210
  pagination: Pagination
128
211
  filter: ThreadFilter
129
212
 
130
213
 
214
+ class CallActionRequest(BaseModel):
215
+ action: Dict
216
+ sessionId: str
217
+
218
+
219
+ class ElementRequest(BaseModel):
220
+ element: Dict
221
+ sessionId: str
222
+
223
+
131
224
  class Theme(str, Enum):
132
225
  light = "light"
133
226
  dark = "dark"
134
227
 
135
228
 
229
+ @dataclass
230
+ class Starter(DataClassJsonMixin):
231
+ """Specification for a starter that can be chosen by the user at the thread start."""
232
+
233
+ label: str
234
+ message: str
235
+ icon: Optional[str] = None
236
+
237
+
136
238
  @dataclass
137
239
  class ChatProfile(DataClassJsonMixin):
138
240
  """Specification for a chat profile that can be chosen by the user at the thread start."""
@@ -140,22 +242,25 @@ class ChatProfile(DataClassJsonMixin):
140
242
  name: str
141
243
  markdown_description: str
142
244
  icon: Optional[str] = None
245
+ default: bool = False
246
+ starters: Optional[List[Starter]] = None
143
247
 
144
248
 
145
249
  FeedbackStrategy = Literal["BINARY"]
146
250
 
147
251
 
148
252
  class FeedbackDict(TypedDict):
149
- value: Literal[-1, 0, 1]
150
- strategy: FeedbackStrategy
253
+ forId: str
254
+ id: Optional[str]
255
+ value: Literal[0, 1]
151
256
  comment: Optional[str]
152
257
 
153
258
 
154
259
  @dataclass
155
260
  class Feedback:
156
261
  forId: str
157
- value: Literal[-1, 0, 1]
158
- strategy: FeedbackStrategy = "BINARY"
262
+ value: Literal[0, 1]
263
+ threadId: Optional[str] = None
159
264
  id: Optional[str] = None
160
265
  comment: Optional[str] = None
161
266
 
chainlit/user.py CHANGED
@@ -1,16 +1,26 @@
1
- from typing import Dict, Literal, TypedDict
1
+ from typing import Dict, Literal, Optional, TypedDict
2
2
 
3
3
  from dataclasses_json import DataClassJsonMixin
4
- from pydantic.dataclasses import Field, dataclass
4
+ from pydantic import Field
5
+ from pydantic.dataclasses import dataclass
5
6
 
6
7
  Provider = Literal[
7
- "credentials", "header", "github", "google", "azure-ad", "okta", "auth0", "descope"
8
+ "credentials",
9
+ "header",
10
+ "github",
11
+ "google",
12
+ "azure-ad",
13
+ "azure-ad-hybrid",
14
+ "okta",
15
+ "auth0",
16
+ "descope",
8
17
  ]
9
18
 
10
19
 
11
20
  class UserDict(TypedDict):
12
21
  id: str
13
22
  identifier: str
23
+ display_name: Optional[str]
14
24
  metadata: Dict
15
25
 
16
26
 
@@ -18,6 +28,7 @@ class UserDict(TypedDict):
18
28
  @dataclass
19
29
  class User(DataClassJsonMixin):
20
30
  identifier: str
31
+ display_name: Optional[str] = None
21
32
  metadata: Dict = Field(default_factory=dict)
22
33
 
23
34
 
chainlit/user_session.py CHANGED
@@ -1,6 +1,6 @@
1
1
  from typing import Dict
2
2
 
3
- from chainlit.context import context
3
+ from chainlit.context import WebsocketSession, context
4
4
 
5
5
  user_sessions: Dict[str, Dict] = {}
6
6
 
@@ -27,9 +27,12 @@ class UserSession:
27
27
  user_session["chat_settings"] = context.session.chat_settings
28
28
  user_session["user"] = context.session.user
29
29
  user_session["chat_profile"] = context.session.chat_profile
30
+ user_session["http_referer"] = context.session.http_referer
31
+ user_session["client_type"] = context.session.client_type
32
+ user_session["http_cookie"] = context.session.http_cookie
30
33
 
31
- if context.session.root_message:
32
- user_session["root_message"] = context.session.root_message
34
+ if isinstance(context.session, WebsocketSession):
35
+ user_session["languages"] = context.session.languages
33
36
 
34
37
  return user_session.get(key, default)
35
38
 
chainlit/utils.py CHANGED
@@ -1,12 +1,18 @@
1
1
  import functools
2
2
  import importlib
3
3
  import inspect
4
+ import os
5
+ from asyncio import CancelledError
4
6
  from typing import Callable
5
7
 
8
+ import click
9
+ from fastapi import FastAPI
10
+ from packaging import version
11
+
12
+ from chainlit.auth import ensure_jwt_secret
6
13
  from chainlit.context import context
7
14
  from chainlit.logger import logger
8
15
  from chainlit.message import ErrorMessage
9
- from packaging import version
10
16
 
11
17
 
12
18
  def wrap_user_function(user_function: Callable, with_task=False) -> Callable:
@@ -39,13 +45,14 @@ def wrap_user_function(user_function: Callable, with_task=False) -> Callable:
39
45
  return await user_function(**params_values)
40
46
  else:
41
47
  return user_function(**params_values)
42
- except InterruptedError:
48
+ except CancelledError:
43
49
  pass
44
50
  except Exception as e:
45
51
  logger.exception(e)
46
- await ErrorMessage(
47
- content=str(e) or e.__class__.__name__, author="Error"
48
- ).send()
52
+ if with_task:
53
+ await ErrorMessage(
54
+ content=str(e) or e.__class__.__name__, author="Error"
55
+ ).send()
49
56
  finally:
50
57
  if with_task:
51
58
  await context.emitter.task_end()
@@ -85,3 +92,43 @@ def check_module_version(name, required_version):
85
92
  except ModuleNotFoundError:
86
93
  return False
87
94
  return version.parse(module.__version__) >= version.parse(required_version)
95
+
96
+
97
+ def check_file(target: str):
98
+ # Define accepted file extensions for Chainlit
99
+ ACCEPTED_FILE_EXTENSIONS = ("py", "py3")
100
+
101
+ _, extension = os.path.splitext(target)
102
+
103
+ # Check file extension
104
+ if extension[1:] not in ACCEPTED_FILE_EXTENSIONS:
105
+ if extension[1:] == "":
106
+ raise click.BadArgumentUsage(
107
+ "Chainlit requires raw Python (.py) files, but the provided file has no extension."
108
+ )
109
+ else:
110
+ raise click.BadArgumentUsage(
111
+ f"Chainlit requires raw Python (.py) files, not {extension}."
112
+ )
113
+
114
+ if not os.path.exists(target):
115
+ raise click.BadParameter(f"File does not exist: {target}")
116
+
117
+
118
+ def mount_chainlit(app: FastAPI, target: str, path="/chainlit"):
119
+ os.environ["CHAINLIT_ROOT_PATH"] = path
120
+ os.environ["CHAINLIT_SUBMOUNT"] = "true"
121
+ from chainlit.config import config, load_module
122
+ from chainlit.server import app as chainlit_app
123
+
124
+ config.run.root_path = path
125
+ config.run.debug = os.environ.get("CHAINLIT_DEBUG", False)
126
+
127
+ check_file(target)
128
+ # Load the module provided by the user
129
+ config.run.module_name = target
130
+ load_module(config.run.module_name)
131
+
132
+ ensure_jwt_secret()
133
+
134
+ app.mount(path, chainlit_app)
chainlit/version.py CHANGED
@@ -3,5 +3,6 @@ from importlib import metadata
3
3
  try:
4
4
  __version__ = metadata.version(__package__)
5
5
  except metadata.PackageNotFoundError:
6
- # Case where package metadata is not available.
7
- __version__ = ""
6
+ # Case where package metadata is not available, default to a 'non-outdated' version.
7
+ # Ref: config.py::load_settings()
8
+ __version__ = "0.3.1"
@@ -1,41 +1,48 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: chainlit
3
- Version: 1.0.400
3
+ Version: 2.0.3
4
4
  Summary: Build Conversational AI.
5
- Home-page: https://github.com/Chainlit/chainlit
6
- License: Apache-2.0 license
5
+ Home-page: https://chainlit.io/
6
+ License: Apache-2.0
7
7
  Keywords: LLM,Agents,gen ai,chat ui,chatbot ui,openai,copilot,langchain,conversational ai
8
- Author: Chainlit
9
- Requires-Python: >=3.8.1,<4.0.0
10
- Classifier: License :: Other/Proprietary License
8
+ Author: Willy Douhard
9
+ Requires-Python: >=3.9,<4.0.0
10
+ Classifier: Environment :: Web Environment
11
+ Classifier: Framework :: FastAPI
12
+ Classifier: License :: OSI Approved :: Apache Software License
13
+ Classifier: Programming Language :: JavaScript
11
14
  Classifier: Programming Language :: Python :: 3
12
15
  Classifier: Programming Language :: Python :: 3.9
13
16
  Classifier: Programming Language :: Python :: 3.10
14
17
  Classifier: Programming Language :: Python :: 3.11
15
18
  Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Topic :: Communications :: Chat
20
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
21
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
22
+ Classifier: Topic :: Software Development :: User Interfaces
16
23
  Requires-Dist: aiofiles (>=23.1.0,<24.0.0)
17
- Requires-Dist: asyncer (>=0.0.2,<0.0.3)
24
+ Requires-Dist: asyncer (>=0.0.7,<0.0.8)
18
25
  Requires-Dist: click (>=8.1.3,<9.0.0)
19
- Requires-Dist: dataclasses_json (>=0.5.7,<0.6.0)
20
- Requires-Dist: fastapi (>=0.100)
21
- Requires-Dist: fastapi-socketio (>=0.0.10,<0.0.11)
26
+ Requires-Dist: dataclasses_json (>=0.6.7,<0.7.0)
27
+ Requires-Dist: fastapi (>=0.115.3,<0.116)
22
28
  Requires-Dist: filetype (>=1.2.0,<2.0.0)
23
29
  Requires-Dist: httpx (>=0.23.0)
24
30
  Requires-Dist: lazify (>=0.4.0,<0.5.0)
25
- Requires-Dist: literalai (==0.0.300)
26
- Requires-Dist: nest-asyncio (>=1.5.6,<2.0.0)
31
+ Requires-Dist: literalai (==0.1.103)
32
+ Requires-Dist: nest-asyncio (>=1.6.0,<2.0.0)
27
33
  Requires-Dist: packaging (>=23.1,<24.0)
28
34
  Requires-Dist: pydantic (>=1,<3)
29
35
  Requires-Dist: pyjwt (>=2.8.0,<3.0.0)
30
36
  Requires-Dist: python-dotenv (>=1.0.0,<2.0.0)
31
- Requires-Dist: python-graphql-client (>=0.4.3,<0.5.0)
32
- Requires-Dist: python-multipart (>=0.0.6,<0.0.7)
33
- Requires-Dist: starlette (<0.33.0)
37
+ Requires-Dist: python-multipart (>=0.0.18,<0.0.19)
38
+ Requires-Dist: python-socketio (>=5.11.0,<6.0.0)
39
+ Requires-Dist: starlette (>=0.41.2,<0.42.0)
34
40
  Requires-Dist: syncer (>=2.0.3,<3.0.0)
35
41
  Requires-Dist: tomli (>=2.0.1,<3.0.0)
36
42
  Requires-Dist: uptrace (>=1.22.0,<2.0.0)
37
43
  Requires-Dist: uvicorn (>=0.25.0,<0.26.0)
38
44
  Requires-Dist: watchfiles (>=0.20.0,<0.21.0)
45
+ Project-URL: Documentation, https://docs.chainlit.io/
39
46
  Project-URL: Repository, https://github.com/Chainlit/chainlit
40
47
  Description-Content-Type: text/markdown
41
48
 
@@ -43,34 +50,40 @@ Description-Content-Type: text/markdown
43
50
 
44
51
  [![](https://dcbadge.vercel.app/api/server/ZThrUxbAYw?style=flat)](https://discord.gg/k73SQ3FyUh)
45
52
  [![Twitter](https://img.shields.io/twitter/url/https/twitter.com/chainlit_io.svg?style=social&label=Follow%20%40chainlit_io)](https://twitter.com/chainlit_io)
53
+ ![PyPI - Downloads](https://img.shields.io/pypi/dm/chainlit)
54
+ [![GitHub Contributors](https://img.shields.io/github/contributors/chainlit/chainlit)](https://github.com/chainlit/chainlit/graphs/contributors)
46
55
  [![CI](https://github.com/Chainlit/chainlit/actions/workflows/ci.yaml/badge.svg)](https://github.com/Chainlit/chainlit/actions/workflows/ci.yaml)
47
56
 
48
57
  **Build production-ready Conversational AI applications in minutes, not weeks ⚡️**
49
58
 
50
59
  Chainlit is an open-source async Python framework which allows developers to build scalable Conversational AI or agentic applications.
51
60
 
52
- - ChatGPT-like application
53
- - ✅ Embedded Chatbot & Software Copilot
54
- - ✅ Custom frontend (build your own agentic experience)
55
- - ✅ API Endpoint
61
+ Full documentation is available [here](https://docs.chainlit.io). You can ask Chainlit related questions to [Chainlit Help](https://help.chainlit.io/), an app built using Chainlit!
56
62
 
57
- Full documentation is available [here](https://docs.chainlit.io).
63
+ https://github.com/user-attachments/assets/b3738aba-55c0-42fa-ac00-6efd1ee0d148
58
64
 
59
- Contact us [here](https://forms.gle/BX3UNBLmTF75KgZVA) for **Enterprise Support** and to get early access to Literal AI, our product to evaluate and monitor LLM applications.
60
-
61
- https://github.com/Chainlit/chainlit/assets/13104895/8882af90-fdfa-4b24-8200-1ee96c6c7490
62
65
 
63
66
  ## Installation
64
67
 
65
68
  Open a terminal and run:
66
69
 
67
- ```bash
68
- $ pip install chainlit
69
- $ chainlit hello
70
+ ```sh
71
+ pip install chainlit
72
+ chainlit hello
70
73
  ```
71
74
 
72
75
  If this opens the `hello app` in your browser, you're all set!
73
76
 
77
+ ### Development version
78
+
79
+ The latest in-development version can be installed straight from GitHub with:
80
+
81
+ ```sh
82
+ pip install git+https://github.com/Chainlit/chainlit.git#subdirectory=backend/
83
+ ```
84
+
85
+ (Requires Node and pnpm installed on the system.)
86
+
74
87
  ## 🚀 Quickstart
75
88
 
76
89
  ### 🐍 Pure Python
@@ -81,8 +94,10 @@ Create a new file `demo.py` with the following code:
81
94
  import chainlit as cl
82
95
 
83
96
 
84
- @cl.step
85
- def tool():
97
+ @cl.step(type="tool")
98
+ async def tool():
99
+ # Fake tool
100
+ await cl.sleep(2)
86
101
  return "Response from the tool!"
87
102
 
88
103
 
@@ -99,37 +114,20 @@ async def main(message: cl.Message):
99
114
  None.
100
115
  """
101
116
 
117
+
102
118
  # Call the tool
103
- tool()
119
+ tool_res = await tool()
104
120
 
105
- # Send the final answer.
106
- await cl.Message(content="This is the final answer").send()
121
+ await cl.Message(content=tool_res).send()
107
122
  ```
108
123
 
109
124
  Now run it!
110
125
 
111
- ```
112
- $ chainlit run demo.py -w
126
+ ```sh
127
+ chainlit run demo.py -w
113
128
  ```
114
129
 
115
130
  <img src="/images/quick-start.png" alt="Quick Start"></img>
116
- ## 🎉 Key Features and Integrations
117
-
118
- Full documentation is available [here](https://docs.chainlit.io). Key features:
119
-
120
- - [💬 Multi Modal chats](https://docs.chainlit.io/advanced-features/multi-modal)
121
- - [💭 Chain of Thought visualisation](https://docs.chainlit.io/concepts/step)
122
- - [💾 Data persistence + human feedback](https://docs.chainlit.io/data-persistence/overview)
123
- - [🛝 In context Prompt Playground](https://docs.chainlit.io/advanced-features/prompt-playground/overview)
124
- - [👤 Authentication](https://docs.chainlit.io/authentication/overview)
125
-
126
- Chainlit is compatible with all Python programs and libraries. That being said, it comes with integrations for:
127
-
128
- - [LangChain](https://docs.chainlit.io/integrations/langchain)
129
- - [Llama Index](https://docs.chainlit.io/integrations/llama-index)
130
- - [Autogen](https://github.com/Chainlit/cookbook/tree/main/pyautogen)
131
- - [OpenAI Assistant](https://github.com/Chainlit/cookbook/tree/main/openai-assistant)
132
- - [Haystack](https://docs.chainlit.io/integrations/haystack)
133
131
 
134
132
  ## 📚 More Examples - Cookbook
135
133
 
@@ -0,0 +1,106 @@
1
+ chainlit/__init__.py,sha256=ZfEoaKPb53KVkzNvnsJLH2NWNaMyYvf0cPCZTAOsiNo,4371
2
+ chainlit/__main__.py,sha256=7Vg3w3T3qDuz4KDu5lQhLH6lQ3cYdume7gHH7Z1V97U,87
3
+ chainlit/_utils.py,sha256=vaKfEpXcL4kXktp54IRQWZRK4L_HGK8gJuAoIM29YYc,289
4
+ chainlit/action.py,sha256=ljtpsPYRtFYigw2G6VbBworRHDL2fq8hE9A4H_fEijw,1333
5
+ chainlit/auth/__init__.py,sha256=RB7rw0-fa4gVh6cAKieqFVGB7F-cr84IOBvx1yoKU1g,2613
6
+ chainlit/auth/cookie.py,sha256=gRIxEnfX1W2MyFhN3Glg414-pDBR9MbbL970fvOpEbo,3809
7
+ chainlit/auth/jwt.py,sha256=2ZgwNljDk-ekpTU1kohvI55gaB9IM1bYJYHN1Xa7AKQ,965
8
+ chainlit/cache.py,sha256=tPWzO4UHMgNnAnKolKdW0pm08ceZykrs25kvpWJHhN8,1389
9
+ chainlit/callbacks.py,sha256=_77KLfR2tXHOLpmDZbWsXWRquXlMvPRpeBPGY1rohKM,10151
10
+ chainlit/chat_context.py,sha256=rVA4t2Df8YzMg-gNVArhDTZZ3wX83nOyKmgyHo8sJjQ,1848
11
+ chainlit/chat_settings.py,sha256=iZ2vSUUz9UIBwrRBTelTJFzvNMDZ5vX2f16BuSDThEY,898
12
+ chainlit/cli/__init__.py,sha256=00uuJPlSinXAV2WuHLIVQOQlZfOEUrwb1PD8coIFG6U,6582
13
+ chainlit/config.py,sha256=QVFTkgjoEjf1oxq2hOVd40rPH_taEEc-7E1XApFRbMw,16131
14
+ chainlit/context.py,sha256=BtbGRdmRRqOC5Vbz8zijkgiN0gyKuDamkPPNrscOgo4,3317
15
+ chainlit/copilot/dist/assets/logo_dark-IkGJ_IwC.svg,sha256=Kjz3QMh-oh-ag4YatjU0YCPqGF7F8nHh8VUQoJIs01E,8887
16
+ chainlit/copilot/dist/assets/logo_light-Bb_IPh6r.svg,sha256=sHjnvEq1rfqh3bcexJNYUY7WEDdTQZq3aKZYpi4w4ck,8889
17
+ chainlit/copilot/dist/index.js,sha256=N8UkxX_lXhRbwhAHIXLbRhSVPsFoZ9d4FiHHGvCegZw,7740787
18
+ chainlit/data/__init__.py,sha256=u9s1XLiryEW9t0PuJOSbIjOHqgOQ8_BbtAwJcJmZyXI,4729
19
+ chainlit/data/acl.py,sha256=1g9fWxq3K2n06g1Ngb_QNBhyKNXUpKEGiUW6VnAfqtg,575
20
+ chainlit/data/base.py,sha256=CmqWc9BtqGk79UUqJJIni81vAJFaV_UFpaFCw7gTkR0,2527
21
+ chainlit/data/chainlit_data_layer.py,sha256=iH-Ta6mK37kJoat08gPQhW--R6cIYb-AM-FqxcNRQFY,21504
22
+ chainlit/data/dynamodb.py,sha256=UP3-3KZHFOCWxWQ-PL1VecLLSi0mKwFM-RiEfPtbVWE,19413
23
+ chainlit/data/literalai.py,sha256=TVzNbrc0-HhkfmQxuaIzqQco9i0kg-R9k_E397-CR1w,17090
24
+ chainlit/data/sql_alchemy.py,sha256=doDUh3lKXY1TlnHiF6-p576Opf6eIeYOaudtcdIqO8k,30521
25
+ chainlit/data/storage_clients/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
26
+ chainlit/data/storage_clients/azure.py,sha256=QQYX6J60kbYmQTggQQFaHdsVw61skh1FCL3V0X-Qy30,2531
27
+ chainlit/data/storage_clients/azure_blob.py,sha256=c3svW1jovdj-VtnhdJEsCqrABU2NQ9c565GuqER9ZB0,3283
28
+ chainlit/data/storage_clients/base.py,sha256=L_pp4dhLf--BzkfHDzuJbKJinFa9AHJHLZ9BGC-Z28c,644
29
+ chainlit/data/storage_clients/gcs.py,sha256=aRbbyrL7bOasOKVdycW4yykJVGt_IYM3ymoTO4Z3Ydw,2926
30
+ chainlit/data/storage_clients/s3.py,sha256=E9Qtw3SEZkLCd9UXPlz0dTpFz8X-UDYk95dMAen3FDg,2519
31
+ chainlit/data/utils.py,sha256=cVe8p9F-lITgmAD2xhON_h0nKJVrh1P0AUoLCq6JCWs,966
32
+ chainlit/discord/__init__.py,sha256=lTHHcYQmfa2wpJ35m3eveEpUbp6ti2YSA7AdopfsREs,219
33
+ chainlit/discord/app.py,sha256=Kx0Y48Isy1BbwtoVM16tXqAIYtf_j8y1z2kXS5zIkuk,11175
34
+ chainlit/element.py,sha256=k0Wui8-O7tQLGmWrM7qwsUmIS03K4a6eVk3R4Grp2B8,11799
35
+ chainlit/emitter.py,sha256=X8OwAGkcs44Gp3OyLtClFqqMuMJMH_AOJHXafCBCYH4,14088
36
+ chainlit/frontend/dist/assets/DailyMotion-C_XC7xJI.js,sha256=qltEnpOOnSIjYTwf1JgM3q6S2FtwBKZTrIGHvlbOYX4,2958
37
+ chainlit/frontend/dist/assets/Dataframe-Cs4l4hA1.js,sha256=hymNMoP7ZNC7WiWUCNmbPBHxWcvr0geC6-lGK4-J7RI,53932
38
+ chainlit/frontend/dist/assets/Facebook-CUeCH7hk.js,sha256=e-1C-QlUqq9KNEFea_1vwAzLNyKVQVrUpHoEYuLOlK4,3213
39
+ chainlit/frontend/dist/assets/FilePlayer-CB-fYkx8.js,sha256=GANPu_PZktOlYWmlQ_ssMoHiIYBg8A5V_dc2OcnVqkE,9038
40
+ chainlit/frontend/dist/assets/Kaltura-YX6qaq72.js,sha256=Mij_DM0k7Qihn1S35-VOh6ThQFlHuhMSdYbuEPTaIRc,2787
41
+ chainlit/frontend/dist/assets/Mixcloud-DGV0ldjP.js,sha256=ughSML-DaTda60W1zWCMMrZVOiaXu4OjAbs08micpg0,2635
42
+ chainlit/frontend/dist/assets/Mux-CmRss5oc.js,sha256=auzYPckIi-HJJT3IA99wqoJqlGA8lh2fKFVmZSfLJYE,5357
43
+ chainlit/frontend/dist/assets/Preview-DBVJn7-H.js,sha256=aXpmAbEcYA_SN5tt5Uc6JsKH56k6AVSlcPaLAD6v0SY,3008
44
+ chainlit/frontend/dist/assets/SoundCloud-qLUb18oY.js,sha256=Kw_VhEi6x0piPTii_yQ7M-TSH_Z8OGIxjwXB4cMOjB0,2920
45
+ chainlit/frontend/dist/assets/Streamable-BvYP7bFp.js,sha256=BoKh_Z38fxJ5oI7MkmYtIVUJ8cy6CshhcFcTGHP9DeQ,2932
46
+ chainlit/frontend/dist/assets/Twitch-CTHt-sGZ.js,sha256=FylxrZd9pC4gw9TZRmJgxxKEAA_2s_LM6BfnYNyE5_A,3080
47
+ chainlit/frontend/dist/assets/Vidyard-B-0mCJbm.js,sha256=U7juUFgb0PLljWNm4mfzZGzo7_FUptsi5CPdr9wE1qI,2854
48
+ chainlit/frontend/dist/assets/Vimeo-Dnp7ri8q.js,sha256=54j7AGUDS_QHAJjRWcr5v9A6b84SQ9FcgIIAb-2YfK4,3624
49
+ chainlit/frontend/dist/assets/Wistia-DW0x_UBn.js,sha256=8pb_39lao4WSCIC_MsWjoi2ZdrbFqpmVDf5iyvl5B9E,3516
50
+ chainlit/frontend/dist/assets/YouTube--98FipvA.js,sha256=inD312lXrzjn0F_XJ3Lc_t-ltBstkO78AGcucpxIPcA,4445
51
+ chainlit/frontend/dist/assets/index-D71nZ46o.js,sha256=P1Y5f6XElwGvfOqU_w_P8hUI_syKcxUWkTdzmt9PZFA,3733152
52
+ chainlit/frontend/dist/assets/index-g8LTJwwr.css,sha256=uruR7HQDJEhdhARMz0uJXjUecCYmqu29EQAWErVl_p0,60378
53
+ chainlit/frontend/dist/assets/logo_dark-IkGJ_IwC.svg,sha256=Kjz3QMh-oh-ag4YatjU0YCPqGF7F8nHh8VUQoJIs01E,8887
54
+ chainlit/frontend/dist/assets/logo_light-Bb_IPh6r.svg,sha256=sHjnvEq1rfqh3bcexJNYUY7WEDdTQZq3aKZYpi4w4ck,8889
55
+ chainlit/frontend/dist/assets/react-plotly-Cn_BQTQw.js,sha256=wvaAx3OpHVAvRwvRFmhDrDkKG9SzP-vJJlUOAxL1ID0,3762918
56
+ chainlit/frontend/dist/favicon.svg,sha256=0Cy8x28obT5eWW3nxZRhsEvu6_zMqrqbg0y6hT3D0Q0,6455
57
+ chainlit/frontend/dist/index.html,sha256=IWKgkOPMpQpl8VNfsW0rfaIHl0z2hmbWMKk036irFIM,972
58
+ chainlit/haystack/__init__.py,sha256=uZ77YiPy-qleSTi3dQCDO9HE6S6F6GpJWmh7jO4cxXA,217
59
+ chainlit/haystack/callbacks.py,sha256=J5t6YL3QoxyT0sg8t08nPA7b4VOGKIkmWtkbmFZXjBI,5038
60
+ chainlit/hello.py,sha256=LwENQWo5s5r8nNDn4iKSV77vX60Ky5r_qGjQhyi7qlY,416
61
+ chainlit/input_widget.py,sha256=crASWi5cijqVt90pnpWpe8fQI5TFXrS0Oj87VO1N0P4,4952
62
+ chainlit/langchain/__init__.py,sha256=zErMw0_3ufSGeF9ye7X0ZX3wDat4mTOx97T40ePDO2g,217
63
+ chainlit/langchain/callbacks.py,sha256=5TKjiHE3Ix2AgFyTq19PPMdlMvLx1bF6M4fuGAPZfP4,21535
64
+ chainlit/langflow/__init__.py,sha256=xXEWofu5NexIO-zBo_2p18w2rO6JMBntZjTfakKxxAM,818
65
+ chainlit/llama_index/__init__.py,sha256=weRoIWCaRBGvA1LczCEfsqhWsltQSVlhtRnTovtdo8w,227
66
+ chainlit/llama_index/callbacks.py,sha256=aCi39G4Sbh_MjuSZbBv3_PM5190YA5UqNTN7DrdtT1I,7282
67
+ chainlit/logger.py,sha256=wTwRSZsLfXwWy6U4351IgWAm4KCMThgxm9EZpjGUEr4,373
68
+ chainlit/markdown.py,sha256=V-Op4hyqyTTvXInU5QrHfxs0nb71lBMU8trOSAlast8,2142
69
+ chainlit/message.py,sha256=KoBretNwiS2i1BMPhRpqItlcEvyanxgaq8qh-Dwv6R0,17232
70
+ chainlit/mistralai/__init__.py,sha256=BeH3LRmJ5mUgMlOA8XS61nhoQwVreW6sENJdIrlfDXw,1508
71
+ chainlit/oauth_providers.py,sha256=AnH-bqeCnS7VgyIhgAHDI5-XkVWsFr52yo65ldePxxw,26653
72
+ chainlit/openai/__init__.py,sha256=qGC9yJydzlZffrC1oCPZwpuWwJkittDq74o6U2J_-Ho,1691
73
+ chainlit/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
74
+ chainlit/secret.py,sha256=eYbDDENGfk1XcQ-hIOT2kEejZeLi6Y3Y3qWD5Y7JbCg,293
75
+ chainlit/server.py,sha256=CHx6mIjV4y79AB_Jo_CMNbarLR0dJgJ1m2VIe2kFIoo,39280
76
+ chainlit/session.py,sha256=ILL6j_J2gmiW5qwMIpmy1oO-3sQCob-p7HDgxXufwqk,9490
77
+ chainlit/slack/__init__.py,sha256=gkC1iYlQrWHDN8bbsWOquwwlyW9DtKAe22GizJJzY7A,226
78
+ chainlit/slack/app.py,sha256=OvbbGZARI1mHOEdVvxh8KTZ35Ryi4AbdP7grjr-VU1k,11742
79
+ chainlit/socket.py,sha256=QvN54a-1wJXGMtZ-qRTaTdwKrn7pGzsIyV3v9PW2gKg,12214
80
+ chainlit/step.py,sha256=_bJZ3EuPEcLmtvpfJGpgixQcz6aTUqXEil40-BuS5xE,14312
81
+ chainlit/sync.py,sha256=pEaqdEoOp4W26p9-E11BiXemVTN4_OsYEcYyjLBEj7E,1236
82
+ chainlit/teams/__init__.py,sha256=_lUcuc5R4bYwUoC15jyKES10KTeH8ciSWqV5JyLrW6M,236
83
+ chainlit/teams/app.py,sha256=PAvlGkfF-KGe9PYT6rL8UXu4OYzsPjfTiNsysH1X8NY,10534
84
+ chainlit/telemetry.py,sha256=Rk4dnZv0OnGOgV4kD-VHdhgl4i7i3ypqhSE_R-LZceM,3060
85
+ chainlit/translations/bn.json,sha256=SkQpuJePdzsoS2nMGbAevjuwxYfPHdjwAK3Y-hXIS7A,13295
86
+ chainlit/translations/en-US.json,sha256=vXWsJpjn9l9g1U9KKgG46I5SSBMRCS-6o5u6WM46Cjk,7900
87
+ chainlit/translations/gu.json,sha256=Lte4reLPcfUSCPpTxT5_Cyj2f8Xm0iOm_bet3NPmZD8,12822
88
+ chainlit/translations/he-IL.json,sha256=MRlnth2Exzec_h4VkxGD8XcaYzvXUc4_WWwxLgSumxw,8912
89
+ chainlit/translations/hi.json,sha256=YngPlp4JPNaO69AUjj3IlIigW-Tb3r7_D6ClaRQfE_M,12520
90
+ chainlit/translations/kn.json,sha256=xQY1rEMRN9X2Gv5qvdkHvWXXCNXK7dd2HtrFi_Cr2lE,13698
91
+ chainlit/translations/ml.json,sha256=yA3cteefswH7HYyMANtXtn6Aqko7AgT8K2x7PJzYGtc,14393
92
+ chainlit/translations/mr.json,sha256=_oGZJkLOGS5A_jymsL0zdix3Lu4WuPGVy6gRFccIu-Y,12618
93
+ chainlit/translations/nl-NL.json,sha256=3YMo9nTXLHOU1WSjMjY-lIpOBsNDCpnVGJc7dFpdQHE,10308
94
+ chainlit/translations/ta.json,sha256=sxqC2ZaJ6kDyTztG6hozE5PNZe88wrzljcVrCy24RaQ,14275
95
+ chainlit/translations/te.json,sha256=xbteZu14ZxluYIeh1euWxu6fGWguvf9P-6ILWMVpkbE,13731
96
+ chainlit/translations/zh-CN.json,sha256=n-OyQsDFkW6CIwUlh3h3lxDc81ni8pQW-QHmq47ZZbE,7631
97
+ chainlit/translations.py,sha256=WG_r7HzxBYns-zk9tVvoGdoofv71okTZx8k1RlcoTIg,2034
98
+ chainlit/types.py,sha256=Kx3G-gWd6LeGQweBo5kfC6HaXYysjJT_wU7ztC784Lg,5378
99
+ chainlit/user.py,sha256=yC9WvWYogoAa-6-mBR2HNHuZdE5rejGQD4vqQixIckA,772
100
+ chainlit/user_session.py,sha256=OWkIuDuy-He9_u6NHmH_mqpMiWFNPR2RoB8Cveum4Vw,1597
101
+ chainlit/utils.py,sha256=ht6S0RM0-51_EyKZ128yRYAT294Bf3gwgMBzIHv1xRI,3990
102
+ chainlit/version.py,sha256=VcRO6Iwchkv80BWb4hRGkOnBgDhj87-Yjorcv1u5Z3g,276
103
+ chainlit-2.0.3.dist-info/METADATA,sha256=h_ur1h9BX_xaL32-4y46qG-BEppUPE9nyxlu5V8yv2k,5150
104
+ chainlit-2.0.3.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
105
+ chainlit-2.0.3.dist-info/entry_points.txt,sha256=FrkqdjrFl8juSnvBndniyX7XuKojmUwO4ghRh-CFMQc,45
106
+ chainlit-2.0.3.dist-info/RECORD,,