LCORE-383: Fix attachments in /conversations HACK #286
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR is one of 2 that is being proposed to close LCORE-383.
Basically what is happening is that attachment content is being appended to messages when accessing them through the
/conversations
endpoint.This error can be seen below along with what it looks like after the fix.
Before Fix
This is when the attachment is sent before using the


/conversations
endpoint to reload the saved conversation.This is after the
/conversations
endpoint is used to reload the conversation.After Fix
This is when the attachment is sent before using the


/conversations
endpoint to reload the saved conversation.This is after the
/conversations
endpoint is used to reload the conversation.This is what the response of the
/conversations
endpoint looks like:I originally wanted to solve this by leveraging the session data in llama-stack to extract the attachment content, however because we pass the message as a string and not a list of
InterleavedContentItem
's it directly appends the content to the message content string making it difficult to remove.This PR represents solving the issue in a hacky way that does fully meet the acceptance criteria of LCORE-383. What it does is adds another
TextContentItem
after the original user message (but before theTextContentItem
s that contain the attachment content) that contains the attachment meta data. This item is denoted by having<attachment_info>
tags.The attachment metadata is combined with the attachment content to enhance the conversation endpoint response as shown in the jira ticket.
The issue with this however is that we are introducing more context into the query.
Type of change
Related Tickets & Documents
Checklist before requesting a review
Testing