Files
fil/docs/snippets/python/api/client_chunk_text.md
Henrik Jess Nielsen b4c07d3693
All checks were successful
Deploy fil (kreuzberg) / deploy (push) Successful in 49s
Nomad changes
2026-06-01 23:40:55 +02:00

680 B

import asyncio

import httpx


async def main() -> None:
    payload = {
        "text": "Your long text content here...",
        "chunker_type": "text",
        "config": {
            "max_characters": 1000,
            "overlap": 50,
            "trim": True,
        },
    }

    async with httpx.AsyncClient() as client:
        response = await client.post("http://localhost:8000/chunk", json=payload)
    result = response.json()

    print(f"Created {result['chunk_count']} chunks")
    for chunk in result["chunks"]:
        preview = chunk["content"][:50]
        print(f"Chunk {chunk['chunk_index']}: {preview}...")


asyncio.run(main())