Custom DeepSeek Chat Model icon

Custom DeepSeek Chat Model

For advanced usage with an AI chain

Custom DeepSeek Chat Model

AI-generated

Overview

This node integrates with a custom DeepSeek chat model designed for advanced AI chain usage within n8n workflows. It acts as a language model completion provider, generating text or JSON responses based on prompts passed through an AI chain or agent. The node is particularly useful when you want to leverage DeepSeek's language models for tasks such as content generation, summarization, question answering, or any scenario requiring AI-generated text completions.

Typical use cases include:

  • Enhancing automation workflows with AI-generated insights.
  • Creating conversational agents or chatbots that rely on DeepSeek's language models.
  • Generating structured JSON outputs from natural language prompts by enabling the JSON response format.
  • Experimenting with various model parameters like temperature and penalties to fine-tune output creativity and relevance.

Properties

Name Meaning
This node must be connected to an AI chain. Insert one A notice indicating that this node requires connection to an AI chain or agent node to function properly.
If using JSON response format, you must include word "json" in the prompt in your chain or agent. Also, make sure to select latest models released post November 2023. A notice shown only when the response format is set to JSON, reminding users to include the word "json" in their prompt and to use recent models supporting JSON output.
Model The identifier of the DeepSeek model used to generate completions. Users can specify which model to use; default is "72109618427576320".
Options A collection of additional parameters to customize the model's behavior:
    Frequency Penalty Penalizes new tokens based on their existing frequency in the generated text to reduce repetition. Range: -2 to 2. Default: 0.
    Max Retries Maximum number of retry attempts if the request fails. Default: 2.
    Maximum Number of Tokens Limits the number of tokens generated in the completion. Most models support up to 2048 tokens; newer ones up to 32,768. Default: -1 (no limit).
    Presence Penalty Penalizes new tokens based on whether they appear in the text so far, encouraging the model to discuss new topics. Range: -2 to 2. Default: 0.
    Response Format Determines the format of the model's response: text for plain text or json_object for JSON output. Default: text.
    Sampling Temperature Controls randomness of the output. Lower values make output more deterministic; higher values increase creativity. Range: 0 to 2. Default: 0.7.
    Timeout Maximum time allowed for the request in milliseconds. Default: 360000 (6 minutes).
    Top P Controls diversity via nucleus sampling. Value between 0 and 1; lower values restrict token selection to more likely options. Default: 1.

Output

The node outputs data on the ai_languageModel output channel with the following structure:

  • json: Contains the AI-generated completion result. Depending on the selected response format, this will be either:

    • Plain text string representing the generated text completion.
    • A JSON object guaranteed to be valid JSON when the JSON response format is enabled.
  • binary: Not explicitly handled or output by this node, so no binary data is expected.

Dependencies

  • Requires a valid API key credential for the DeepSeek custom API service.
  • The node uses the DeepSeek API endpoint URL provided in the credentials.
  • Supports proxy configuration automatically if the URL requires it.
  • Relies on the DeepSeek language model API and its specific model identifiers.
  • For JSON response format, users must ensure their AI chain or agent includes the keyword "json" in prompts and selects compatible models released after November 2023.

Troubleshooting

  • Common Issues:

    • Failure to connect to the DeepSeek API due to missing or incorrect API credentials.
    • Timeout errors if the model takes too long to respond; consider increasing the timeout property.
    • Invalid JSON output if the prompt does not include the required "json" keyword when using JSON response format.
    • Repeated or low-quality completions if penalty and temperature settings are not tuned appropriately.
  • Error Messages:

    • Errors related to authentication usually indicate invalid or missing API keys.
    • Request failures may trigger retries up to the configured maxRetries count.
    • If the node throws errors about response parsing, verify that the prompt and model support the requested response format.

Links and References

Discussion