Update utils.py
Browse files
utils.py
CHANGED
@@ -28,7 +28,8 @@ from pygments import highlight
|
|
28 |
from pygments.lexers import guess_lexer,get_lexer_by_name
|
29 |
from pygments.formatters import HtmlFormatter
|
30 |
|
31 |
-
from langchain.chains import LLMChain, RetrievalQA
|
|
|
32 |
from langchain.prompts import PromptTemplate
|
33 |
from langchain_community.document_loaders import PyPDFLoader, UnstructuredWordDocumentLoader, DirectoryLoader
|
34 |
#from langchain.document_loaders.blob_loaders.youtube_audio import YoutubeAudioLoader
|
@@ -316,7 +317,7 @@ def rag_chain(llm, prompt, retriever):
|
|
316 |
# Erstelle eine RunnableSequence
|
317 |
chain = RunnableSequence(steps=[RAG_CHAIN_PROMPT, llm])
|
318 |
# Verwende die Kette
|
319 |
-
result = chain.invoke({"context": relevant_docs, "question": prompt})
|
320 |
else:
|
321 |
# keine relevanten Dokumente gefunden
|
322 |
result = "Keine relevanten Dokumente gefunden"
|
|
|
28 |
from pygments.lexers import guess_lexer,get_lexer_by_name
|
29 |
from pygments.formatters import HtmlFormatter
|
30 |
|
31 |
+
from langchain.chains import LLMChain, RetrievalQA
|
32 |
+
from langchain import RunnableSequence
|
33 |
from langchain.prompts import PromptTemplate
|
34 |
from langchain_community.document_loaders import PyPDFLoader, UnstructuredWordDocumentLoader, DirectoryLoader
|
35 |
#from langchain.document_loaders.blob_loaders.youtube_audio import YoutubeAudioLoader
|
|
|
317 |
# Erstelle eine RunnableSequence
|
318 |
chain = RunnableSequence(steps=[RAG_CHAIN_PROMPT, llm])
|
319 |
# Verwende die Kette
|
320 |
+
result = chain.invoke({"context": relevant_docs, "question": prompt})
|
321 |
else:
|
322 |
# keine relevanten Dokumente gefunden
|
323 |
result = "Keine relevanten Dokumente gefunden"
|