Straico Official icon

Straico Official

Get data from Straico API

Overview

The node integrates with the Straico API to perform various operations related to Retrieval-Augmented Generation (RAG) resources. Specifically, for the RAG Prompt Completion operation, it sends a user-provided prompt to a specified RAG resource and retrieves a generated completion based on that prompt. This is useful in scenarios where you want to leverage a knowledge base or document collection indexed by the RAG system to generate context-aware responses or completions.

Practical examples include:

  • Querying a custom knowledge base to get detailed answers.
  • Generating text completions informed by specific documents uploaded to the RAG.
  • Enhancing chatbots or virtual assistants with domain-specific information retrieval and generation.

Properties

Name Meaning
RAG ID The unique identifier of the RAG resource to which the prompt will be sent.
Prompt The input text prompt for which the completion is requested.
Model The model identifier used to generate the completion.
Search Type The method used to search within the RAG documents before generating the completion. Options: Similarity, Mmr, Similarity_score_threshold
K Number of top relevant chunks/documents to consider for the completion.
Fetch_k Number of chunks/documents to fetch initially before filtering down to K.
Lambda_mult A weighting multiplier parameter used in the search algorithm (e.g., for MMR).
Score_threshold Threshold score to filter out less relevant chunks/documents during search.

Output

The output JSON contains the response from the Straico API for the prompt completion request. It typically includes fields such as:

  • id: Identifier of the completion request.
  • message: The generated completion text.
  • model: The model used for generation.
  • usage: Information about token usage or cost.
  • created_at: Timestamp of the completion creation.

If the "Simplify" option is enabled, the output is a simplified object containing only these key fields instead of the full raw response.

No binary data output is produced by this operation.

Dependencies

  • Requires an API key credential for authenticating requests to the Straico API.
  • The node makes HTTP POST requests to the endpoint:
    https://api.straico.com/v0/rag/{ragId}/prompt
  • Content-Type header for the request is application/x-www-form-urlencoded.
  • The node depends on n8n's HTTP request helper with authentication support.

Troubleshooting

  • Missing Binary Data Error: Not applicable for this operation since it does not handle binary inputs.
  • Invalid RAG ID: If the provided RAG ID does not exist or is incorrect, the API will likely return an error. Verify the RAG ID is correct and accessible.
  • Model Parameter Required: The model property is mandatory; omitting it will cause the request to fail.
  • Search Type and Parameters: Using invalid values for search type or numeric parameters like k, fetch_k, lambda_mult, or score_threshold may result in unexpected behavior or errors. Use valid options and reasonable numeric ranges.
  • API Authentication Errors: Ensure the API key credential is correctly configured in n8n and has sufficient permissions.
  • Simplify Option: If enabled, the output is reduced to essential fields. If you expect full details, disable this option.

Links and References

Discussion