chainlit 2.7.0__py3-none-any.whl → 2.7.1__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 (85) hide show
  1. {chainlit-2.7.0.dist-info → chainlit-2.7.1.dist-info}/METADATA +1 -1
  2. chainlit-2.7.1.dist-info/RECORD +4 -0
  3. chainlit/__init__.py +0 -207
  4. chainlit/__main__.py +0 -4
  5. chainlit/_utils.py +0 -8
  6. chainlit/action.py +0 -33
  7. chainlit/auth/__init__.py +0 -95
  8. chainlit/auth/cookie.py +0 -197
  9. chainlit/auth/jwt.py +0 -42
  10. chainlit/cache.py +0 -45
  11. chainlit/callbacks.py +0 -433
  12. chainlit/chat_context.py +0 -64
  13. chainlit/chat_settings.py +0 -34
  14. chainlit/cli/__init__.py +0 -235
  15. chainlit/config.py +0 -621
  16. chainlit/context.py +0 -112
  17. chainlit/data/__init__.py +0 -111
  18. chainlit/data/acl.py +0 -19
  19. chainlit/data/base.py +0 -107
  20. chainlit/data/chainlit_data_layer.py +0 -687
  21. chainlit/data/dynamodb.py +0 -616
  22. chainlit/data/literalai.py +0 -501
  23. chainlit/data/sql_alchemy.py +0 -741
  24. chainlit/data/storage_clients/__init__.py +0 -0
  25. chainlit/data/storage_clients/azure.py +0 -84
  26. chainlit/data/storage_clients/azure_blob.py +0 -94
  27. chainlit/data/storage_clients/base.py +0 -28
  28. chainlit/data/storage_clients/gcs.py +0 -101
  29. chainlit/data/storage_clients/s3.py +0 -88
  30. chainlit/data/utils.py +0 -29
  31. chainlit/discord/__init__.py +0 -6
  32. chainlit/discord/app.py +0 -364
  33. chainlit/element.py +0 -454
  34. chainlit/emitter.py +0 -450
  35. chainlit/hello.py +0 -12
  36. chainlit/input_widget.py +0 -182
  37. chainlit/langchain/__init__.py +0 -6
  38. chainlit/langchain/callbacks.py +0 -682
  39. chainlit/langflow/__init__.py +0 -25
  40. chainlit/llama_index/__init__.py +0 -6
  41. chainlit/llama_index/callbacks.py +0 -206
  42. chainlit/logger.py +0 -16
  43. chainlit/markdown.py +0 -57
  44. chainlit/mcp.py +0 -99
  45. chainlit/message.py +0 -619
  46. chainlit/mistralai/__init__.py +0 -50
  47. chainlit/oauth_providers.py +0 -835
  48. chainlit/openai/__init__.py +0 -53
  49. chainlit/py.typed +0 -0
  50. chainlit/secret.py +0 -9
  51. chainlit/semantic_kernel/__init__.py +0 -111
  52. chainlit/server.py +0 -1616
  53. chainlit/session.py +0 -304
  54. chainlit/sidebar.py +0 -55
  55. chainlit/slack/__init__.py +0 -6
  56. chainlit/slack/app.py +0 -427
  57. chainlit/socket.py +0 -381
  58. chainlit/step.py +0 -490
  59. chainlit/sync.py +0 -43
  60. chainlit/teams/__init__.py +0 -6
  61. chainlit/teams/app.py +0 -348
  62. chainlit/translations/bn.json +0 -214
  63. chainlit/translations/el-GR.json +0 -214
  64. chainlit/translations/en-US.json +0 -214
  65. chainlit/translations/fr-FR.json +0 -214
  66. chainlit/translations/gu.json +0 -214
  67. chainlit/translations/he-IL.json +0 -214
  68. chainlit/translations/hi.json +0 -214
  69. chainlit/translations/ja.json +0 -214
  70. chainlit/translations/kn.json +0 -214
  71. chainlit/translations/ml.json +0 -214
  72. chainlit/translations/mr.json +0 -214
  73. chainlit/translations/nl.json +0 -214
  74. chainlit/translations/ta.json +0 -214
  75. chainlit/translations/te.json +0 -214
  76. chainlit/translations/zh-CN.json +0 -214
  77. chainlit/translations.py +0 -60
  78. chainlit/types.py +0 -334
  79. chainlit/user.py +0 -43
  80. chainlit/user_session.py +0 -153
  81. chainlit/utils.py +0 -173
  82. chainlit/version.py +0 -8
  83. chainlit-2.7.0.dist-info/RECORD +0 -84
  84. {chainlit-2.7.0.dist-info → chainlit-2.7.1.dist-info}/WHEEL +0 -0
  85. {chainlit-2.7.0.dist-info → chainlit-2.7.1.dist-info}/entry_points.txt +0 -0
chainlit/cli/__init__.py DELETED
@@ -1,235 +0,0 @@
1
- import asyncio
2
- import os
3
-
4
- import click
5
- import nest_asyncio
6
- import uvicorn
7
-
8
- # Not sure if it is necessary to call nest_asyncio.apply() before the other imports
9
- nest_asyncio.apply()
10
-
11
- # ruff: noqa: E402
12
- from chainlit.auth import ensure_jwt_secret
13
- from chainlit.cache import init_lc_cache
14
- from chainlit.config import (
15
- BACKEND_ROOT,
16
- DEFAULT_HOST,
17
- DEFAULT_PORT,
18
- DEFAULT_ROOT_PATH,
19
- config,
20
- init_config,
21
- lint_translations,
22
- load_module,
23
- )
24
- from chainlit.logger import logger
25
- from chainlit.markdown import init_markdown
26
- from chainlit.secret import random_secret
27
- from chainlit.utils import check_file
28
-
29
-
30
- def assert_app():
31
- if (
32
- not config.code.on_chat_start
33
- and not config.code.on_message
34
- and not config.code.on_audio_chunk
35
- ):
36
- raise Exception(
37
- "You need to configure at least one of on_chat_start, on_message or on_audio_chunk callback"
38
- )
39
-
40
-
41
- # Create the main command group for Chainlit CLI
42
- @click.group(context_settings={"auto_envvar_prefix": "CHAINLIT"})
43
- @click.version_option(prog_name="Chainlit")
44
- def cli():
45
- return
46
-
47
-
48
- # Define the function to run Chainlit with provided options
49
- def run_chainlit(target: str):
50
- host = os.environ.get("CHAINLIT_HOST", DEFAULT_HOST)
51
- port = int(os.environ.get("CHAINLIT_PORT", DEFAULT_PORT))
52
- root_path = os.environ.get("CHAINLIT_ROOT_PATH", DEFAULT_ROOT_PATH)
53
-
54
- ssl_certfile = os.environ.get("CHAINLIT_SSL_CERT", None)
55
- ssl_keyfile = os.environ.get("CHAINLIT_SSL_KEY", None)
56
-
57
- ws_per_message_deflate_env = os.environ.get(
58
- "UVICORN_WS_PER_MESSAGE_DEFLATE", "true"
59
- )
60
- ws_per_message_deflate = ws_per_message_deflate_env.lower() in [
61
- "true",
62
- "1",
63
- "yes",
64
- ] # Convert to boolean
65
-
66
- ws_protocol = os.environ.get("UVICORN_WS_PROTOCOL", "auto")
67
-
68
- config.run.host = host
69
- config.run.port = port
70
- config.run.root_path = root_path
71
-
72
- from chainlit.server import app
73
-
74
- check_file(target)
75
- # Load the module provided by the user
76
- config.run.module_name = target
77
- load_module(config.run.module_name)
78
-
79
- ensure_jwt_secret()
80
- assert_app()
81
-
82
- # Create the chainlit.md file if it doesn't exist
83
- init_markdown(config.root)
84
-
85
- # Initialize the LangChain cache if installed and enabled
86
- init_lc_cache()
87
-
88
- log_level = "debug" if config.run.debug else "error"
89
-
90
- # Start the server
91
- async def start():
92
- config = uvicorn.Config(
93
- app,
94
- host=host,
95
- port=port,
96
- ws=ws_protocol,
97
- log_level=log_level,
98
- ws_per_message_deflate=ws_per_message_deflate,
99
- ssl_keyfile=ssl_keyfile,
100
- ssl_certfile=ssl_certfile,
101
- )
102
- server = uvicorn.Server(config)
103
- await server.serve()
104
-
105
- # Run the asyncio event loop instead of uvloop to enable re entrance
106
- asyncio.run(start())
107
- # uvicorn.run(app, host=host, port=port, log_level=log_level)
108
-
109
-
110
- # Define the "run" command for Chainlit CLI
111
- @cli.command("run")
112
- @click.argument("target", required=True, envvar="RUN_TARGET")
113
- @click.option(
114
- "-w",
115
- "--watch",
116
- default=False,
117
- is_flag=True,
118
- envvar="WATCH",
119
- help="Reload the app when the module changes",
120
- )
121
- @click.option(
122
- "-h",
123
- "--headless",
124
- default=False,
125
- is_flag=True,
126
- envvar="HEADLESS",
127
- help="Will prevent to auto open the app in the browser",
128
- )
129
- @click.option(
130
- "-d",
131
- "--debug",
132
- default=False,
133
- is_flag=True,
134
- envvar="DEBUG",
135
- help="Set the log level to debug",
136
- )
137
- @click.option(
138
- "-c",
139
- "--ci",
140
- default=False,
141
- is_flag=True,
142
- envvar="CI",
143
- help="Flag to run in CI mode",
144
- )
145
- @click.option(
146
- "--no-cache",
147
- default=False,
148
- is_flag=True,
149
- envvar="NO_CACHE",
150
- help="Useful to disable third parties cache, such as langchain.",
151
- )
152
- @click.option(
153
- "--ssl-cert",
154
- default=None,
155
- envvar="CHAINLIT_SSL_CERT",
156
- help="Specify the file path for the SSL certificate.",
157
- )
158
- @click.option(
159
- "--ssl-key",
160
- default=None,
161
- envvar="CHAINLIT_SSL_KEY",
162
- help="Specify the file path for the SSL key",
163
- )
164
- @click.option("--host", help="Specify a different host to run the server on")
165
- @click.option("--port", help="Specify a different port to run the server on")
166
- @click.option("--root-path", help="Specify a different root path to run the server on")
167
- def chainlit_run(
168
- target,
169
- watch,
170
- headless,
171
- debug,
172
- ci,
173
- no_cache,
174
- ssl_cert,
175
- ssl_key,
176
- host,
177
- port,
178
- root_path,
179
- ):
180
- if host:
181
- os.environ["CHAINLIT_HOST"] = host
182
- if port:
183
- os.environ["CHAINLIT_PORT"] = port
184
- if bool(ssl_cert) != bool(ssl_key):
185
- raise click.UsageError(
186
- "Both --ssl-cert and --ssl-key must be provided together."
187
- )
188
- if ssl_cert:
189
- os.environ["CHAINLIT_SSL_CERT"] = ssl_cert
190
- os.environ["CHAINLIT_SSL_KEY"] = ssl_key
191
- if root_path:
192
- os.environ["CHAINLIT_ROOT_PATH"] = root_path
193
- if ci:
194
- logger.info("Running in CI mode")
195
-
196
- no_cache = True
197
- # This is required to have OpenAI LLM providers available for the CI run
198
- os.environ["OPENAI_API_KEY"] = "sk-FAKE-OPENAI-API-KEY"
199
-
200
- config.run.headless = headless
201
- config.run.debug = debug
202
- config.run.no_cache = no_cache
203
- config.run.ci = ci
204
- config.run.watch = watch
205
- config.run.ssl_cert = ssl_cert
206
- config.run.ssl_key = ssl_key
207
-
208
- run_chainlit(target)
209
-
210
-
211
- @cli.command("hello")
212
- @click.argument("args", nargs=-1)
213
- def chainlit_hello(args=None, **kwargs):
214
- hello_path = os.path.join(BACKEND_ROOT, "hello.py")
215
- run_chainlit(hello_path)
216
-
217
-
218
- @cli.command("init")
219
- @click.argument("args", nargs=-1)
220
- def chainlit_init(args=None, **kwargs):
221
- init_config(log=True)
222
-
223
-
224
- @cli.command("create-secret")
225
- @click.argument("args", nargs=-1)
226
- def chainlit_create_secret(args=None, **kwargs):
227
- print(
228
- f'Copy the following secret into your .env file. Once it is set, changing it will logout all users with active sessions.\nCHAINLIT_AUTH_SECRET="{random_secret()}"'
229
- )
230
-
231
-
232
- @cli.command("lint-translations")
233
- @click.argument("args", nargs=-1)
234
- def chainlit_lint_translations(args=None, **kwargs):
235
- lint_translations()