Update app.py
Browse files
app.py
CHANGED
@@ -43,16 +43,28 @@ class cbfs:
|
|
43 |
self.chain = initialize_agent(
|
44 |
tools=tools,
|
45 |
llm=self.model,
|
46 |
-
agent="chat-conversational-react-description",
|
|
|
47 |
memory=self.memory,
|
48 |
verbose=True
|
49 |
)
|
50 |
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
def convchain(self, query):
|
52 |
-
|
53 |
-
|
|
|
54 |
result = self.chain.invoke({"input": query})
|
|
|
55 |
return result.get('output_text', "No response generated.")
|
|
|
|
|
|
|
56 |
|
57 |
# Create an instance of the agent
|
58 |
cb = cbfs(tools)
|
|
|
43 |
self.chain = initialize_agent(
|
44 |
tools=tools,
|
45 |
llm=self.model,
|
46 |
+
#agent="chat-conversational-react-description",
|
47 |
+
agent="zero-shot-react-description",
|
48 |
memory=self.memory,
|
49 |
verbose=True
|
50 |
)
|
51 |
|
52 |
+
#def convchain(self, query):
|
53 |
+
#if not query:
|
54 |
+
#return "Please enter a query."
|
55 |
+
#result = self.chain.invoke({"input": query})
|
56 |
+
#return result.get('output_text', "No response generated.")
|
57 |
+
|
58 |
def convchain(self, query):
|
59 |
+
if not query:
|
60 |
+
return "Please enter a query."
|
61 |
+
try:
|
62 |
result = self.chain.invoke({"input": query})
|
63 |
+
print("Agent Result:", result) # Debugging line
|
64 |
return result.get('output_text', "No response generated.")
|
65 |
+
except Exception as e:
|
66 |
+
return f"Error: {str(e)}"
|
67 |
+
|
68 |
|
69 |
# Create an instance of the agent
|
70 |
cb = cbfs(tools)
|