Skip to content

Commit

Permalink
[apps/deepseek] use reasoning model
Browse files Browse the repository at this point in the history
  • Loading branch information
javierluraschi committed Jan 26, 2025
1 parent 45a800f commit 9f08211
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions apps/deepseek/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

client = OpenAI(
api_key="hal9",
base_url="https://api.hal9.com/proxy/server=https://api.deepseek.com")
base_url="http://localhost:5000/proxy/server=https://api.deepseek.com")

stream = client.chat.completions.create(
model="deepseek-chat",
model="deepseek-reasoner",
messages=[
{"role": "system", "content": "You are a helpful assistant"},
{"role": "user", "content": input()},
Expand All @@ -14,5 +14,8 @@
)

for chunk in stream:
if len(chunk.choices) > 0 and chunk.choices[0].delta.content is not None:
print(chunk.choices[0].delta.content, end="")
if len(chunk.choices) > 0:
if chunk.choices[0].delta.reasoning_content is not None and chunk.choices[0].delta.reasoning_content:
print(chunk.choices[0].delta.reasoning_content, end="")
elif chunk.choices[0].delta.content is not None:
print(chunk.choices[0].delta.content, end="")

0 comments on commit 9f08211

Please sign in to comment.