Skip to content

GraphQL API for AI requests

Jan Provaznik requested to merge jp-ai-cache-api into master

What does this MR do and why?

Related to https://gitlab.com/gitlab-org/gitlab/-/issues/410521

Adds API for accessing cached AI requests/responses.

How to set up and validate locally

  1. Enable caching of AI requests
    Feature.enable(:ai_redis_cache)
  2. Trigger an AI action (for example "summarize comments" on issue show page)
  3. Check that request and response are returned with following query:
query {
  aiMessages {
    nodes {
      id
      requestId
      content
      role
      errors
    }
  }
}

Or get only bot response for a specific request id:

query {
  aiMessages(requestIds: ["999dac16-0893-4d11-9e01-2ab2a3c9128b"], roles: [BOT]) {
    nodes {
      id
      requestId
      content
      role
      errors
    }
  }
}

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Jan Provaznik

Merge request reports

Loading