Skip to content

Commit 63901db

Browse files
committed
Add Deepseek to README
1 parent 43d66be commit 63901db

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

README.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ Stream text with GPT-4, transcribe and translate audio with Whisper, or create i
2929
- [Errors](#errors)
3030
- [Faraday middleware](#faraday-middleware)
3131
- [Azure](#azure)
32+
- [Deepseek](#deepseek)
3233
- [Ollama](#ollama)
3334
- [Groq](#groq)
3435
- [Counting Tokens](#counting-tokens)
@@ -228,6 +229,28 @@ end
228229

229230
where `AZURE_OPENAI_URI` is e.g. `https://custom-domain.openai.azure.com/openai/deployments/gpt-35-turbo`
230231

232+
#### Deepseek
233+
234+
[Deepseek](https://api-docs.deepseek.com/) is compatible with the OpenAI chat API. Get an access token from [here](https://platform.deepseek.com/api_keys), then:
235+
236+
```ruby
237+
client = OpenAI::Client.new(
238+
access_token: "deepseek_access_token_goes_here",
239+
uri_base: "https://api.deepseek.com/"
240+
)
241+
242+
client.chat(
243+
parameters: {
244+
model: "deepseek-chat", # Required.
245+
messages: [{ role: "user", content: "Hello!"}], # Required.
246+
temperature: 0.7,
247+
stream: proc do |chunk, _bytesize|
248+
print chunk.dig("choices", 0, "delta", "content")
249+
end
250+
}
251+
)
252+
```
253+
231254
#### Ollama
232255

233256
Ollama allows you to run open-source LLMs, such as Llama 3, locally. It [offers chat compatibility](https://github.com/ollama/ollama/blob/main/docs/openai.md) with the OpenAI API.

0 commit comments

Comments
 (0)