Skip to main content
{
  "chunks": [
    {
      "text": "<string>",
      "start_index": 123,
      "end_index": 123,
      "token_count": 123,
      "context": "<string>",
      "embedding": [
        {}
      ]
    }
  ]
}
Run a saved pipeline to process text or documents and return chunks.

Examples

from chonkie.cloud import Pipeline

# Execute with text
pipeline = Pipeline.get("my-rag-pipeline")
chunks = pipeline.run(text="Your document text here...")

# Execute with multiple texts
chunks = pipeline.run(text=["First document", "Second document"])

# Execute with file (auto-uploaded)
chunks = pipeline.run(file="document.pdf")

# Access chunk data
for chunk in chunks:
    print(f"Text: {chunk.text[:100]}...")
    print(f"Tokens: {chunk.token_count}")

Path Parameters

slug
string
required
The pipeline slug to execute.

Request

text
string | array
Text content to process. Can be a single string or array of strings.
file
object
File reference for document processing. Use after uploading via the file upload endpoint.
Provide either text or file, not both.

Response

chunks
array
Array of chunk objects returned by the pipeline.

Errors

StatusDescription
400Invalid request (missing text/file or both provided)
404Pipeline not found
422Processing error