SmartGent Chat icon

SmartGent Chat

Interact with SmartGent chat completions API

Overview

The node provides an interface to interact with the SmartGent chat completions API. It allows users to generate AI-powered chat completions by sending a sequence of messages and receiving a response from a specified language model. This is useful for automating conversational tasks, building chatbots, generating text based on dialogue context, or integrating AI-driven assistants into workflows.

Practical examples include:

  • Creating customer support chatbots that respond based on prior conversation history.
  • Generating creative writing or brainstorming ideas through interactive chat sessions.
  • Automating responses in messaging platforms or internal tools using AI-generated completions.

Properties

Name Meaning
Model Name or ID The specific AI model to use for generating the chat completion. Choose from a dynamically loaded list of available models or specify a custom model ID via expression.
Messages A collection of messages forming the conversation history to generate the completion for. Each message includes: role (System, User, Assistant), content type (text only or text + file), and the actual text or file URL.
Response Format The format of the response returned by the API. Options are "Default" (standard response) or "JSON Object" (forces the response to be a valid JSON object).
Enable Thinking Boolean flag to enable "thinking mode," which uses budget tokens to allow the model to think before responding.
Budget Tokens When thinking mode is enabled, this sets the maximum number of tokens allocated for the model's thinking process.
Temperature Controls randomness in the generated response. Ranges from 0 (deterministic output) to 2 (very random output).

Output

The node outputs the raw JSON response from the SmartGent chat completions API under the json field. This response contains the generated chat completion data including the text or structured content returned by the model.

No binary data output is produced by this node.

Dependencies

  • Requires an API key credential for the SmartGent Lite LLM API.
  • The node makes HTTP POST requests to the SmartGent API endpoint /v1/chat/completions.
  • The base URL and API key must be configured in the credential used by the node.

Troubleshooting

  • Common issues:

    • Invalid or missing API credentials will cause authentication errors.
    • Specifying an unsupported or incorrect model ID may result in API errors.
    • Improperly formatted messages (e.g., missing required fields) can cause request failures.
    • Enabling thinking mode without setting a positive budget token value might lead to unexpected behavior.
  • Error messages:

    • Errors returned from the API are captured and can be output per item if "Continue On Fail" is enabled.
    • Typical error messages relate to authorization failures, invalid parameters, or exceeding token limits.
  • Resolutions:

    • Verify API key validity and permissions.
    • Ensure the selected model exists and is accessible.
    • Validate message structure and required properties.
    • Set appropriate budget tokens when enabling thinking mode.

Links and References

Discussion