Skip to content

Latest commit

 

History

History
57 lines (39 loc) · 2.56 KB

File metadata and controls

57 lines (39 loc) · 2.56 KB

Chunking

Overview

Available Operations

parse

Split large text documents into smaller, manageable chunks using different chunking strategies optimized for RAG (Retrieval-Augmented Generation) workflows. This endpoint supports multiple chunking algorithms including token-based, sentence-based, recursive, semantic, and specialized strategies.

Example Usage

from orq_ai_sdk import Orq
import os


with Orq(
    api_key=os.getenv("ORQ_API_KEY", ""),
) as orq:

    res = orq.chunking.parse(request={
        "text": "The quick brown fox jumps over the lazy dog. This is a sample text that will be chunked into smaller pieces. Each chunk will maintain context while respecting the maximum chunk size.",
        "metadata": True,
        "strategy": "semantic",
        "chunk_size": 256,
        "threshold": 0.8,
        "embedding_model": "openai/text-embedding-3-small",
        "dimensions": 512,
        "mode": "window",
        "similarity_window": 1,
    })

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
request models.ParseChunkingRequest ✔️ The request object to use for the request.
retries Optional[utils.RetryConfig] ➖ Configuration to override the default retry behavior of the client.

Response

models.ParseResponse

Errors

Error Type Status Code Content Type
models.APIDefaultError 4XX, 5XX */*