Skip to content

Save message in chat api

Gosia Ksionek requested to merge mk-fix-api into master

What does this MR do and why?

We need to save the incoming question in the chat storage to preserve to integrity of the conversation and be able to have full history in the prompt.

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Before After

How to set up and validate locally

Run those two requests and observe the prompt in the llm.log

curl -X POST "http://127.0.0.1:3000/api/v4/chat/completions" \
     -H "Content-Type: application/json" \
     -H "PRIVATE-TOKEN: TOKEN" \
     -d '{"content": "Tell me about yourself"}'
curl -X POST "http://127.0.0.1:3000/api/v4/chat/completions" \
     -H "Content-Type: application/json" \
     -H "PRIVATE-TOKEN: TOKEN" \
     -d '{"content": "Rewrite the previous answer using bullet points"}'

Merge request reports