Update rag_langchain.py
Browse files- rag_langchain.py +5 -5
rag_langchain.py
CHANGED
@@ -23,11 +23,11 @@ class LangChainRAG(BaseRAG):
|
|
23 |
YOUTUBE_DIR = "/data/yt"
|
24 |
|
25 |
LLM_CHAIN_PROMPT = PromptTemplate(
|
26 |
-
input_variables = ["
|
27 |
template = os.environ["LLM_TEMPLATE"])
|
28 |
RAG_CHAIN_PROMPT = PromptTemplate(
|
29 |
-
input_variables = ["
|
30 |
-
template = os.environ["
|
31 |
|
32 |
def load_documents(self):
|
33 |
docs = []
|
@@ -114,7 +114,7 @@ class LangChainRAG(BaseRAG):
|
|
114 |
)
|
115 |
|
116 |
with get_openai_callback() as callback:
|
117 |
-
completion = llm_chain.generate([{"
|
118 |
|
119 |
return completion, llm_chain, callback
|
120 |
|
@@ -130,6 +130,6 @@ class LangChainRAG(BaseRAG):
|
|
130 |
)
|
131 |
|
132 |
with get_openai_callback() as callback:
|
133 |
-
completion = rag_chain({"
|
134 |
|
135 |
return completion, rag_chain, callback
|
|
|
23 |
YOUTUBE_DIR = "/data/yt"
|
24 |
|
25 |
LLM_CHAIN_PROMPT = PromptTemplate(
|
26 |
+
input_variables = ["question"],
|
27 |
template = os.environ["LLM_TEMPLATE"])
|
28 |
RAG_CHAIN_PROMPT = PromptTemplate(
|
29 |
+
input_variables = ["context", "question"],
|
30 |
+
template = os.environ["RAG_TEMPLATE"])
|
31 |
|
32 |
def load_documents(self):
|
33 |
docs = []
|
|
|
114 |
)
|
115 |
|
116 |
with get_openai_callback() as callback:
|
117 |
+
completion = llm_chain.generate([{"question": prompt}])
|
118 |
|
119 |
return completion, llm_chain, callback
|
120 |
|
|
|
130 |
)
|
131 |
|
132 |
with get_openai_callback() as callback:
|
133 |
+
completion = rag_chain({"query": prompt})
|
134 |
|
135 |
return completion, rag_chain, callback
|