Update app.py
Browse files
app.py
CHANGED
|
@@ -7,7 +7,7 @@ from langchain_google_genai import ChatGoogleGenerativeAI
|
|
| 7 |
from langgraph.graph import StateGraph, MessagesState, START
|
| 8 |
from langchain_core.messages import SystemMessage, HumanMessage
|
| 9 |
from langchain_community.document_loaders import WikipediaLoader
|
| 10 |
-
from langchain_community.tools import TavilySearchResults
|
| 11 |
import operator
|
| 12 |
from typing import Annotated
|
| 13 |
from typing_extensions import TypedDict
|
|
@@ -36,7 +36,7 @@ class BasicAgent:
|
|
| 36 |
input_state = {"question": question}
|
| 37 |
# Run the graph
|
| 38 |
answer = self.graph.invoke(input_state)
|
| 39 |
-
print(f"Agent returning fixed answer: {answer
|
| 40 |
return answer
|
| 41 |
|
| 42 |
class State(TypedDict):
|
|
@@ -96,7 +96,7 @@ def generate_answer(state):
|
|
| 96 |
answer = llm.invoke([SystemMessage(content=final_instruction)] + [HumanMessage(content=f"Answer the question: {question}")])
|
| 97 |
|
| 98 |
# Append it to state
|
| 99 |
-
return {"answer": answer
|
| 100 |
|
| 101 |
|
| 102 |
builder = StateGraph(State)
|
|
|
|
| 7 |
from langgraph.graph import StateGraph, MessagesState, START
|
| 8 |
from langchain_core.messages import SystemMessage, HumanMessage
|
| 9 |
from langchain_community.document_loaders import WikipediaLoader
|
| 10 |
+
from langchain_community.tools import TavilySearchResults
|
| 11 |
import operator
|
| 12 |
from typing import Annotated
|
| 13 |
from typing_extensions import TypedDict
|
|
|
|
| 36 |
input_state = {"question": question}
|
| 37 |
# Run the graph
|
| 38 |
answer = self.graph.invoke(input_state)
|
| 39 |
+
print(f"Agent returning fixed answer: {answer}")
|
| 40 |
return answer
|
| 41 |
|
| 42 |
class State(TypedDict):
|
|
|
|
| 96 |
answer = llm.invoke([SystemMessage(content=final_instruction)] + [HumanMessage(content=f"Answer the question: {question}")])
|
| 97 |
|
| 98 |
# Append it to state
|
| 99 |
+
return {"answer": answer}
|
| 100 |
|
| 101 |
|
| 102 |
builder = StateGraph(State)
|