Wanted LaaS icon

Wanted LaaS

Interact with Wanted LaaS API

Overview

This node integrates with the Wanted LaaS (Language as a Service) API to send chat messages to a specified language model preset. It allows users to interact programmatically with custom or pre-trained chat models hosted on the Wanted LaaS platform by providing prompts and receiving generated responses.

Common scenarios where this node is beneficial include:

  • Automating conversational AI workflows, such as customer support bots or virtual assistants.
  • Generating text completions or responses based on user input within an n8n workflow.
  • Experimenting with different language model presets by specifying their unique hash identifiers.

For example, you can use this node to send a system prompt defining the assistant's behavior, then send user messages to receive context-aware replies from the model.

Properties

Name Meaning
Preset Hash The unique hash identifier of the model preset to use. This is found in the URL when viewing a model in the Wanted LaaS dashboard.
System Prompt A system message that sets the behavior or persona of the assistant for the chat session. For example, "You are a helpful assistant...".
Message The user message to send to the chat model. Typically the main input text for which a response is desired.
Params Additional parameters passed as a JSON object to customize the API request further.
Temperature Sampling temperature controlling randomness in output generation. Valid values range between 0 and 2. Higher values produce more diverse outputs.
Additional Fields A collection of optional fields to fine-tune the response:
- Response Format: Choose between "Text" or "JSON Object" format for the response.
- Max Tokens: Maximum tokens to generate.
- Top P: Nucleus sampling parameter (0 to 1).
- Frequency Penalty: Penalizes new tokens based on existing frequency (-2 to 2).
- Presence Penalty: Penalizes new tokens based on whether they appear in the text so far (-2 to 2).

Output

The node outputs a JSON object containing the full response from the Wanted LaaS API under the json field. The structure includes:

  • choices: An array where each element contains a message object with the generated content.
  • The exact shape depends on the response format chosen (text or json_object).

If the response format is set to "Text", the output will primarily contain textual completions. If set to "JSON Object", the output will be structured as a JSON object representing the response.

No binary data output is produced by this node.

Dependencies

  • Requires an active Wanted LaaS API key credential and project identifier configured in n8n credentials.
  • Makes HTTP POST requests to the Wanted LaaS API endpoint at https://api-laas.wanted.co.kr/api/preset/v2/chat/completions.
  • Requires network access to the Wanted LaaS API service.

Troubleshooting

Common Issues

  • Missing or invalid API key/project: The node throws errors if the API key or project ID is not provided or invalid.
  • Invalid parameter values: Parameters like temperature, top_p, frequency_penalty, and presence_penalty must be within specified ranges; otherwise, the node raises validation errors.
  • Empty Preset Hash: The hash identifying the model preset cannot be empty.
  • Malformed Params JSON: The params property must be a valid JSON object; invalid JSON will cause errors.
  • API Request Failures: Network issues or incorrect credentials can cause request failures.

Error Messages and Resolutions

Error Message Cause Resolution
"No valid API key provided" Missing or empty API key credential Provide a valid API key in the node credentials.
"No valid project provided" Missing or empty project identifier Provide a valid project ID in the node credentials.
"Temperature must be between 0 and 2" Temperature value out of allowed range Set temperature between 0 and 2.
"Top P must be a number between 0 and 1" Top P value out of allowed range Set Top P between 0 and 1.
"Frequency penalty must be a number between -2 and 2" Frequency penalty out of allowed range Set frequency penalty between -2 and 2.
"Presence penalty must be a number between -2 and 2" Presence penalty out of allowed range Set presence penalty between -2 and 2.
"Preset Hash cannot be empty" Empty model preset hash Specify a valid preset hash string.
"Invalid params format: ..." Malformed JSON in Params property Ensure params is a valid JSON object.
"Request to Wanted LaaS API failed" API call failure due to various reasons Check network connectivity, API key, project permissions, and rate limits.
"Bad request: Please check your input parameters" API returned HTTP 400 Verify all input parameters for correctness.
"Authentication failed: Please check your API credentials" API returned HTTP 401 Confirm API key and project credentials are correct and active.
"Access forbidden: Please check your API permissions" API returned HTTP 403 Ensure the API key has necessary permissions for the requested operation.
"Too many requests: Please try again later" API rate limit exceeded Reduce request frequency or wait before retrying.
"Empty response from API" API returned no data Retry the request or check API status.
"Invalid response format: missing choices array" Unexpected API response structure Contact Wanted LaaS support or verify API version compatibility.
"Invalid response format: missing message content" Response missing expected message content Verify the model preset and request parameters.

Links and References

Discussion