chainlit 1.0.500__py3-none-any.whl → 1.0.501__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/copilot/dist/index.js +77 -77
- chainlit/data/__init__.py +18 -15
- chainlit/frontend/dist/assets/{index-dc38064c.js → index-e306c2e5.js} +84 -84
- chainlit/frontend/dist/assets/{react-plotly-df285644.js → react-plotly-cc656f1c.js} +1 -1
- chainlit/frontend/dist/index.html +1 -1
- chainlit/llama_index/callbacks.py +35 -6
- chainlit/message.py +9 -0
- chainlit/openai/__init__.py +3 -4
- chainlit/playground/config.py +0 -4
- chainlit/playground/providers/__init__.py +0 -2
- chainlit/playground/providers/openai.py +5 -27
- chainlit/server.py +4 -2
- chainlit/step.py +10 -1
- {chainlit-1.0.500.dist-info → chainlit-1.0.501.dist-info}/METADATA +4 -4
- {chainlit-1.0.500.dist-info → chainlit-1.0.501.dist-info}/RECORD +17 -19
- chainlit/translations/de.json +0 -161
- chainlit/translations/pt-BR.json +0 -157
- {chainlit-1.0.500.dist-info → chainlit-1.0.501.dist-info}/WHEEL +0 -0
- {chainlit-1.0.500.dist-info → chainlit-1.0.501.dist-info}/entry_points.txt +0 -0
chainlit/data/__init__.py
CHANGED
|
@@ -10,10 +10,8 @@ from chainlit.context import context
|
|
|
10
10
|
from chainlit.logger import logger
|
|
11
11
|
from chainlit.session import WebsocketSession
|
|
12
12
|
from chainlit.types import Feedback, Pagination, ThreadDict, ThreadFilter
|
|
13
|
-
from chainlit.user import PersistedUser, User
|
|
14
|
-
from literalai import Attachment, PageInfo, PaginatedResponse
|
|
15
|
-
from literalai import Score as LiteralScore
|
|
16
|
-
from literalai import Step as LiteralStep
|
|
13
|
+
from chainlit.user import PersistedUser, User
|
|
14
|
+
from literalai import Attachment, PageInfo, PaginatedResponse, Score as LiteralScore, Step as LiteralStep
|
|
17
15
|
from literalai.filter import threads_filters as LiteralThreadsFilters
|
|
18
16
|
from literalai.step import StepDict as LiteralStepDict
|
|
19
17
|
|
|
@@ -128,9 +126,9 @@ _data_layer: Optional[BaseDataLayer] = None
|
|
|
128
126
|
|
|
129
127
|
class ChainlitDataLayer(BaseDataLayer):
|
|
130
128
|
def __init__(self, api_key: str, server: Optional[str]):
|
|
131
|
-
from literalai import
|
|
129
|
+
from literalai import AsyncLiteralClient
|
|
132
130
|
|
|
133
|
-
self.client =
|
|
131
|
+
self.client = AsyncLiteralClient(api_key=api_key, url=server)
|
|
134
132
|
logger.info("Chainlit data layer initialized")
|
|
135
133
|
|
|
136
134
|
def attachment_to_element_dict(self, attachment: Attachment) -> "ElementDict":
|
|
@@ -327,13 +325,16 @@ class ChainlitDataLayer(BaseDataLayer):
|
|
|
327
325
|
|
|
328
326
|
@queue_until_user_message()
|
|
329
327
|
async def create_step(self, step_dict: "StepDict"):
|
|
330
|
-
metadata =
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
328
|
+
metadata = dict(
|
|
329
|
+
step_dict.get("metadata", {}),
|
|
330
|
+
**{
|
|
331
|
+
"disableFeedback": step_dict.get("disableFeedback"),
|
|
332
|
+
"isError": step_dict.get("isError"),
|
|
333
|
+
"waitForAnswer": step_dict.get("waitForAnswer"),
|
|
334
|
+
"language": step_dict.get("language"),
|
|
335
|
+
"showInput": step_dict.get("showInput"),
|
|
336
|
+
},
|
|
337
|
+
)
|
|
337
338
|
|
|
338
339
|
step: LiteralStepDict = {
|
|
339
340
|
"createdAt": step_dict.get("createdAt"),
|
|
@@ -345,6 +346,7 @@ class ChainlitDataLayer(BaseDataLayer):
|
|
|
345
346
|
"name": step_dict.get("name"),
|
|
346
347
|
"threadId": step_dict.get("threadId"),
|
|
347
348
|
"type": step_dict.get("type"),
|
|
349
|
+
"tags": step_dict.get("tags"),
|
|
348
350
|
"metadata": metadata,
|
|
349
351
|
}
|
|
350
352
|
if step_dict.get("input"):
|
|
@@ -453,7 +455,7 @@ class ChainlitDataLayer(BaseDataLayer):
|
|
|
453
455
|
tags: Optional[List[str]] = None,
|
|
454
456
|
):
|
|
455
457
|
await self.client.api.upsert_thread(
|
|
456
|
-
|
|
458
|
+
id=thread_id,
|
|
457
459
|
name=name,
|
|
458
460
|
participant_id=user_id,
|
|
459
461
|
metadata=metadata,
|
|
@@ -462,7 +464,8 @@ class ChainlitDataLayer(BaseDataLayer):
|
|
|
462
464
|
|
|
463
465
|
|
|
464
466
|
if api_key := os.environ.get("LITERAL_API_KEY"):
|
|
465
|
-
|
|
467
|
+
# support legacy LITERAL_SERVER variable as fallback
|
|
468
|
+
server = os.environ.get("LITERAL_API_URL", os.environ.get("LITERAL_SERVER"))
|
|
466
469
|
_data_layer = ChainlitDataLayer(api_key=api_key, server=server)
|
|
467
470
|
|
|
468
471
|
|