Overview
This node integrates with the LiteLLM API to create chat completions using specified language models. It is useful for generating conversational AI responses based on a sequence of input messages. Practical applications include building chatbots, virtual assistants, or any system requiring AI-generated dialogue.
Use Case Examples
- Generating a chatbot response to user input in a customer support scenario.
- Creating interactive conversational agents for websites or applications.
Properties
| Name | Meaning |
|---|---|
| Model | The language model to be used for generating the chat completion. |
| Messages | An array of messages representing the conversation history to provide context for the chat completion. |
| Temperature | Controls the randomness of the generated output, with values between 0 and 2. |
| Max Tokens | The maximum number of tokens to generate in the completion. |
| User Identifier | An optional identifier for the user to assist with tracking and rate limiting. |
| Custom Headers | Additional custom HTTP headers to include in the API request. |
| Additional Fields | Optional parameters to fine-tune the generation such as top_p, frequency penalty, presence penalty, and whether to stream the response. |
Output
JSON
response- The full response object returned from the LiteLLM API containing the chat completion result.model- The model used for generating the chat completion.messages- The array of input messages sent to the API.userIdentifier- The user identifier provided for tracking and rate limiting.customHeaders- The custom headers included in the API request.
Dependencies
- Requires an API key credential for LiteLLM API access.
- Needs network access to the LiteLLM API endpoint (default: https://api.litellm.ai/v1).
Troubleshooting
- Invalid JSON format in the 'Messages' input will cause an error; ensure the messages are a valid JSON array.
- Custom headers must be valid JSON; invalid JSON will cause an error.
- API authentication errors may occur if the API key is missing or invalid.
- Rate limiting or tracking issues may arise if the 'User Identifier' is not properly set when required.
Links
- LiteLLM API Documentation - Official documentation for the LiteLLM API used by this node.