This node provides a straightforward way to interact with the Mistral AI API for single-turn chat completion requests. It's designed for quickly sending prompts to Mistral's language models and receiving a single response.
- Direct API Interaction: Sends a single request to the Mistral AI Chat Completion endpoint. No chat history is maintained by the node itself.
- Context via Templates: You can supply context to the language model by loading pre-defined templates. This allows for implementing techniques like few-shot prompting.
- Standalone Design: This node focuses specifically on basic Mistral API interaction, avoiding the inclusion of features you might not need.
-
The node doesn't introduce any hidden prompt additions. You have complete control over the instruction and the request sent to the API.
-
For Pixtral models, you can input images directly. The image will be downscaled to have a longest side of 1024 pixels before being processed.
-
A companion node lets you easily prepend content from files within a/prompts
folder to your main prompt. This makes it convenient to save and load your own instruction sets for consistent prompting strategies. Keep in mind that no formatting validation is performed on the template content. -
The node provides the raw text response from the API, allowing you to parse and utilize the output as needed in your workflow. For instance, you can request both plain text and structured information like tag prompts in a single request.
- Model Selection: The list of available models is hardcoded within the node. It does not dynamically fetch the list from the Mistral API.
- Seed Randomization: Unless you explicitly provide a seed value in the node's settings, the seed for the language model's response will be randomized server-side by Mistral AI.
- API Key: You will need to save your Mistral AI API key in a file named
API-key.txt
within the node's directory for it to function correctly.
For visual clarity in the examples, the following nodes are used to display the output:
- Show Text: From ComfyUI-Custom-Scripts.
- String Selector: From the ComfyUI-Impact-Pack.
- When working with smaller language models, experimenting with higher values for the penalty parameters (presence penalty, frequency penalty) might yield improved results.