to_rag_tuples#

scikitplot.corpus.to_rag_tuples(documents)[source]#

Convert documents to (text, metadata, embedding) tuples.

Parameters:
documentsSequence[CorpusDocument]

Source documents.

Returns:
list[tuple[str, dict, Any]]

Each tuple is (text, metadata_dict, embedding_or_None). Compatible with most vector store upsert interfaces.

Parameters:

documents (Sequence[Any])

Return type:

list[tuple[str, dict[str, Any], Any]]

Notes

User note: Feed directly to any vector store:

for text, meta, emb in to_rag_tuples(docs):
    vector_store.upsert(id=meta["doc_id"], vector=emb, metadata=meta, text=text)