Prediction

Send message to flow and get AI response

post

Send a message to your flow and receive an AI-generated response. This is the primary endpoint for interacting with your flows and assistants.Authentication: API key may be required depending on flow settings.

Authorizations
Path parameters
idstringRequired

Flow ID - the unique identifier of your flow

Example: your-flow-id
Body
questionstringOptional

The question/message to send to the flow

Example: What is artificial intelligence?
streamingbooleanOptional

Enable streaming responses for real-time output

Default: falseExample: false
Responses
200
Successful prediction response
application/json
post
POST /prediction/{id} HTTP/1.1
Host: 
Authorization: Bearer JWT
Content-Type: application/json
Accept: */*
Content-Length: 628

{
  "question": "What is artificial intelligence?",
  "form": {
    "title": "Example",
    "count": 1
  },
  "streaming": false,
  "overrideConfig": {
    "sessionId": "user-session-123",
    "temperature": 0.7,
    "maxTokens": 500,
    "vars": {
      "user_name": "Alice"
    }
  },
  "history": [
    {
      "role": "apiMessage",
      "content": "Hello! I'm an AI assistant. How can I help you today?"
    },
    {
      "role": "userMessage",
      "content": "Hi, my name is Sarah and I'm learning about AI"
    }
  ],
  "uploads": [
    {
      "type": "file",
      "name": "example.png",
      "data": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAABjElEQVRIS+2Vv0oDQRDG",
      "mime": "image/png"
    }
  ],
  "humanInput": {
    "type": "reject",
    "feedback": "Include more emoji"
  }
}
{
  "text": "Artificial intelligence (AI) is a branch of computer science that focuses on creating systems capable of performing tasks that typically require human intelligence.",
  "json": {},
  "question": "What is artificial intelligence?",
  "chatId": "chat-12345",
  "chatMessageId": "msg-67890",
  "sessionId": "user-session-123",
  "memoryType": "Buffer Memory",
  "sourceDocuments": [
    {
      "pageContent": "This is the content of the page.",
      "metadata": {
        "author": "John Doe",
        "date": "2024-08-24"
      }
    }
  ],
  "usedTools": [
    {
      "tool": "Name of the tool",
      "toolInput": {
        "input": "search query"
      },
      "toolOutput": "text"
    }
  ]
}

Last updated