Skip to content

chunking

Package github.com/emergent-company/emergent.memory/apps/server/pkg/sdk/chunking

The chunking client re-runs the chunking pipeline on an already-ingested document, using the project's current chunking strategy.

Methods

func (c *Client) RecreateChunks(ctx context.Context, documentID string) (*RecreateChunksResponse, error)

Key Types

RecreateChunksResponse

type RecreateChunksResponse struct {
    JobID   string
    Summary RecreateChunksSummary
}

type RecreateChunksSummary struct {
    DocumentID    string
    OldChunkCount int
    NewChunkCount int
    Status        string
}

Example

resp, err := client.Chunking.RecreateChunks(ctx, "doc_abc123")
if err != nil {
    return err
}
fmt.Printf("Re-chunked %s: %d → %d chunks (job: %s)\n",
    resp.Summary.DocumentID,
    resp.Summary.OldChunkCount,
    resp.Summary.NewChunkCount,
    resp.JobID,
)

When to use

Call RecreateChunks after changing the project's chunking strategy to apply the new strategy to existing documents, without re-uploading them.