Data Sources and RAG
Attach a file and the agent answers from it. Custodian Labs extracts the text, chunks and embeds it, and retrieves the relevant pieces per message — you just add the file.
from custodian_labs import Custodian
custodian = Custodian(model="gpt-4o", system_prompt="Answer from the provided docs.")
custodian.add_data_source_file("./support-handbook.pdf") # call again for more files
app = custodian.deploy()
reply = app.chat("What is the refund policy?")
print(reply.response)
print(reply.retrieved_contexts) # the chunks used
Builder: .with_data_source_file("./support-handbook.pdf").
Supported files
| Extensions | |
|---|---|
| Text | .txt, .md, .csv, .json, .yaml, .yml, .log |
.pdf | |
| Word | .docx, .odt |
| Excel | .xls, .xlsx, .xlsm, .xltx, .xltm |
Text files must be UTF-8. Prefer extractable text over scanned images. Images: coming soon.
Good source files
Clear headings, no unrelated content, focused files over one giant knowledge base, kept current.