You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
llm/01-大模型基本调用/04-langchain测试私有化部署的大模型.py

19 lines
415 B

from langchain_openai import ChatOpenAI
# llm对象就是调用大模型的对象
llm = ChatOpenAI(
model = "qwen3-8b",
base_url="http://localhost:6006/v1",
api_key="xxxx",
temperature=0.8,
);
# message是咱准备的问题信息
message = [
('system','你是一个智能助手'),
('human','来个相声报幕词')
]
# 调用大模型
resp = llm.invoke(message);
# 输出结果
print(resp)