sim_LAR
Python search library combining keyword, semantic, and hybrid search into a single ranked result list — with first-class LangChain, LlamaIndex, and Haystack support.
Installation
The open wrapper and the engine is on public PyPI:
pip install simlar
pip install simlar-engine
Quick start
Keyword search
No embeddings required. Index your text and search.
from simlar import RelevanceIndex
corpus = [
"cancer treatment with immunotherapy",
"machine learning transformers",
"climate change renewable energy",
]
ids = [f"doc_{i}" for i in range(len(corpus))]
idx = RelevanceIndex()
idx.add(ids=ids, texts=corpus)
results = idx.search("immunotherapy clinical trial", k=1)
for r in results:
print(r.rank, r.id, f"{r.score:.4f}")
Semantic search
Provide pre-computed embedding vectors alongside your document IDs.
import numpy as np
from simlar import SimlarEngine
# vectors: (n_docs, dim) float32, ideally L2-normalised
vectors = np.load("corpus_embeddings.npy")
ids = [f"doc_{i}" for i in range(len(vectors))]
idx = SimlarEngine()
idx.add(ids=ids, vectors=vectors)
query_vec = np.load("query_embedding.npy") # shape (1, dim)
results = idx.search(query_vec, k=5)
for r in results:
print(r.rank, r.id, f"{r.score:.4f}")
Hybrid search
Combine keyword relevance and semantic similarity into one ranked list.
import numpy as np
from simlar import HelixIndex, RelevanceIndex, SimlarEngine, ReciprocalRankFusion
corpus = ["cancer treatment with immunotherapy", "machine learning transformers", ...]
ids = [f"doc_{i}" for i in range(len(corpus))]
vectors = np.load("corpus_embeddings.npy") # shape (n, dim)
index = HelixIndex(
text_index=RelevanceIndex(),
vector_index=SimlarEngine(),
fusion=ReciprocalRankFusion(),
top_k=20,
)
index.add(ids=ids, texts=corpus, vectors=vectors)
query_vec = np.load("query_embedding.npy")
results = index.search(
query_text="immunotherapy clinical trial",
query_vector=query_vec,
k=10,
)
for r in results:
print(r.rank, r.id, f"{r.score:.4f}")
Framework integrations
sim_LAR works as a drop-in component in:
- LangChain — docs/examples/04_langchain_integration.ipynb
- LlamaIndex — docs/examples/06_llamaindex_integration.ipynb
- Haystack — docs/examples/05_haystack_integration.ipynb
Index types at a glance
| Index | Best for |
|---|---|
RelevanceIndex |
Keyword search over text — no embeddings required |
SimlarEngine |
Semantic search over pre-computed embedding vectors |
HelixIndex |
Both signals combined; corpus fits in memory |
StreamingHybridIndex |
Both signals; very large corpora added in batches |
Producing embeddings
sim_LAR is model-agnostic — it accepts any (n, dim) float32 NumPy array. Use whichever embedding library fits your project. Example with sentence-transformers:
pip install sentence-transformers
from sentence_transformers import SentenceTransformer
model = SentenceTransformer("WhereIsAI/UAE-Large-V1")
corpus_vectors = model.encode(corpus, normalize_embeddings=True) # (n, dim) float32
query_vec = model.encode(["my search query"], normalize_embeddings=True) # (1, dim)
Saving and loading indexes
Every index type shares the same save/load interface.
# Save
index.save("/path/to/dir")
# Load (type is detected automatically)
from simlar import load_from_directory
index = load_from_directory("/path/to/dir")
Extending sim_LAR
Register a custom index class to make it compatible with load_from_directory() and the rest of the library:
from simlar import VectorIndex, register
@register("my_index")
class MyIndex(VectorIndex):
...
Contributing
Contributions to simlar are welcome. Because this is a dual-licensed open-core project, we require all contributors to agree to a Contributor License Agreement (CLA) before we can merge. This lets us keep the open-core model viable and continue offering simlar under Apache 2.0. See CONTRIBUTING.md for details.
We do not accept contributions to the proprietary engine.
Trademarks
"sim_LAR", "TekDatum", and associated logos are trademarks of TekDatum. The Apache 2.0 license for the open code does not grant rights to use these marks. You may build on and redistribute the open code, but you may not use our names or logos in a way that implies endorsement or that misrepresents the origin of a fork. See TRADEMARKS.md.
Documentation
| Document | Description |
|---|---|
| Concepts | Architecture and design decisions |
| API Reference | Full public API |
| Examples | Runnable scripts |
License
- The contents of this repository are licensed under the Apache License, Version 2.0 — see LICENSE.
- The proprietary
simlar-enginebinary is licensed under a Commercial EULA — see EULA.md. - Third-party components and their licenses are listed in NOTICE.
License Boundary
This project uses an open-core model. It has two layers with different licenses:
| Layer | Package | License | Where it lives |
|---|---|---|---|
| Open wrapper + SDK | simlar |
Apache License 2.0 | This repo · public PyPI |
| Proprietary engine | simlar-engine |
Commercial EULA (closed binary) | public PyPI |
What this means in practice:
- The code in this repository is free and open under Apache 2.0. You can read it, fork it, modify it, and build on it, including commercially, subject to the Apache 2.0 terms.
- The wrapper depends on a separate, proprietary binary package (
simlar-engine) that contains TekDatum's core IP. That binary is not open source. Installing and using it requires accepting the Commercial EULA and, for production use, a license from TekDatum. - Calling the proprietary engine through this open SDK does not make your own code subject to the EULA — your application code is yours. The EULA governs only the proprietary binary itself.
If you only want to read or contribute to the open layer, you never need a license. If you want to run the full product, you need the engine.
What's open and what's not
Open (Apache 2.0, in this repo):
- The SDK and public API surface (
RelevanceIndex,HelixIndex,StreamingHybridIndex,ReciprocalRankFusion) - Framework adapters (LangChain / LlamaIndex / Haystack)
- The
load_from_directory()loader and@registerextension API - Configuration schema, type stubs, examples, and docs
Proprietary (Commercial EULA, separate binary):
- The core
SimlarEnginevector search implementation - Compiled ranking and retrieval algorithms
We keep this boundary deliberate and documented so you always know which terms apply to which code.
© 2026 TekDatum.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file simlar-1.0.0.tar.gz.
File metadata
- Download URL: simlar-1.0.0.tar.gz
- Upload date:
- Size: 29.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f26fb4545d2788a0872be90c0651653098b498c9253923c1289693076ed1ece1
|
|
| MD5 |
943b7d7524ca5dc39cd4a41ee4c59893
|
|
| BLAKE2b-256 |
7de5d8e9555e81b857bb2b1214731d9dfd77ea8e6a1a57e38bf07394305648f3
|
File details
Details for the file simlar-1.0.0-py3-none-any.whl.
File metadata
- Download URL: simlar-1.0.0-py3-none-any.whl
- Upload date:
- Size: 35.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
06222211ab5e9687cea9da19d08c7578ef3d9d9994b5c7486aaa4672e1e57859
|
|
| MD5 |
b6a4dd4ff46ff092bc817ec39539ce09
|
|
| BLAKE2b-256 |
cb843cc0c7b38363885ab02da7737ad9cf1f2faceea63347c2dfaa0893ccebaa
|