This commit is contained in:
2025-08-27 22:21:14 +08:00
parent 75ae2c5fd5
commit f6c7c65d6c
6 changed files with 176 additions and 1 deletions

View File

@@ -0,0 +1,15 @@
from langchain_openai import ChatOpenAI
from langchain_deepseek import ChatDeepSeek
import os
chatLLM = ChatDeepSeek(
api_key=os.getenv("DASHSCOPE_API_KEY"),
base_url="https://dashscope.aliyuncs.com/compatible-mode/v1",
model="deepseek-chat", # 此处以qwen-plus为例您可按需更换模型名称。模型列表https://help.aliyun.com/zh/model-studio/getting-started/models
# other params...
)
messages = [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "你是谁?"}]
response = chatLLM.invoke(messages)
print(response.model_dump_json())