View module source on GitHub

RetrievalConfig

@deprecated(
    "This class will be removed in a future version. Use {} which is TypedDict."
)

@dataclass
class RetrievalConfig()

Retrieval config.

This class provides functionality to manage retrieval configurations.

RetrievalConfigDict

class RetrievalConfigDict(TypedDict)

Retrieval config dict.

This class provides functionality to manage retrieval config dictionaries.

get_retrieval_config_dict

def get_retrieval_config_dict(
        config: Union[RetrievalConfig, RetrievalConfigDict]) -> dict[str, Any]

Get the retrieval config dict.

Arguments:

NameTypeDescription
configUnion[RetrievalConfig, RetrievalConfigDict]The config to get the dict from.

Returns:

dict[str, Any]: The retrieval config dict.

Retrieval

class Retrieval(BaseContainer)

Retrieval.

This class represents a retrieval.

__init__

def __init__(config: Union[RetrievalConfig, RetrievalConfigDict],
             writer: LogWriter)

Initialize a retrieval.

Arguments:

NameDescription
configThe config to initialize the retrieval with.
writerThe writer to use.

input

def input(query: str)

Set the input for the retrieval.

Arguments:

NameDescription
queryThe query to set for the retrieval.

input_

@staticmethod
def input_(writer: LogWriter, id: str, query: str)

Set the input for the retrieval.

Arguments:

NameDescription
writerThe writer to use.
idThe id of the retrieval.
queryThe query to set for the retrieval.

output

def output(docs: Union[str, List[str]])

Set the output for the retrieval.

Arguments:

NameDescription
docsThe docs to set for the retrieval.

add_attachment

def add_attachment(attachment: Union[FileAttachment, FileDataAttachment,
                                     UrlAttachment])

Add an attachment to the retrieval.

Arguments:

NameDescription
attachmentThe attachment to add to the retrieval.

add_attachment_

@staticmethod
def add_attachment_(writer: LogWriter, id: str,
                    attachment: Union[FileAttachment, FileDataAttachment,
                                      UrlAttachment])

Add an attachment to the retrieval.

Arguments:

NameDescription
writerThe writer to use.
idThe id of the retrieval.
attachmentThe attachment to add to the retrieval.

output_

@staticmethod
def output_(writer: LogWriter, id: str, docs: Union[str, List[str]])

Set the output for the retrieval.

Arguments:

NameDescription
writerThe writer to use.
idThe id of the retrieval.
docsThe docs to set for the retrieval.

end_

@staticmethod
def end_(writer: LogWriter, id: str, data: Optional[Dict[str, Any]] = None)

End the retrieval.

Arguments:

NameDescription
writerThe writer to use.
idThe id of the retrieval.
dataThe data to set for the retrieval.

add_tag_

@staticmethod
def add_tag_(writer: LogWriter, id: str, key: str, value: str)

Add a tag to the retrieval.

Arguments:

NameDescription
writerThe writer to use.
idThe id of the retrieval.
keyThe key of the tag.
valueThe value of the tag.