Skip to content

Add additional context to AiChat GraphQL mutation

What does this MR do and why?

Adds additional context argument to AiChatInput GraphQL type.

Related to #477258 (closed), #478241 (closed), !162202 (closed)

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

How to validate locally

  1. Run bundle exec rails c
  2. Enable feature flag Feature.enable(:duo_additional_context)
  3. Enable feature flag Feature.enable(:v2_chat_agent_integration)
  4. Start gdk with LLM debug. In your gdk directory run the following commands:
    1. export LLM_DEBUG=1
    2. gdk start
    3. tail -f rails/log/llm.log
  5. Navigate to http://gdk.test:3000/-/graphql-explorer
  6. Run the following mutation:
    mutation {
      aiAction(input: {chat: {content: "Explain this code", additionalContext: [
        { type: SNIPPET, name: "hello world", content: "puts 'Hello, world'" }
      ]}}) {
        clientMutationId
        errors
      }
    }
  7. Check LLM logs
  8. You should see a record similar to this truncated example
    {"severity":"DEBUG","time":"2024-08-08T09:40:34.337Z","action_name":"chat","options":{"content":"Explain this code","additional_context":[{"type":"snippet","name":"hello world","content":"puts 'Hello, world'"}],"referer_url":"http://gdk.test:3000/-/graphql-explorer"}}
    
Edited by Missy Davies

Merge request reports

Loading