xtrace_sdk.retrievers.base ========================== .. py:module:: xtrace_sdk.retrievers.base Attributes ---------- .. autoapisummary:: xtrace_sdk.retrievers.base.TInt Classes ------- .. autoapisummary:: xtrace_sdk.retrievers.base.RetrieverBase Module Contents --------------- .. py:data:: TInt .. py:class:: RetrieverBase(execution_context, integration, **kwargs) Bases: :py:obj:`abc.ABC` This class is interface for all retrievers. :param ABC: abstract base class :type ABC: class .. py:attribute:: execution_context .. py:attribute:: integration .. py:method:: _from_disk(path_to_execution_context, passphrase, integration) :classmethod: Construct a Retriever instance from saved execution context on disk. :param path_to_execution_context: the path to execution context saved on disk :type path_to_execution_context: str :return: a Retriever instance. :rtype: Retriever .. py:method:: _from_remote(path_to_execution_context, passphrase, integration) :classmethod: .. py:method:: nn_search_for_ids(query_vector, k = 3, **kwargs) :abstractmethod: Given an encrypted prompt, return the k most similar encrypted contexts. :param prompt: encrypted prompt :type prompt: ciphertext :param k: the number of most similar context data to return, defaults to 3 :type k: int, optional .. py:method:: retrieve_and_decrypt(chunk_ids, **kwargs) :abstractmethod: Given a list of chunk ids, return the decrypted contexts. :param chunk_ids: list of chunk ids :type chunk_ids: list[str] .. py:method:: format_context(contexts) :staticmethod: Helper method for formatting contexts :param contexts: list of contexts :type contexts: list[str] :return: formatted contexts :rtype: str