From fb78bdc5a9f7b839f66f43366f9dbb9787e25d3d Mon Sep 17 00:00:00 2001 From: Ashwin Bharambe Date: Mon, 26 Aug 2024 14:40:03 -0700 Subject: [PATCH] use interleaved_text_media_as_str() utilityt --- .../memory/meta_reference/faiss/faiss.py | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/llama_toolchain/memory/meta_reference/faiss/faiss.py b/llama_toolchain/memory/meta_reference/faiss/faiss.py index b3fdd2558..8f3ef2a4c 100644 --- a/llama_toolchain/memory/meta_reference/faiss/faiss.py +++ b/llama_toolchain/memory/meta_reference/faiss/faiss.py @@ -30,24 +30,13 @@ async def get_provider_impl(config: FaissImplConfig, _deps: Dict[Api, ProviderSp return impl -# This should be a broader utility -# This should support local file URLs and data URLs also async def content_from_doc(doc: MemoryBankDocument) -> str: if isinstance(doc.content, URL): async with httpx.AsyncClient() as client: r = await client.get(doc.content.uri) return r.text - def _process(c): - if isinstance(c, str): - return c - else: - return "" - - if isinstance(doc.content, list): - return " ".join([_process(c) for c in doc.content]) - else: - return _process(doc.content) + return interleaved_text_media_as_str(doc.content) def make_overlapped_chunks(