langtree.core.vectordb¶
Module Contents¶
Classes¶
Helper class that provides a standard way to create an ABC using |
- class langtree.core.vectordb.VectorDatabase[source]¶
Bases:
abc.ABCHelper class that provides a standard way to create an ABC using inheritance.
- abstract insert(vector: List[float], metadata: Any, **kwargs) None[source]¶
Insert a vector into the database with optional metadata and additional parameters.
- Parameters:
vector (List[float]) – The vector to be inserted.
metadata (Any) – Optional metadata associated with the vector.
**kwargs – Additional parameters for insertion.
- abstract query(vector: List[float], top_k: int, **kwargs) List[Any][source]¶
Query the database for the ‘top_k’ closest vectors to the provided vector.
Returns a list of matched vectors’ metadata. Accepts additional parameters.
- Parameters:
vector (List[float]) – The vector used for querying.
top_k (int) – Number of closest vectors to return.
**kwargs – Additional parameters for querying.
- Returns:
List of matched vectors’ metadata.
- Return type:
List[Any]
- __getattr__(name)[source]¶
Override Python’s default behavior when an attribute isn’t found.
This can be used to ‘forward’ method calls to the underlying database object.
- Parameters:
name (str) – The name of the attribute.
- Returns:
The method from the underlying database object.
- Return type:
callable