Update app_langgraph.py
Browse files- app_langgraph.py +9 -12
app_langgraph.py
CHANGED
|
@@ -15,6 +15,7 @@ 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 |
|
| 19 |
# set_debug(True)
|
| 20 |
load_dotenv()
|
|
@@ -30,20 +31,16 @@ tools = [
|
|
| 30 |
]
|
| 31 |
|
| 32 |
def build_graph():
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
|
|
|
|
|
|
|
|
|
| 37 |
)
|
| 38 |
|
| 39 |
-
|
| 40 |
-
chat_with_tools = chat.bind_tools(tools)
|
| 41 |
-
|
| 42 |
-
# llm = ChatGroq(model="qwen-qwq-32b", temperature=0)
|
| 43 |
-
# llm_with_tools = llm.bind_tools(tools)
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
chat_with_tools = chat.bind_tools(tools)
|
| 47 |
|
| 48 |
def assistant(state: MessagesState):
|
| 49 |
sys_msg = "You are a helpful assistant with access to tools. Understand user requests accurately. Use your tools when needed to answer effectively. Strictly follow all user instructions and constraints." \
|
|
|
|
| 15 |
# from langchain_community.vectorstores import SupabaseVectorStore
|
| 16 |
import json
|
| 17 |
from langchain_google_genai import ChatGoogleGenerativeAI
|
| 18 |
+
from langchain_alibaba.chat_models import ChatDashScope
|
| 19 |
|
| 20 |
# set_debug(True)
|
| 21 |
load_dotenv()
|
|
|
|
| 31 |
]
|
| 32 |
|
| 33 |
def build_graph():
|
| 34 |
+
dashscope_key = os.getenv("CODING_PLAN_API_KEY") # 从 Coding Plan 页面获取
|
| 35 |
+
|
| 36 |
+
llm = ChatDashScope(
|
| 37 |
+
model="qwen3.5-plus", # Coding Plan 支持的模型 [[6]]
|
| 38 |
+
dashscope_api_key=dashscope_key,
|
| 39 |
+
base_url="https://coding.dashscope.aliyuncs.com/v1", # ⚠️ 关键:Coding Plan 专属 Base URL
|
| 40 |
+
temperature=0.1,
|
| 41 |
)
|
| 42 |
|
| 43 |
+
chat_with_tools = llm.bind_tools(tools)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 44 |
|
| 45 |
def assistant(state: MessagesState):
|
| 46 |
sys_msg = "You are a helpful assistant with access to tools. Understand user requests accurately. Use your tools when needed to answer effectively. Strictly follow all user instructions and constraints." \
|