Skip to content

Classify chunks with streaming results

POST
/knowledge-bases/{knowledgeBaseId}/classify/stream

Same as /classify but streams results as Server-Sent Events. Each event contains a single classified chunk.

knowledgeBaseId
required

ID of the knowledge base

string

ID of the knowledge base

object
chunks

Chunks to classify directly (alternative to query)

Array<object>
object
chunkId
required

Unique identifier for the chunk

string
content
required

Text content of the chunk

string
query

Query to fetch chunks (alternative to providing chunks)

string
queryOptions

Options for fetching chunks via query

object
limit

Maximum number of chunks to fetch via query

integer
default: 10
model

Embedding model to use for query (defaults to primary)

string
Allowed values: BAAI/bge-small-en-v1.5 BAAI/bge-base-en-v1.5 BAAI/bge-large-en-v1.5 sentence-transformers/all-MiniLM-L6-v2 sentence-transformers/all-mpnet-base-v2 nomic-ai/nomic-embed-text-v1.5
preset

Use a built-in classification preset

string
Allowed values: tri-state evidence-quality relevance-scored
labels

Simple classification labels (e.g., [‘supporting’, ‘contradicting’, ‘neutral’])

Array<string>
>= 2 items
labelDefinitions

Detailed label definitions with natural language guidance

Array<object>
>= 2 items
object
name
required
string
>= 1 characters
when
required
string
>= 1 characters
jsonSchema

Custom JSON Schema for advanced classification (power users)

object
key
additional properties
nullable
options

Classification behavior options

object
multiSelect
boolean
includeConfidence
boolean
includeReasoning
boolean
context

Additional context to help the LLM classify chunks accurately

string
batchSize

Number of chunks to classify per LLM call (default: 5)

integer
default: 5

Streaming classification results (SSE)

Server-Sent Events stream with chunk classification results

string

Bad Request - Validation error or invalid input

object
error
required
string
code
string
details
nullable
retryable
boolean

Unauthorized - Authentication required or invalid token

object
error
required
string
code
string
details
nullable
retryable
boolean

Forbidden - Insufficient permissions

object
error
required
string
code
string
details
nullable
retryable
boolean

Not Found - Resource does not exist

object
error
required
string
code
string
details
nullable
retryable
boolean