Actions13
- Agent Actions
- Datastore Actions
- Query Actions
- Reranker Actions
- LMUnit Actions
- Parser Actions
Overview
The "Contextual AI" node provides access to Contextual AI tools, enabling users to run language model unit tests (LMUnit). Specifically, the "Run LMUnit" operation allows users to input a query and its corresponding response, then define a unit test condition that the response should satisfy. This is useful for validating AI-generated answers against expected criteria, ensuring quality and relevance in AI outputs.
Common scenarios include:
- Testing if an AI-generated response contains specific keywords or concepts.
- Validating responses during development of AI-powered chatbots or assistants.
- Automating quality checks on AI outputs in workflows.
Example:
You provide a query like "What is machine learning?", a generated response such as "Machine learning is a subset of AI that enables systems to learn from data," and a unit test condition like "Response should mention AI and learning." The node evaluates whether the response meets this condition.
Properties
| Name | Meaning |
|---|---|
| Query | The input question or prompt to be tested, e.g., "What is machine learning?" |
| Response | The AI-generated answer to the query, e.g., "Machine learning is a subset of AI..." |
| Unit Test | A string defining the test condition that the response should satisfy, e.g., "Response should mention AI and learning" |
| Authentication | Method of authentication to use; currently supports "API Key" for accessing Contextual AI services |
Output
The node outputs JSON data representing the result of running the LMUnit test. This typically includes information about whether the response passed the unit test condition, possibly with details or messages explaining the outcome.
If binary data were involved, it would represent associated files or media, but this node focuses on textual validation and does not output binary data.
Dependencies
- Requires an API key credential for authenticating with the Contextual AI service.
- The node depends on external Contextual AI APIs to perform the LMUnit evaluation.
- Proper configuration of the API key credential within n8n is necessary for successful execution.
Troubleshooting
Common issues:
- Missing or invalid API key: Ensure the API key credential is correctly set up and valid.
- Improperly formatted unit test strings may cause unexpected results or failures.
- Empty or missing required properties (Query, Response, Unit Test) will prevent execution.
Error messages:
- Authentication errors indicate problems with the API key; verify credentials.
- Validation errors may occur if required inputs are empty or malformed; check input fields.
- API communication errors suggest network or service availability issues; retry later or check connectivity.
Links and References
- Contextual AI official documentation (example placeholder link)
- n8n documentation on creating custom nodes