Guide: The Correct & Learn Loop
The /v1/correct endpoint allows your application to learn from its mistakes. By building a feedback loop, your intent resolution accuracy will improve over time automatically.
The Flow
Section titled “The Flow”- Resolve: Call
/v1/resolveand perform the action. - Feedback: Provide a UI mechanism for the user to signal “This was wrong”.
- Example: A “Thumbs Down” button or an “Undo” action.
- Correction: If the user corrects the action (e.g., by selecting the right tool manually), call
/v1/correct.
Implementing in UI
Section titled “Implementing in UI”When a user clicks “Thumbs Down”:
- Ask them “What did you expect to happen?” (Show a dropdown of available tools).
- If they select a tool, capture it.
- Send the original
queryand the user’s selectedcorrect_toolto the API.
async function sendFeedback(originalQuery, correctToolName) { await fetch('https://api.intentgine.dev/v1/correct', { method: 'POST', body: JSON.stringify({ query: originalQuery, correct_tool: correctToolName, target_bank: "my-learning-bank" }) });}Immediate Impact
Section titled “Immediate Impact”Calling /v1/correct does two things:
- Invalidates the Cache: The next time someone asks that query, it won’t be a cached hit of the wrong answer.
- Updates Memory Bank: It adds the new mapping to the Memory Bank. The next resolution will see this example and likely choose the correct tool.