Skip to main content
POST
/
api
/
ai
/
personal-stream
/
qanda-stream
Send a message with HTTP SSE streaming response
curl --request POST \
  --url https://pria.praxislxp.com/api/ai/personal-stream/qanda-stream \
  --header 'Content-Type: application/json' \
  --header 'x-access-token: <api-key>' \
  --data '
{
  "inputs": [
    "What is machine learning?"
  ],
  "requestArgs": {
    "selectedCourse": {
      "course_id": 1750532703472,
      "course_name": "AI Fundamentals",
      "assistant": {
        "_id": "6856fa89cbafcff8d98680f5"
      }
    },
    "ragOnly": false,
    "userTimezone": "America/New_York"
  }
}
'
"data: {\"type\":\"connected\",\"message\":\"Stream connected\"}\n\ndata: {\"type\":\"stream\",\"prompt\":\"Machine learning is a branch of AI...\"}\n\ndata: {\"type\":\"complete\",\"success\":true,\"usage\":1234,\"model\":\"gpt-4o\"}\n\ndata: {\"type\":\"done\"}\n"

Authorizations

x-access-token
string
header
required

JWT token passed in x-access-token header

Body

application/json

Request payload for SSE streaming Q&A

inputs
string[]
required

User messages to send to the AI

Example:
["What is machine learning?"]
requestArgs
object

Optional context arguments

Response

SSE stream of AI response chunks

Server-Sent Event payload structure for HTTP streaming

type
enum<string>

Event type indicator:

  • connected: Stream established successfully
  • stream: AI-generated text chunk
  • tool: Tool/function being invoked (RAG, web search, etc.)
  • complete: Final response with usage metrics
  • error: Error occurred during processing
  • done: Stream terminated
Available options:
connected,
stream,
tool,
complete,
error,
done
prompt
string

Text content chunk (stream events only)

message
string

Status message (connected events only)

name
string

Tool/function name being invoked (tool events only)

status
string

Tool execution status (tool events only)

success
boolean

Request success indicator (complete events only)

usage
number

Total tokens consumed (complete events only)

outputs
string[]

Full AI response (complete events only)

model
string

AI model used (complete events only)

error
object

Error details (error events only)