mirror of
https://github.com/hanzoai/base.git
synced 2026-10-21 03:41:50 +00:00
The README quickstart, docs/versions.md, hooks.md, rules.md, config.md and listeners.md, and examples/hooks-hybrid-search, each command run against the binary built from examples/base. LLM.md is cut to a current map with test commands and known problems; threat-model, NETWORK, SECURITY and CONTRIBUTING are corrected to the code. Co-authored-by: Hanzo Dev <[email protected]>
16 lines
798 B
JavaScript
16 lines
798 B
JavaScript
// Four sample documents with three-number embeddings, so the example runs
|
|
// without an embedding model. Real embeddings come from your model and are
|
|
// written to the embedding field like any other value.
|
|
migrate((app) => {
|
|
const docs = app.findCollectionByNameOrId("docs")
|
|
const samples = [
|
|
["SQLite full-text search", "FTS5 ranks matching rows with BM25.", [0.9, 0.1, 0.0]],
|
|
["Vector similarity", "Cosine similarity compares embeddings by angle.", [0.1, 0.9, 0.0]],
|
|
["Reciprocal rank fusion", "RRF merges ranked lists without tuning weights.", [0.5, 0.5, 0.1]],
|
|
["Access rules", "A list rule decides which records a caller may see.", [0.0, 0.2, 0.9]],
|
|
]
|
|
for (const [title, body, embedding] of samples) {
|
|
app.save(new Record(docs, { title, body, embedding }))
|
|
}
|
|
})
|