15 lines
453 B
Python
15 lines
453 B
Python
|
|
import getpass
|
||
|
|
import os
|
||
|
|
|
||
|
|
if not os.environ.get("DEEPSEEK_API_KEY"):
|
||
|
|
os.environ["DEEPSEEK_API_KEY"] = os.environ['DASHSCOPE_API_KEY']
|
||
|
|
|
||
|
|
from langchain.chat_models import init_chat_model
|
||
|
|
|
||
|
|
model = init_chat_model("deepseek-chat", model_provider="deepseek")
|
||
|
|
|
||
|
|
messages = [
|
||
|
|
{"role": "system", "content": "You are a helpful assistant."},
|
||
|
|
{"role": "user", "content": "你是谁?"}]
|
||
|
|
response = model.invoke(messages)
|
||
|
|
print(response.model_dump_json())
|