We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9e42cf3 commit 872f238Copy full SHA for 872f238
python/llama-index-server/llama_index/server/api/utils/chat_request.py
@@ -4,11 +4,13 @@
4
5
6
def get_artifacts(chat_request: ChatRequest) -> List[Artifact]:
7
- return [
+ """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))
14
15
16
def get_last_artifact(chat_request: ChatRequest) -> Optional[Artifact]:
0 commit comments