Create deepseek_text_gen.py
This commit is contained in:
16
lib/gpt_providers/text_generation/deepseek_text_gen.py
Normal file
16
lib/gpt_providers/text_generation/deepseek_text_gen.py
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
# Please install OpenAI SDK first: `pip3 install openai`
|
||||||
|
|
||||||
|
from openai import OpenAI
|
||||||
|
|
||||||
|
client = OpenAI(api_key="<DeepSeek API Key>", base_url="https://api.deepseek.com")
|
||||||
|
|
||||||
|
response = client.chat.completions.create(
|
||||||
|
model="deepseek-chat",
|
||||||
|
messages=[
|
||||||
|
{"role": "system", "content": "You are a helpful assistant"},
|
||||||
|
{"role": "user", "content": "Hello"},
|
||||||
|
],
|
||||||
|
stream=False
|
||||||
|
)
|
||||||
|
|
||||||
|
print(response.choices[0].message.content)
|
||||||
Reference in New Issue
Block a user