Qwen icon

Qwen

Consume Qwen AI

Actions2

Overview

The node provides an interface to generate text completions using the "FIM" resource's "Complete" operation from the Qwen AI service. It sends a prompt to a selected language model and returns generated completions based on that prompt. This is useful for scenarios such as content generation, creative writing assistance, code completion, or any task requiring natural language generation.

For example, you can input a partial sentence or question as a prompt, select a suitable model, and receive one or more continuations or answers generated by the AI model.

Properties

Name Meaning
Model The AI model used to generate the completion. You can select from available models fetched dynamically from the service.
Prompt The input text prompt for which the completion will be generated.
Simplify Whether to return a simplified version of the response containing only the main completion data instead of the full raw API response.
Echo Prompt If enabled, the prompt text will be included in the output along with the generated completion.
Frequency Penalty Penalizes new tokens based on their existing frequency in the generated text to reduce repetition. Values range from -2 to 2.
Logprobs Whether to include log probabilities of each output token in the response.
Maximum Number of Tokens The maximum number of tokens to generate in the completion. Most models support up to 2048 tokens, newer ones up to 32,768.
Presence Penalty Penalizes new tokens based on whether they appear in the text so far, encouraging the model to talk about new topics. Values range from -2 to 2.
Sampling Temperature Controls randomness of the output. Lower values make output more deterministic; higher values increase randomness. Range: 0 to 1.
Suffix Text appended after the generated completion.
Top P Controls diversity via nucleus sampling. A value of 0.5 means half of all likelihood-weighted options are considered. Recommended to adjust either this or temperature but not both simultaneously.

Output

The node outputs JSON data representing the completion results from the AI model. If the "Simplify" option is enabled, the output contains a data field with an array of completion choices extracted from the raw API response. Each choice typically includes the generated text and possibly other metadata depending on options like log probabilities.

Binary data output is not applicable for this node.

Dependencies

  • Requires an API key credential for authenticating with the Qwen AI service.
  • The node communicates with the Qwen AI endpoint at https://dashscope.aliyuncs.com/compatible-mode/v1.
  • Dynamic loading of available models is performed via a GET request to /models.

Troubleshooting

  • Common issues:
    • Invalid or missing API credentials will cause authentication failures.
    • Selecting an unsupported model or exceeding token limits may result in errors.
    • Network connectivity problems can prevent communication with the Qwen AI service.
  • Error messages:
    • Authentication errors indicate invalid or missing API keys; verify your credentials.
    • Rate limit or quota exceeded errors require checking your subscription or usage limits.
    • Invalid parameter errors suggest incorrect property values (e.g., negative max tokens).
  • To resolve issues, ensure correct API credentials, validate input parameters, and check network access.

Links and References

  • Qwen AI Console — Official console for managing models and API keys.
  • Refer to the Qwen AI API documentation for detailed information on model capabilities and parameters.

Discussion