workspace working
This commit is contained in:
26
test_deepseek_direct.py
Normal file
26
test_deepseek_direct.py
Normal file
@@ -0,0 +1,26 @@
|
||||
import os
|
||||
import openai
|
||||
from openai import AsyncOpenAI
|
||||
|
||||
# Set environment variables
|
||||
os.environ["OPENAI_API_KEY"] = "sk-55f6e57f1d834b0e93ceaf98cc2cb715"
|
||||
os.environ["OPENAI_API_BASE"] = "https://api.deepseek.com/v1"
|
||||
|
||||
client = AsyncOpenAI(
|
||||
api_key=os.environ["OPENAI_API_KEY"],
|
||||
base_url=os.environ["OPENAI_API_BASE"]
|
||||
)
|
||||
|
||||
async def test():
|
||||
try:
|
||||
response = await client.chat.completions.create(
|
||||
model="deepseek-chat",
|
||||
messages=[{"role": "user", "content": "Hello"}],
|
||||
max_tokens=10
|
||||
)
|
||||
print("Success:", response.choices[0].message.content)
|
||||
except Exception as e:
|
||||
print("Error:", e)
|
||||
|
||||
import asyncio
|
||||
asyncio.run(test())
|
||||
Reference in New Issue
Block a user