Update app.py
Browse files
app.py
CHANGED
|
@@ -16,9 +16,9 @@ from langchain.output_parsers.openai_functions import JsonOutputFunctionsParser
|
|
| 16 |
from langchain_core.prompts import ChatPromptTemplate, MessagesPlaceholder
|
| 17 |
from langgraph.graph import StateGraph, END
|
| 18 |
from typing import Annotated, Sequence, TypedDict
|
| 19 |
-
from langchain_core.tools import tool
|
| 20 |
import functools
|
| 21 |
import operator
|
|
|
|
| 22 |
|
| 23 |
# Load environment variables
|
| 24 |
OPENAI_API_KEY = os.getenv("OPENAI_API_KEY")
|
|
@@ -47,6 +47,7 @@ def agent_node(state, agent, name):
|
|
| 47 |
|
| 48 |
@tool
|
| 49 |
def RAG(state):
|
|
|
|
| 50 |
st.session_state.outputs.append('-> Calling RAG ->')
|
| 51 |
question = state
|
| 52 |
template = """Answer the question based only on the following context:\n{context}\nQuestion: {question}"""
|
|
|
|
| 16 |
from langchain_core.prompts import ChatPromptTemplate, MessagesPlaceholder
|
| 17 |
from langgraph.graph import StateGraph, END
|
| 18 |
from typing import Annotated, Sequence, TypedDict
|
|
|
|
| 19 |
import functools
|
| 20 |
import operator
|
| 21 |
+
from langchain_core.tools import tool
|
| 22 |
|
| 23 |
# Load environment variables
|
| 24 |
OPENAI_API_KEY = os.getenv("OPENAI_API_KEY")
|
|
|
|
| 47 |
|
| 48 |
@tool
|
| 49 |
def RAG(state):
|
| 50 |
+
"""Use this tool to execute RAG. If the question is related to Japan or Sports, this tool retrieves the results."""
|
| 51 |
st.session_state.outputs.append('-> Calling RAG ->')
|
| 52 |
question = state
|
| 53 |
template = """Answer the question based only on the following context:\n{context}\nQuestion: {question}"""
|