File size: 503 Bytes
70d3fb9
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
from modules.lawbot.rag_with_langchain import load_documents, split_documents, create_vectorstore, setup_rag_chain, answer_query

# Initialize RAg chain once
documents = load_documents()
docs = split_documents(documents)
vectorstore = create_vectorstore(docs)
qa_chain = setup_rag_chain(vectorstore)

def lawbot_interface(query, chat_history=None):
    if not query.strip():
        return "⚠️ Please enter a valid legal question."
    return answer_query(query, qa_chain, chat_history)