API Reference
This section contains the complete API documentation for YARP, automatically generated from the source code docstrings.
Vector Index
Data Models
Exceptions
- exception yarp.exceptions.base.YarpBaseException[source]
Bases:
Exception
Base exception class for all YARP operations.
This serves as the parent class for all YARP-specific exceptions, allowing users to catch all YARP errors with a single except clause.
Runtime exceptions for YARP. This module defines specific exception types that can be raised during embedding operations, providing clear error messages and appropriate exception hierarchy.
- exception yarp.exceptions.runtime.EmbeddingProviderNotFoundException[source]
Bases:
YarpBaseException
Raised when no embedding provider is configured or found.
This exception occurs when trying to import yarp modules that require an embedding provider, but none is installed.
Example
>>> from yarp import LocalMemoryIndex >>> index = LocalMemoryIndex(["doc1", "doc2"]) >>> index.add("text") # Raises EmbeddingProviderNotFoundException
Custom exceptions for YARP local memory operations.
This module defines specific exception types that can be raised during vector index operations, providing clear error messages and appropriate exception hierarchy.
- exception yarp.exceptions.local_memory_exceptions.YarpBaseException[source]
Bases:
Exception
Base exception class for all YARP operations.
This serves as the parent class for all YARP-specific exceptions, allowing users to catch all YARP errors with a single except clause.
- exception yarp.exceptions.local_memory_exceptions.LocalMemoryBadRequestException[source]
Bases:
YarpBaseException
Raised when invalid parameters are provided to index operations.
This exception covers various invalid input scenarios such as: - Search weights that don’t sum to 1.0 - Attempting to delete a document that doesn’t exist - Other parameter validation failures
Example
>>> index.query("text", weight_semantic=0.3, weight_levenshtein=0.4) >>> # Raises LocalMemoryBadRequestException: weights must sum to 1.0
- exception yarp.exceptions.local_memory_exceptions.LocalMemoryTreeNotBuildException[source]
Bases:
YarpBaseException
Raised when attempting to use an index that hasn’t been built yet.
This exception occurs when you try to query, backup, or perform other operations on a LocalMemoryIndex before calling the process() method to build the search index.
Example
>>> index = LocalMemoryIndex(["doc1", "doc2"]) >>> index.query("search") # Raises LocalMemoryTreeNotBuildException >>> index.process() # Must call this first >>> index.query("search") # Now works
YARP exceptions are unified under YarpBaseException
for easier error handling. Runtime errors such as missing embedding providers will raise EmbeddingProviderNotFoundException
.