WXAI icon

WXAI

Consume WXAI API with Gemini 2.0 Flash model

Overview

This node provides an interface to generate text completions using the WXAI API with the Gemini 2.0 Flash model. It is designed for chat-based interactions where you send a sequence of messages (with roles like user, assistant, or system) and receive a generated completion from the AI model.

Common scenarios include:

  • Building conversational agents or chatbots.
  • Generating AI-driven responses based on user input.
  • Automating content creation or summarization in chat format.

For example, you can send a series of messages representing a conversation history and get the next assistant reply generated by the model.

Properties

Name Meaning
Model The AI model used to generate the completion. Default is "gemini-2.0-flash".
Prompt A collection of messages forming the conversation history. Each message has:
- Role: one of Assistant, System, or User.
- Content: the text content of the message.
Simplify Whether to return a simplified version of the response containing only the choices data, instead of the full raw API response. Defaults to true.
Options Additional parameters controlling generation:
- Maximum Number of Tokens Max tokens to generate in the completion (default 1024, max 8192).
- Sampling Temperature Controls randomness of output; lower values make output less random (default 1, range 0-2).
- Top P Controls diversity via nucleus sampling (default 1, range 0-1).

Output

The node outputs JSON data representing the AI-generated completions. If "Simplify" is enabled (default), the output contains only the choices array from the API response under the data property. Each choice typically includes the generated text and related metadata.

If binary data were supported, it would be summarized here, but this node focuses on textual completions.

Dependencies

  • Requires an API key credential for authenticating with the WXAI API.
  • Needs the base URL of the WXAI API configured in credentials.
  • No other external dependencies are indicated.

Troubleshooting

  • Common issues:

    • Invalid or missing API credentials will cause authentication errors.
    • Exceeding token limits may result in errors or truncated completions.
    • Incorrectly formatted messages (e.g., missing role or content) might cause request failures.
  • Error messages:

    • HTTP status errors are ignored internally, but the node may still fail if the API returns error details in the response body.
    • If the response does not contain expected fields (like choices), the simplification step may fail.
  • Resolutions:

    • Verify API credentials and base URL configuration.
    • Ensure messages are properly structured with valid roles and non-empty content.
    • Adjust token limits and temperature settings within allowed ranges.

Links and References

  • WXAI API documentation (not provided here, check your API provider's official docs).
  • General OpenAI/GPT-style chat completion concepts for understanding message roles and parameters.

Discussion