Skip to content

Follow-up questions

People rarely ask complete questions. After “Is parking free?” they ask “and on Saturdays?”. Beru understands a follow-up when you send it in the same conversation.

  1. Ask with an end_user_id. The answer starts a conversation and returns its conversation_id.
  2. Send that conversation_id with the next question from the same person.
  3. Beru rewrites the follow-up into a question that stands on its own, using the last three turns, searches with it, and answers with the earlier turns in mind. Citations still come only from your documents.
Terminal window
# First question: starts a conversation
curl https://api.beru.airesearchlabs.si/v1/answer \
-H "Authorization: Bearer $BERU_API_KEY" \
-H "Content-Type: application/json" \
-d '{"query": "Is parking free?", "end_user_id": "user_123"}'
# → { "answer": "Yes, parking behind the clinic is free [1].", "conversation_id": "9f3c…", "standalone_query": null, … }
# Follow-up: same end user, same conversation
curl https://api.beru.airesearchlabs.si/v1/answer \
-H "Authorization: Bearer $BERU_API_KEY" \
-H "Content-Type: application/json" \
-d '{"query": "And on Saturdays?", "end_user_id": "user_123", "conversation_id": "9f3c…"}'
# → { "answer": "Yes, it's free on Saturdays too [1].",
# "standalone_query": "Is parking behind the clinic free on Saturdays?", … }

standalone_query shows what Beru searched for. It’s null on a conversation’s first question.

Rule Why
A conversation needs an end_user_id It belongs to that person. conversation_id without end_user_id is a 422
Only that end user can continue it Anyone else, or another project, gets 404 not_found, the same as an id that doesn’t exist
Leave conversation_id out to start afresh Every answer with an end_user_id and no conversation_id starts a new conversation
Each turn is one question The rewrite’s model tokens are tracked, but you’re not charged an extra question

If you get 404 for a conversation you sent before, the person’s data was erased: start a new conversation by leaving conversation_id out.

POST /v1/retrieve accepts the same conversation_id and end_user_id. It rewrites a follow-up before searching and returns standalone_query, but it never starts a conversation (there’s no answer to keep). Start it with /v1/answer, or keep your own history and send standalone questions. See Use your own model.

The widget and hosted chat page do this for you: a visitor’s conversation lasts for their visit to your site, in that browser tab.