Overview
This node integrates with the YandexGPT API to generate chat completions based on a sequence of messages. It is designed for conversational AI scenarios where users want to simulate dialogue or get AI-generated responses in a chat format. Typical use cases include building chatbots, virtual assistants, or interactive Q&A systems that leverage Yandex's language models.
For example, you can provide a series of messages representing a conversation history (including system instructions, user inputs, and assistant replies), and the node will generate the next assistant message completing the chat.
Properties
| Name | Meaning |
|---|---|
| Model | The YandexGPT model to use for completion. Options: "YandexGPT Lite" (faster, economical), "YandexGPT" (higher quality), "YandexGPT Pro" (latest enhanced capabilities). |
| Messages | The list of chat messages forming the conversation context. Each message has a Role (System, User, Assistant) and Text content. Multiple messages can be provided. |
| Temperature | Controls randomness in the output generation. Values range from 0 to 1; higher values produce more random and creative responses. |
| Max Tokens | Maximum number of tokens to generate in the completion response. Range: 1 to 8000 tokens. |
| Options | Additional options collection. Currently supports: Stream (boolean) - whether to stream partial results back during generation. |
Output
The node outputs an array of JSON objects, each containing:
message: The generated assistant message object with role and text.usage: Information about token usage returned by the API.modelVersion: The version of the model used for generation.input: Echoes the input parameters including messages, model, temperature, and max tokens.
If streaming is enabled, partial progress may be streamed back, but this is controlled by the stream option.
No binary data output is produced by this node.
Dependencies
- Requires an API key credential for authenticating with the YandexGPT API.
- Needs configuration of the API endpoint URL and folder ID as part of the credentials.
- Uses an IAM token obtained via helper functions for authorization.
- Relies on HTTP requests to the Yandex Foundation Models API endpoint
/foundationModels/v1/completion.
Troubleshooting
- No messages provided: If the messages array is empty, the node throws an error indicating no messages were supplied. Ensure at least one message is provided.
- Invalid API response: If the API response lacks expected fields (
resultoralternatives), an error is thrown. Check API credentials and endpoint configuration. - Completion failed status: If the returned completion status is not final, the node reports failure with the status code. This might indicate an incomplete or interrupted generation.
- Authentication errors: Issues obtaining the IAM token or invalid API keys will cause failures. Verify credentials and permissions.
- Streaming issues: If streaming is enabled but not supported or misconfigured, partial results may not be received correctly.
To resolve errors, verify all input parameters, ensure valid credentials, and confirm network connectivity to the Yandex API.