osyra_ome.adapters.langchain.vectorstore
Private pre-release / network boundary: The currently usable customer surface is offline verification of an existing signed artifact against an out-of-band trust anchor. Memory/network RPC APIs and host snippets on this page describe protocol and interface shape; the public Edge bridge, package publication, and release acceptance remain pending. Do not treat
api.osyra.ai:443examples as a released customer route.
LangChain :class:`VectorStore` audit-decorator backed by OME.
This adapter is a DELEGATE wrapper: it pairs any LangChain ``VectorStore`` implementation (FAISS, Chroma, Pinecone, ...) with the OME memory namespace so every document insertion produces an audit-grade :class:`~osyra_ome.Claim`. Similarity search itself is forwarded to the underlying vector store unmodified — OME does not expose a similarity index in v0.1.
The decorator pattern is the honest design here:
- OME's ``client.memory.write_claim`` carries an ``embedding_hash`` field but no actual k-NN index. Vector search must run elsewhere.
- Customers want cryptographic provenance for every document a
retrieval pipeline ingests, even when the index is a third-party
vector DB. Wrapping the existing store in :class:
OmeVectorStoregets them that property without re-architecting their pipeline.
Example::
from langchain_community.vectorstores import FAISS
from osyra_ome import OmeClient
from osyra_ome.adapters.langchain import OmeVectorStore
inner = FAISS.from_texts(["seed"], embedding=my_embedder)
store = OmeVectorStore(
client=OmeClient(...),
delegate=inner,
workspace_id="ws-prod",
collection="docs",
)
store.add_texts(["my document"]) # writes both to FAISS and OME
hits = store.similarity_search("my", k=3) # passes through to FAISSClasses
class OmeVectorStore
Bases: VectorStore
VectorStore audit-decorator pairing OME with a delegate index.
Args:
client: OmeClient bound to the destination workspace.
delegate: any LangChain :class:VectorStore implementation
used for the actual similarity search backend.
workspace_id: OME workspace identifier. If omitted, defers
to the workspace_id bound on the wrapped client.
collection: logical collection name; encoded into the
subject_id of every emitted Claim
(did:web:collection.osyra.ai/<collection>).
Methods
__init__
def __init__(self, *, client: OmeClient, delegate: VectorStore, workspace_id: str | None = None, collection: str = 'default') -> Noneadd_texts
def add_texts(self, texts: Iterable[str], metadatas: list[dict[str, Any]] | None = None, **kwargs: Any) -> list[str]Persist texts to the delegate AND to OME as Claims.
Returns the list of IDs from the delegate (not OME claim ids) so callers expecting LangChain VectorStore semantics still work. The OME claim ids are recorded on :attr:`written_claim_ids` for audit-trail access.
delegate @property
def delegate(self) -> VectorStoreThe underlying VectorStore (FAISS/Chroma/Pinecone/etc).
delete
def delete(self, ids: list[str] | None = None, **kwargs: Any) -> bool | Noneembeddings @property
def embeddings(self) -> Embeddings | Nonefrom_texts @classmethod
def from_texts(cls, texts: list[str], embedding: Embeddings, metadatas: list[dict[str, Any]] | None = None, **kwargs: Any) -> OmeVectorStoreConstruct via a delegate's from_texts.
Required kwargs: client: OmeClient delegate_cls: VectorStore subclass to use for the index workspace_id (optional) collection (optional; default "default")
Other kwargs are forwarded to the delegate's from_texts.
similarity_search
def similarity_search(self, query: str, k: int = 4, **kwargs: Any) -> list[Document]written_claim_ids @property
def written_claim_ids(self) -> tuple[str, ...]