Skip to content

Errors

PyAIStack raises package-specific exceptions for invalid input, unavailable providers, loaders, and vector stores.

Use format_error() at the application boundary to show a concise Python-style error that points to your code rather than PyAIStack internals.

from pyaistack import RAG, format_error
from pyaistack.exceptions import AIStackError

try:
    rag = RAG()
    rag.add(["A document to index."])
except AIStackError as error:
    print(format_error(error))

Common exceptions:

  • ProviderError — Ollama or another model provider failed.
  • EmptyIndexError — a search was requested before documents were indexed.
  • LoaderError — a file cannot be read or is empty.
  • UnsupportedFileTypeError — a requested loader type is not implemented.
  • ChunkingError — chunk size, overlap, or input is invalid.
  • VectorStoreError — vector validation or persistent-store work failed.