Skip to content

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.

  1. Resolve: Call /v1/resolve and perform the action.
  2. Feedback: Provide a UI mechanism for the user to signal “This was wrong”.
    • Example: A “Thumbs Down” button or an “Undo” action.
  3. Correction: If the user corrects the action (e.g., by selecting the right tool manually), call /v1/correct.

When a user clicks “Thumbs Down”:

  1. Ask them “What did you expect to happen?” (Show a dropdown of available tools).
  2. If they select a tool, capture it.
  3. Send the original query and the user’s selected correct_tool to 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"
})
});
}

Calling /v1/correct does two things:

  1. Invalidates the Cache: The next time someone asks that query, it won’t be a cached hit of the wrong answer.
  2. 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.