The DeepSeek API has recently undergone a significant upgrade, introducing a suite of powerful new features designed to enhance its capabilities and broaden its application across diverse use cases. This update focuses on providing developers with more control, flexibility, and efficiency when working with the DeepSeek models.
The latest update brings several key enhancements:
These features are available for both deepseek-chat
and deepseek-coder
models, providing a versatile toolkit for developers.
Let's explore each feature in more detail:
The new JSON Output feature is a game-changer for applications requiring structured data processing. By enforcing a valid JSON format for the model's output, it streamlines subsequent parsing and automation workflows.
How to use JSON Output:
response_format
to {'type': 'json_object'}
.max_tokens
appropriately to prevent truncation.This feature is particularly useful for tasks like data extraction, knowledge representation, and generating structured reports. For a more step-by-step guide, check out the JSON Output Guide.
Function Calling empowers the DeepSeek API to interact with external tools and services, enabling a wide range of applications beyond simple text generation.
Key Capabilities:
Imagine integrating DeepSeek with a website crawler tool like in LobeChat, demonstrated in the API documentation. This allows the model to fetch information from websites and provide summaries, opening doors to automated research, information gathering, and more. Explore practical applications in the Function Calling Guide.
Chat Prefix Completion offers developers greater control over the generated output by allowing them to specify a prefix for the last assistant message. This is particularly useful for:
max_tokens
limit.How to use Chat Prefix Completion:
base_url
to https://api.deepseek.com/beta
to enable Beta features.True
.For example, you can force the model to start with a code block by setting the prefix to ```python\n`, further refining the output using the 'stop' parameter. Learn more in the Chat Prefix Completion Guide.
FIM (Fill-In-the-Middle) Completion allows users to provide a prefix and suffix, prompting the model to complete the content in between.
Ideal Use Cases:
To use FIM Completion, remember to set base_url
to https://api.deepseek.com/beta
to enable the Beta features. See how to best utilize this feature in the FIM Completion Guide.
The increase in the max_tokens
parameter to 8K in the Beta API addresses the need for handling longer text outputs. Allowing models to produce more detailed, nuanced, and comprehensive responses.
How to Enable:
base_url
to https://api.deepseek.com/beta
.max_tokens
up to 8192. For a better understanding of how tokens work, refer to this Token & Token Usage guide.It's important to remember that features marked as "Beta" are considered unstable. This means their behavior and availability may change as DeepSeek continues to refine and improve them. To use any of the beta features, ensure that you set the base_url
to https://api.deepseek.com/beta
.
DeepSeek encourages users to explore these new features and provide feedback. The company plans to release related model versions to the open-source community once the functionality is stable. Stay tuned for further updates and announcements!
For more resources, you can check out DeepSeek's integrations and other Other Resources to help start your journey.