xtrace_sdk.retrievers.base

Attributes

TInt

Classes

RetrieverBase

This class is interface for all retrievers.

Module Contents

xtrace_sdk.retrievers.base.TInt
class xtrace_sdk.retrievers.base.RetrieverBase(execution_context, integration, **kwargs)

Bases: abc.ABC

This class is interface for all retrievers.

Parameters:
execution_context
integration
classmethod _from_disk(path_to_execution_context, passphrase, integration)

Construct a Retriever instance from saved execution context on disk.

Parameters:
Returns:

a Retriever instance.

Return type:

Retriever

classmethod _from_remote(path_to_execution_context, passphrase, integration)
Parameters:
Return type:

Any

abstractmethod nn_search_for_ids(query_vector, k=3, **kwargs)

Given an encrypted prompt, return the k most similar encrypted contexts.

Parameters:
  • prompt (ciphertext) – encrypted prompt

  • k (int, optional) – the number of most similar context data to return, defaults to 3

  • query_vector (list[Any])

  • kwargs (Any)

Return type:

Any

abstractmethod retrieve_and_decrypt(chunk_ids, **kwargs)

Given a list of chunk ids, return the decrypted contexts.

Parameters:
  • chunk_ids (list[str]) – list of chunk ids

  • kwargs (Any)

Return type:

Any

static format_context(contexts)

Helper method for formatting contexts

Parameters:

contexts (list[str]) – list of contexts

Returns:

formatted contexts

Return type:

str