agents.document_modifiers.base.utilsΒΆ

Utility functions for document processing.

FunctionsΒΆ

documents_to_strings(documents)

Convert a list of Documents to a list of strings.

normalize_contents(contents)

Normalize inputs to strings.

strings_to_documents(strings)

Convert a list of strings to a list of Documents.

Module ContentsΒΆ

agents.document_modifiers.base.utils.documents_to_strings(documents)ΒΆ

Convert a list of Documents to a list of strings.

Parameters:

documents (list[langchain_core.documents.Document])

Return type:

list[str]

agents.document_modifiers.base.utils.normalize_contents(contents)ΒΆ

Normalize inputs to strings.

Accepts: - List[str] - List[Document] - Mixed list of strings and documents - Single string or Document

Parameters:

contents (Any) – The content to normalize

Returns:

List of strings extracted from the input

Raises:

TypeError – If unsupported content type is encountered

Return type:

list[str]

agents.document_modifiers.base.utils.strings_to_documents(strings)ΒΆ

Convert a list of strings to a list of Documents.

Parameters:

strings (list[str])

Return type:

list[langchain_core.documents.Document]