Update app_langgraph.py
Browse files- app_langgraph.py +7 -5
app_langgraph.py
CHANGED
|
@@ -15,7 +15,8 @@ from math_tools import multiply, add, subtract, divide
|
|
| 15 |
# from langchain_community.vectorstores import SupabaseVectorStore
|
| 16 |
import json
|
| 17 |
from langchain_google_genai import ChatGoogleGenerativeAI
|
| 18 |
-
from
|
|
|
|
| 19 |
|
| 20 |
# set_debug(True)
|
| 21 |
load_dotenv()
|
|
@@ -33,11 +34,12 @@ tools = [
|
|
| 33 |
def build_graph():
|
| 34 |
dashscope_key = os.getenv("CODING_PLAN_API_KEY") # 从 Coding Plan 页面获取
|
| 35 |
|
| 36 |
-
llm =
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
temperature=0.1,
|
|
|
|
| 41 |
)
|
| 42 |
|
| 43 |
chat_with_tools = llm.bind_tools(tools)
|
|
|
|
| 15 |
# from langchain_community.vectorstores import SupabaseVectorStore
|
| 16 |
import json
|
| 17 |
from langchain_google_genai import ChatGoogleGenerativeAI
|
| 18 |
+
from langchain_openai import ChatOpenAI
|
| 19 |
+
from langchain_core.messages import HumanMessage
|
| 20 |
|
| 21 |
# set_debug(True)
|
| 22 |
load_dotenv()
|
|
|
|
| 34 |
def build_graph():
|
| 35 |
dashscope_key = os.getenv("CODING_PLAN_API_KEY") # 从 Coding Plan 页面获取
|
| 36 |
|
| 37 |
+
llm = ChatOpenAI(
|
| 38 |
+
api_key=os.getenv("DASHSCOPE_API_KEY"),
|
| 39 |
+
base_url="https://dashscope.aliyuncs.com/compatible-mode/v1", # ⚠️ 关键:DashScope 兼容地址
|
| 40 |
+
model="qwen-plus", # 支持 qwen-plus, qwen-max, qwen-turbo 等
|
| 41 |
temperature=0.1,
|
| 42 |
+
verbose=True
|
| 43 |
)
|
| 44 |
|
| 45 |
chat_with_tools = llm.bind_tools(tools)
|