abacusai.document_retriever — AbacusAI documentation

# `abacusai.document_retriever`

## Module Contents

### Classes

`DocumentRetriever` | A vector store that stores embeddings for a list of document trunks.

class abacusai.document_retriever.DocumentRetriever(client, name=None, documentRetrieverId=None, createdAt=None, latestDocumentRetrieverVersion={}, documentRetrieverConfig={})

  Bases: `abacusai.return_class.AbstractApiClass`

  A vector store that stores embeddings for a list of document trunks.

  Parameters:

    - client (ApiClient) – An authenticated API Client instance

    - name (str) – The name of the document retriever.

    - documentRetrieverId (str) – The unique identifier of the vector store.

    - createdAt (str) – When the vector store was created.

    - latestDocumentRetrieverVersion (DocumentRetrieverVersion) – The latest version of vector store.

    - documentRetrieverConfig (DocumentRetrieverConfig) – The config for vector store creation.

  __repr__()

    Return repr(self).

  to_dict()

    Get a dict representation of the parameters in this class

    Returns:

      The dict value representation of the class parameters

    Return type:

      dict

  update(name=None, feature_group_id=None, document_retriever_config=None)

    Updates an existing document retriever.

    Parameters:

      - name (str) – The name group to update the document retriever with.

      - feature_group_id (str) – The ID of the feature group to update the document retriever with.

      - document_retriever_config (DocumentRetrieverConfig) – The configuration, including chunk_size and chunk_overlap_fraction, for document retrieval.

    Returns:

      The updated document retriever.

    Return type:

      DocumentRetriever

  create_version()

    Creates a document retriever version from the latest version of the feature group that the document retriever associated with.

    Parameters:

      document_retriever_id (str) – The unique ID associated with the document retriever to create version with.

    Returns:

      The newly created document retriever version.

    Return type:

      DocumentRetrieverVersion

  refresh()

    Calls describe and refreshes the current object’s fields

    Returns:

      The current object

    Return type:

      DocumentRetriever

  describe()

    Describe a Document Retriever.

    Parameters:

      document_retriever_id (str) – A unique string identifier associated with the document retriever.

    Returns:

      The document retriever object.

    Return type:

      DocumentRetriever

  list_versions(limit=100, start_after_version=None)

    List all the document retriever versions with a given ID.

    Parameters:

      - limit (int) – The number of vector store versions to retrieve.

      - start_after_version (str) – An offset parameter to exclude all document retriever versions up to this specified one.

    Returns:

      All the document retriever versions associated with the document retriever.

    Return type:

      DocumentRetrieverVersion

  lookup(query, deployment_token, limit_results=None)

    Lookup relevant documents from the document retriever deployed with given query.

    Parameters:

      - query (str) – The query to search for.

      - deployment_token (str) – A deployment token used to authenticate access to created vector store.

      - limit_results (int) – If provided, will limit the number of results to the value specified.

    Returns:

      The relevant documentation results found from the document retriever.

    Return type:

      DocumentRetrieverLookupResult

  wait_until_ready(timeout=3600)

    A waiting call until document retriever is ready.

    Parameters:

      timeout (int, optional) – The waiting time given to the call to finish, if it doesn’t finish by the allocated time, the call is said to be timed out. Default value given is 3600 seconds.

  get_status()

    Gets the status of the document retriever.

    Returns:

      A string describing the status of a document retriever (pending, complete, etc.).

    Return type:

      str