lance_doc_chat_agent
langroid/agent/special/lance_doc_chat_agent.py
LanceDocChatAgent is a subclass of DocChatAgent that uses LanceDB as a vector store:
- Uses the DocChatAgentConfig.filter variable
(a sql string) in the where
clause to do filtered vector search.
- Overrides the get_similar_chunks_bm25() to use LanceDB FTS (Full Text Search).
For usage see
tests/main/test_lance_doc_chat_agent.py
.- example script
examples/docqa/lance_rag.py
.
LanceDocChatAgent(cfg)
¶
Bases: DocChatAgent
Source code in langroid/agent/special/lance_doc_chat_agent.py
query_plan(msg)
¶
Handle the LLM's use of the FilterTool. Temporarily set the config filter and either return the final answer in case there's a dataframe_calc, or return the rephrased query so the LLM can handle it.
Source code in langroid/agent/special/lance_doc_chat_agent.py
ingest_dataframe(df, content='content', metadata=[])
¶
Ingest from a dataframe. Assume we are doing this once, not incrementally
Source code in langroid/agent/special/lance_doc_chat_agent.py
get_similar_chunks_bm25(query, multiple)
¶
Override the DocChatAgent.get_similar_chunks_bm25() to use LanceDB FTS (Full Text Search).