Update utils.py
Browse files
utils.py
CHANGED
@@ -347,13 +347,12 @@ def document_retrieval_chroma(llm, prompt):
|
|
347 |
###############################################
|
348 |
#Langchain anlegen für RAG Chaining
|
349 |
###############################################
|
350 |
-
"""
|
351 |
#langchain nutzen, um prompt an LLM zu leiten - llm und prompt sind austauschbar
|
352 |
def llm_chain(llm, prompt):
|
353 |
llm_chain = LLMChain(llm = llm, prompt = LLM_CHAIN_PROMPT)
|
354 |
result = llm_chain.run({"question": prompt})
|
355 |
return result
|
356 |
-
|
357 |
#nur für HF-um bei chatverlauf kurzbeschreibung zu erzeugen
|
358 |
def llm_chain2(llm, prompt):
|
359 |
llm_chain = LLMChain(llm = llm, prompt = LLM_CHAIN_PROMPT2)
|
@@ -401,9 +400,8 @@ def rag_chain(llm, prompt, retriever):
|
|
401 |
outputs = modell_rag.generate(inputs['input_ids'], max_length=150, num_beams=2, early_stopping=True)
|
402 |
answer = tokenizer_rag.decode(outputs[0], skip_special_tokens=True)
|
403 |
"""
|
404 |
-
|
405 |
-
|
406 |
-
answer = llm_chain.run({"question": prompt})
|
407 |
|
408 |
#answer = query(llm, {"inputs": input_text,})
|
409 |
|
|
|
347 |
###############################################
|
348 |
#Langchain anlegen für RAG Chaining
|
349 |
###############################################
|
|
|
350 |
#langchain nutzen, um prompt an LLM zu leiten - llm und prompt sind austauschbar
|
351 |
def llm_chain(llm, prompt):
|
352 |
llm_chain = LLMChain(llm = llm, prompt = LLM_CHAIN_PROMPT)
|
353 |
result = llm_chain.run({"question": prompt})
|
354 |
return result
|
355 |
+
"""
|
356 |
#nur für HF-um bei chatverlauf kurzbeschreibung zu erzeugen
|
357 |
def llm_chain2(llm, prompt):
|
358 |
llm_chain = LLMChain(llm = llm, prompt = LLM_CHAIN_PROMPT2)
|
|
|
400 |
outputs = modell_rag.generate(inputs['input_ids'], max_length=150, num_beams=2, early_stopping=True)
|
401 |
answer = tokenizer_rag.decode(outputs[0], skip_special_tokens=True)
|
402 |
"""
|
403 |
+
llm_chain = LLMChain(llm = llm, prompt = RAG_CHAIN_PROMPT)
|
404 |
+
answer = llm_chain.run({"context": combined_content, "question": prompt})
|
|
|
405 |
|
406 |
#answer = query(llm, {"inputs": input_text,})
|
407 |
|