Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -10,6 +10,7 @@ from langchain.tools.base import StructuredTool
|
|
10 |
from langchain.agents import initialize_agent
|
11 |
from qa_txt import llm
|
12 |
from trans import trans
|
|
|
13 |
import gradio as gr
|
14 |
from langchain.agents import (
|
15 |
create_react_agent,
|
@@ -19,12 +20,13 @@ from langchain.agents import (
|
|
19 |
from langchain import hub
|
20 |
|
21 |
|
|
|
22 |
|
23 |
prompt = hub.pull("hwchase17/react")
|
24 |
|
25 |
def faq(query: str) -> str:
|
26 |
-
reponse = conversation_chain.invoke({"
|
27 |
-
return reponse
|
28 |
|
29 |
qa_faq = StructuredTool.from_function(
|
30 |
func = faq ,
|
|
|
10 |
from langchain.agents import initialize_agent
|
11 |
from qa_txt import llm
|
12 |
from trans import trans
|
13 |
+
import pathlib
|
14 |
import gradio as gr
|
15 |
from langchain.agents import (
|
16 |
create_react_agent,
|
|
|
20 |
from langchain import hub
|
21 |
|
22 |
|
23 |
+
file_text = pathlib.Path('intents_v2.txt').read_text()
|
24 |
|
25 |
prompt = hub.pull("hwchase17/react")
|
26 |
|
27 |
def faq(query: str) -> str:
|
28 |
+
reponse = conversation_chain.invoke({"input": query, "document": file_text})
|
29 |
+
return reponse
|
30 |
|
31 |
qa_faq = StructuredTool.from_function(
|
32 |
func = faq ,
|