Skip to content

Commit

Permalink
update deepseek docs
Browse files Browse the repository at this point in the history
Signed-off-by: oilbeater <[email protected]>
  • Loading branch information
oilbeater committed Oct 11, 2024
1 parent 169b234 commit 6bf87bd
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 3 deletions.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,13 @@ It is written in **TypeScript**: ensuring adaptability to the rapidly evolving A

Then you can visit Malacca with the Worker domain or custom domain.

### How to use?
### Supported LLM Providers

- [Azure OpenAI](./docs/azure_openai.md)
- [DeepSeek](./docs/deepseek.md)

### How to use?

- [Virtual Key](./docs/virtual-key.md)
- [Caching](./docs/caching.md)
- [Guard](./docs/guards.md)
Expand Down
4 changes: 2 additions & 2 deletions docs/azure_openai.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Azure OpenAI Usage
# Azure OpenAI

To leverage the advanced features provided by Malacca while using the Azure OpenAI API, you only need to adjust the `base_url` configuration in their SDK. This simple change allows you to benefit from Malacca's capabilities such as caching, virtual key management, rate limiting, and logging.
To leverage the advanced features provided by Malacca while using the Azure OpenAI API, you only need to adjust the `base_url` configuration in the original SDK. This simple change allows you to benefit from Malacca's capabilities such as caching, virtual key management, rate limiting, logging and all other features.

You need to get the following parameters:

Expand Down
29 changes: 29 additions & 0 deletions docs/deepseek.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# DeepSeek

To leverage the advanced features provided by Malacca while using the DeepSeek API, you only need to adjust the `base_url` configuration in the original SDK. This simple change allows you to benefit from Malacca's capabilities such as caching, virtual key management, rate limiting, logging and all other features.

You need to get the following parameters:

- `Worker_Domain`: The domain url where your Worker is accessible, you can find it in your worker Settings.
- `Virtual_Key`: The virtual key that protect your real API key.

## Python Example

DeepSeek API is compatible with OpenAI API, so you can use [OpenAI Python SDK](https://github.com/openai/openai-python) to visit DeepSeek with Malacca endpoint.

```python
from openai import OpenAI

client = OpenAI(api_key="{Virtual_Key}", base_url="https://{Worker_Domain}/deepseek/")

response = client.chat.completions.create(
model="deepseek-chat",
messages=[
{"role": "system", "content": "You are a helpful assistant"},
{"role": "user", "content": "Tell me a very short story about Malacca."},
],
stream=False
)

print(response.choices[0].message.content)
```

0 comments on commit 6bf87bd

Please sign in to comment.