-
Notifications
You must be signed in to change notification settings - Fork 2
/
example_rag.py
42 lines (30 loc) · 1.23 KB
/
example_rag.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
"""
This script demonstrates the rag tools available in this project. The rag tool searches the docs directory for a sub directory that matches the domain name and uses the available documents to performa a RAG (Retrieval Augmented Generation) query. By default the search domain of "llama_index" is available.
"""
from dotenv import load_dotenv
import logging
from utils.rag_tools import get_informed_answer
# Set to DEBUG for more verbose logging
logging.basicConfig(level=logging.INFO)
load_dotenv()
STORAGE_DIR = "./storage"
DOCS_DIR = "./docs"
# NOTE: If you run "python example_research.py", most likely you will then be able to set the domain to "autogen" for autogen related queries
domain = "bitsavers_sel_810"
domain_description = "sel computers"
def main():
question = "Please provide a guide to SEL 810 mnembler programming, specifically operations and syntax"
answer = get_informed_answer(
question,
docs_dir=DOCS_DIR,
storage_dir=STORAGE_DIR,
domain=domain,
domain_description=domain_description,
vector_top_k=25,
reranker_top_n=5,
rerank=True,
fusion=True,
)
print("GOT ANSWER: ", answer.response)
if __name__ == "__main__":
main()