EasyRAG - External API (Advanced):
The RagPromptExternalChatAdvanced node is designed to facilitate advanced interactions with external APIs, specifically tailored for retrieval-augmented generation (RAG) tasks. This node allows you to leverage external models and APIs to generate responses based on a given question, utilizing a system prompt to guide the conversation. It is particularly beneficial for scenarios where you need to integrate external data sources or models into your workflow, providing a flexible and powerful tool for generating contextually relevant responses. By using this node, you can enhance the capabilities of your AI applications, making them more responsive and context-aware.
EasyRAG - External API (Advanced) Input Parameters:
question
This parameter is the main query or prompt you want the external API to respond to. It supports multiline input, allowing you to provide detailed questions or prompts. The quality and specificity of the question can significantly impact the relevance and accuracy of the response generated by the node.
base_url
The base URL specifies the endpoint of the external API you wish to interact with. By default, it is set to https://api.deepseek.com. This URL is crucial as it determines the API service that will process your request. Ensure the URL is correct and accessible to avoid connectivity issues.
api_key
The API key is a security credential required to authenticate your requests with the external API. It is essential to provide a valid API key to gain access to the API's services. Without a valid key, the API will likely reject your requests.
model
This parameter specifies the model to be used for generating responses. The default model is deepseek-chat. Choosing the right model is important as it affects the style and quality of the responses. Ensure the model is compatible with the API you are using.
system_prompt_source
This parameter allows you to select the source of the system prompt, which guides the conversation. You can choose from predefined prompt files or use a custom prompt. The default option is 🛠️ 自定义, which means you can input your own prompt directly.
system_prompt
The system prompt is a guiding statement that sets the tone and context for the conversation. It supports multiline input and defaults to "You are a rigorous local RAG assistant. Prefer answering from the provided context." This prompt helps the model understand the role it should play in the conversation.
temperature
This floating-point parameter controls the randomness of the response generation. A higher temperature (up to 1.0) results in more varied responses, while a lower temperature (closer to 0) makes the output more deterministic. The default value is 0.7, balancing creativity and coherence.
max_tokens
This integer parameter sets the maximum number of tokens (words or word pieces) in the generated response. It ranges from 0 to 8192, with a default of 2048. Adjusting this value can help manage the length and detail of the responses.
seed
The seed is an integer used to initialize the random number generator, ensuring reproducibility of results. It ranges from 0 to a very large number (0xffffffffffffffff). By setting a specific seed, you can achieve consistent outputs across different runs.
rag_index
This optional parameter allows you to specify a RAG index, which can be used to retrieve relevant context or data to augment the response generation. It is useful for tasks that require integration with external data sources.
image
This optional parameter allows you to include an image as part of the input, which can be used by the external API to generate responses that consider visual information.
EasyRAG - External API (Advanced) Output Parameters:
answer
This output parameter provides the generated response to the input question. It is the main output of the node, reflecting the model's interpretation and answer based on the provided context and system prompt.
context_used
This output parameter details the context that was utilized in generating the response. It helps you understand what information the model considered when crafting its answer, providing transparency and insight into the response generation process.
raw_response
This output parameter contains the raw data returned by the external API. It includes all the details of the API's response, which can be useful for debugging or further analysis.
EasyRAG - External API (Advanced) Usage Tips:
- Ensure your
base_urlis correct and accessible to avoid connectivity issues with the external API. - Use a specific and detailed
questionto improve the relevance and accuracy of the generated response. - Adjust the
temperatureparameter to balance between creativity and coherence in the responses, depending on your needs.
EasyRAG - External API (Advanced) Common Errors and Solutions:
HTTP 401: Unauthorized
- Explanation: This error occurs when the API key is missing or invalid.
- Solution: Verify that you have provided a valid
api_keyand that it has the necessary permissions to access the API.
HTTP 404: Not Found
- Explanation: This error indicates that the specified
base_urlis incorrect or the endpoint does not exist. - Solution: Double-check the
base_urlto ensure it is correct and points to a valid API endpoint.
HTTP 500: Internal Server Error
- Explanation: This error suggests a problem with the external API server.
- Solution: Try again later or contact the API provider for support if the issue persists.
