Skip to main content
DeepSeek-V3 is a strong Mixture-of-Experts (MoE) language model that delivers exceptional performance and speed, surpassing its predecessors. With its advanced capabilities, DeepSeek-V3 ranks among the top open-source models and matches the performance of leading closed-source models. In this notebook, we will demonstrate how to use the DeepSeek-V3 model for AgentChat within the AG2 framework.

Requirements

To get started, ensure you meet the following requirements:
  1. Install the AG2 package:
    • Run the following command to install the AG2 package:
    If you have been using autogen or ag2, all you need to do is upgrade it using:
    or
    as autogen and ag2 are aliases for the same PyPI package.
  2. Obtain a DeepSeek API Key:
    • Sign up for a DeepSeek account here. to generate your API key.
    • Refer to the official documentation for more information about obtaining and using the API key.

Set the config for the DeepSeek API

Next, you need to configure the OAI_CONFIG_LIST to grant the agent access to the DeepSeek-V3 model. Here’s an example configuration:

API parameters

You can include additional parameters in your configuration that are supported by the DeepSeek API. For a full list of parameters and their default values, refer to the DeepSeek API documentation. Some examples of such parameters include:
  • temperature (number 0..1)
  • top_p (number 0..1)
  • max_tokens (null, integer >= 0)
Example Configuration:

Two-Agent Coding Example

In this example, we run a two-agent chat with an AssistantAgent (primarily a coding agent) to generate code to count the number of prime numbers between 1 and 10,000 and then it will be executed. We’ll use DeepSeek-V3 in our example.

Tool Call Example

In this example, instead of writing code, we will show how we can use DeepSeek-V3 model to perform parallel tool calling, where it recommends calling more than one tool at a time. We’ll use a simple travel agent assistant program where we have a couple of tools for weather and currency conversion. We start by importing libraries and setting up our configuration to use DeepSeek-V3 model.
We can see that DeepSeek-V3 recommended invoking both tools with the appropriate parameters. The user_proxy executed these calls, and the results were passed back to DeepSeek-V3 for interpretation and response.