---
title: "Local knowledge"
slug: plugins/unity/Samples~/LocalKnowledge
---

<a id="local-knowledge"></a>

Attach `LocalKnowledgeExample` and `AstralRuntimeInitializer` to a GameObject.
`BuildIndex` splits the serialized document into overlapping word ranges,
embeds each chunk, and inserts the records and vectors in one memory-index
batch. `Search` embeds a question and prints the highest-scoring source chunks.

`Save` and `Load` persist the native index under
`Application.persistentDataPath`. Keep the same document and embedding model
when restoring a snapshot because search results refer to the original chunk
indices and vector dimension.

Configure an embeddings-capable GGUF model before indexing content.

Source: [View the pinned source](https://github.com/Cosmin-B/astral-runtime/blob/f2d13b77c70624ede5bc06823d4a794a4b955e10/plugins/unity/Samples~/LocalKnowledge/README.md) · [Edit this source](https://github.com/Cosmin-B/astral-runtime/edit/main/plugins/unity/Samples~/LocalKnowledge/README.md)
