Browse Source

删除旧版本引用

jihuaqiang 1 week ago
parent
commit
2e7fe30c27
3 changed files with 5 additions and 4 deletions
  1. 3 3
      agents/clean_agent/agent.py
  2. 1 1
      agents/clean_agent/tools.py
  3. 1 0
      requirements.txt

+ 3 - 3
agents/clean_agent/agent.py

@@ -3,8 +3,7 @@ from typing_extensions import TypedDict
 from langgraph.graph import StateGraph, START, END
 from langgraph.graph.message import add_messages
 import os
-from langchain.chat_models import init_chat_model
-from IPython.display import Image, display
+from langchain_openai import ChatOpenAI
 from .tools import evaluation_extraction_tool
 
 from langgraph.prebuilt import ToolNode, tools_condition
@@ -77,7 +76,8 @@ def execute_agent_with_api(user_input: str):
         # 如果graph或llm_with_tools未初始化,先初始化
         if graph is None or llm_with_tools is None:
             try:
-                llm = init_chat_model("openai:gpt-4.1")
+                # 使用新版本的 ChatOpenAI
+                llm = ChatOpenAI(model="gpt-4")
                 tools = [evaluation_extraction_tool]
                 llm_with_tools = llm.bind_tools(tools=tools)
                 

+ 1 - 1
agents/clean_agent/tools.py

@@ -1,4 +1,4 @@
-from langchain.tools import tool
+from langchain_core.tools import tool
 from sqlalchemy.orm import Session
 from typing import Dict, Any, Tuple
 import logging

+ 1 - 0
requirements.txt

@@ -13,5 +13,6 @@ uvicorn[standard]>=0.35.0
 langgraph==0.6.6
 langsmith==0.4.16
 langchain-openai==0.3.31
+langchain-core>=0.3.0
 
 google-generativeai==0.8.5