Drawn directly from examples/python/ and examples/cpp/ in the repository.
Python — getting started
examples/python/01_getting_started.py
import elips
engine = elips.connect(":memory:", dimension=128)
arena = engine.arena("documents")
arena.ingest(
texts=["alpha design note", "beta incident runbook"],
meta=[{"kind": "design"}, {"kind": "ops"}],
)
for hit in arena.probe_text("alpha", top=2):
print(hit.key, hit.distance, hit.text, hit.meta)C++ — getting started
examples/cpp/01_getting_started.cpp
#include "elips/elips.hpp"
#include <print>
int main() {
auto db = elips::open(
":memory:",
elips::Config{}.dimension(128).metric(elips::Metric::cosine));
auto& docs = db->vault("documents");
docs.place_document("alpha design note", {{"kind", std::string{"design"}}});
docs.place_document("beta incident runbook", {{"kind", std::string{"ops"}}});
for (auto const& hit : docs.seek_text("alpha", 2)) {
std::println("{} {} {}", hit.id.to_string(), hit.distance,
hit.document->text);
}
}EQL from the SDK
python
rows = db.query(
"seek in documents nearest $q top 10 "
"where kind = \"design\" project kind yield",
bindings={"q": query_vector},
)Hybrid retrieval
python
hits = docs.seek_hybrid(
vector=query_vector,
text="rotate KMS keys",
top=5,
where=elips.Filter().field("kind").equals("runbook"),
)