Spaces:
Runtime error
Runtime error
Update agent.py
Browse files
agent.py
CHANGED
|
@@ -4,16 +4,16 @@ from langgraph.graph.message import add_messages
|
|
| 4 |
from langchain_core.messages import AnyMessage, SystemMessage
|
| 5 |
from langgraph.prebuilt import ToolNode, tools_condition
|
| 6 |
from langgraph.graph import START, StateGraph
|
| 7 |
-
|
| 8 |
-
from langchain_google_genai import ChatGoogleGenerativeAI
|
| 9 |
|
| 10 |
from tools import tavily_search_tool, repl_tool
|
| 11 |
|
| 12 |
-
|
| 13 |
-
GOOGLE_API_KEY = os.environ.get("GOOGLE_API_KEY")
|
| 14 |
|
| 15 |
-
|
| 16 |
-
chat_model = ChatGoogleGenerativeAI(model="gemini-2.0-flash", google_api_key=GOOGLE_API_KEY)
|
| 17 |
tools = [tavily_search_tool, repl_tool]
|
| 18 |
chat_model_with_tools = chat_model.bind_tools(tools)
|
| 19 |
|
|
|
|
| 4 |
from langchain_core.messages import AnyMessage, SystemMessage
|
| 5 |
from langgraph.prebuilt import ToolNode, tools_condition
|
| 6 |
from langgraph.graph import START, StateGraph
|
| 7 |
+
from langchain_openai import ChatOpenAI
|
| 8 |
+
# from langchain_google_genai import ChatGoogleGenerativeAI
|
| 9 |
|
| 10 |
from tools import tavily_search_tool, repl_tool
|
| 11 |
|
| 12 |
+
OPENAI_API_KEY = os.environ.get("OPENAI_API_KEY")
|
| 13 |
+
# GOOGLE_API_KEY = os.environ.get("GOOGLE_API_KEY")
|
| 14 |
|
| 15 |
+
chat_model = ChatOpenAI(model='gpt-4.1-mini', temperature=0, api_key=OPENAI_API_KEY)
|
| 16 |
+
# chat_model = ChatGoogleGenerativeAI(model="gemini-2.0-flash", google_api_key=GOOGLE_API_KEY)
|
| 17 |
tools = [tavily_search_tool, repl_tool]
|
| 18 |
chat_model_with_tools = chat_model.bind_tools(tools)
|
| 19 |
|