File tree 1 file changed +12
-7
lines changed
python/llama-index-server/llama_index/server/api/utils 1 file changed +12
-7
lines changed Original file line number Diff line number Diff line change 4
4
5
5
6
6
def get_artifacts (chat_request : ChatRequest ) -> List [Artifact ]:
7
- """Return a list of artifacts sorted by their creation time. Artifacts without a creation time are placed at the end."""
8
- artifacts = [
9
- Artifact .from_message (message ) # type: ignore
10
- for message in chat_request .messages
11
- if Artifact .from_message (message ) is not None
12
- ]
13
- return sorted (artifacts , key = lambda a : (a .created_at is None , a .created_at ))
7
+ """
8
+ Return a list of artifacts sorted by their creation time.
9
+ Artifacts without a creation time are placed at the end.
10
+ """
11
+ return sorted (
12
+ [
13
+ artifact
14
+ for artifact in (Artifact .from_message (m ) for m in chat_request .messages )
15
+ if artifact is not None
16
+ ],
17
+ key = lambda a : (a .created_at is None , a .created_at ),
18
+ )
14
19
15
20
16
21
def get_last_artifact (chat_request : ChatRequest ) -> Optional [Artifact ]:
You can’t perform that action at this time.
0 commit comments