# Built-in operations

> **CocoIndex v1, Rust SDK (experimental).** This page documents the CocoIndex **v1** Rust SDK (the `cocoindex` crate). The Rust SDK is experimental: any release may change or remove its API, and it is not yet published on crates.io. The Python SDK pages are at https://cocoindex.io/docs/.
>
> Source: https://cocoindex.io/docs/rust/ops/ · Rust docs index: https://cocoindex.io/docs/rust/llms.txt · Rust SDK tour: https://github.com/cocoindex-io/cocoindex/blob/main/rust/sdk/SHOWCASE.md · Rust examples: https://github.com/cocoindex-io/cocoindex/tree/main/examples/rust

CocoIndex ships a set of built-in operations under the `cocoindex::ops` module,
plus `cocoindex::entity_resolution`. Each module is independently usable and
composes with the rest of a pipeline.

```rust
use cocoindex::entity_resolution;
use cocoindex::ops::{api, sentence_transformers, text};
```

Each `cocoindex::ops` module sits behind a Cargo feature of the `cocoindex` crate, so the heavy dependencies (tree-sitter grammars, the ONNX runtime, an HTTP client) are only built when used. `cocoindex::entity_resolution` needs no feature.

## Operation modules

| Module | What it provides | Cargo feature |
|---|---|---|
| [Text operations](/docs/rust/ops/text/) | Code language detection, regex-based `SeparatorSplitter`, and syntax-aware `RecursiveSplitter` (tree-sitter) returning position-tracked [`Chunk`](/docs/rust/common_resources/data_types/#chunk)s. `cocoindex::ops::text`. | `text` |
| [Sentence Transformers](/docs/rust/ops/sentence_transformers/) | Local text embeddings from sentence-transformers ONNX models through `fastembed`, memoized and batched, on the GPU runner. `cocoindex::ops::sentence_transformers`. | `fastembed` |
| [Model APIs](/docs/rust/ops/model_apis/) | Embeddings, audio transcription and JSON-mode chat (with typed `extract`) over any OpenAI-compatible HTTP API: `ApiEmbedder`, `ApiTranscriber`, `ApiChatClient`, `LlmPairResolver`. `cocoindex::ops::api`. | `embed_api` |
| [Entity resolution](/docs/rust/ops/entity_resolution/) | Deduplicate entity names via embedding similarity plus a pluggable LLM pair-resolver, with `Pinned` / `Preferred` canonical policies. `cocoindex::entity_resolution`. | none; `LlmPairResolver` needs `embed_api` |

## Most common: chunking code and text

The most-used built-in is `RecursiveSplitter`. It does syntax-aware splitting that
respects language structure (functions, classes, blocks) via tree-sitter, falling
back to separator-based splitting for unsupported languages.

```rust
use cocoindex::ops::text::{RecursiveChunkConfig, RecursiveSplitter};

let splitter = RecursiveSplitter::new()?;

let chunks = splitter.split_with(
    &text,
    RecursiveChunkConfig {
        chunk_size: 1000,
        min_chunk_size: Some(300),
        chunk_overlap: Some(300),
        language: Some("python".to_string()),
    },
);
```

It tries to keep each output chunk between `min_chunk_size` and `chunk_size`, splitting
at the highest-level boundary that fits and descending to finer boundaries when a piece
is still too large. See [Text operations](/docs/rust/ops/text/) for the full parameter reference,
supported languages, and custom-language configuration.

## Embeddings

Two interchangeable embedding backends are available, both providing a
`VectorSchemaProvider` so vector columns are configured automatically by connectors:

- [`SentenceTransformerEmbedder`](/docs/rust/ops/sentence_transformers/) runs locally through `fastembed`, no API key.
- [`ApiEmbedder`](/docs/rust/ops/model_apis/#embeddings) reaches any OpenAI-compatible endpoint.

Both also implement the [`Embedder`](/docs/rust/common_resources/data_types/#embedder) trait, so either one plugs into [entity resolution](/docs/rust/ops/entity_resolution/).
