Skip to content
Snippets Groups Projects

Set claude 2.1 as model for slash commands

Merged Jessie Young requested to merge jy-slash-commands-claude-3 into master
All threads resolved!

What does this MR do and why?

  • The ensure that all tools have a model set
  • Otherwise, they use the model default, which is Claude 3 sonnet if the user has a feature flag enabled. But these tools are still sending json request bodies for the completions API.
  • See code here for default model config
  • We eventually want to migrate these tools to Claude 3, but we want to support them staying on Claude 2.1 for now so we can selectively enroll users into Claude 3 without degrading behavior for existing customers.
  • Resolves #454849 (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.

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Before After
Screenshot_2024-04-09_at_3.05.45_PM Screenshot_2024-04-09_at_3.02.44_PM

How to set up and validate locally

  1. In rails console enable the experiment fully
    Feature.enable(:ai_claude_3_sonnet)
  2. Test the slash commands: /explain, /refactor, and /tests. All should work and be using Claude 2.1

Also good to ensure that all anthropic prompts have the model option set:

 git ls-files | grep anthropic.rb
ee/lib/api/ai/experimentation/anthropic.rb
ee/lib/code_suggestions/prompts/code_generation/anthropic.rb

ee/lib/gitlab/llm/chain/agents/zero_shot/prompts/anthropic.rb
ee/lib/gitlab/llm/chain/requests/anthropic.rb
ee/lib/gitlab/llm/chain/tools/ci_editor_assistant/prompts/anthropic.rb
ee/lib/gitlab/llm/chain/tools/epic_identifier/prompts/anthropic.rb
ee/lib/gitlab/llm/chain/tools/epic_reader/prompts/anthropic.rb
ee/lib/gitlab/llm/chain/tools/explain_code/prompts/anthropic.rb
ee/lib/gitlab/llm/chain/tools/issue_identifier/prompts/anthropic.rb
ee/lib/gitlab/llm/chain/tools/issue_reader/prompts/anthropic.rb
ee/lib/gitlab/llm/chain/tools/refactor_code/prompts/anthropic.rb
ee/lib/gitlab/llm/chain/tools/summarize_comments/prompts/anthropic.rb
ee/lib/gitlab/llm/chain/tools/write_tests/prompts/anthropic.rb

We can ignore the first 2 serach results because code suggestions doesn't use the AiGateway::Client and sets model headers here

Manual check for MODEL being set in all other tools:

  • ee/lib/gitlab/llm/chain/agents/zero_shot/prompts/anthropic.rb (this prompt works for claude 3 when feature flag enabled so no MODEL needed)
  • ee/lib/gitlab/llm/chain/requests/anthropic.rb (not a tool so not applicable)
  • ee/lib/gitlab/llm/chain/tools/ci_editor_assistant/prompts/anthropic.rb
  • ee/lib/gitlab/llm/chain/tools/epic_identifier/prompts/anthropic.rb
  • ee/lib/gitlab/llm/chain/tools/epic_reader/prompts/anthropic.rb
  • ee/lib/gitlab/llm/chain/tools/explain_code/prompts/anthropic.rb
  • ee/lib/gitlab/llm/chain/tools/issue_identifier/prompts/anthropic.rb
  • ee/lib/gitlab/llm/chain/tools/issue_reader/prompts/anthropic.rb
  • ee/lib/gitlab/llm/chain/tools/refactor_code/prompts/anthropic.rb
  • ee/lib/gitlab/llm/chain/tools/summarize_comments/prompts/anthropic.rb
  • ee/lib/gitlab/llm/chain/tools/write_tests/prompts/anthropic.rb
Edited by Jessie Young

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Jessie Young added 1 commit

    added 1 commit

    • a10b1a2d - Also set model for json reader

    Compare with previous version

  • requested review from @lesley-r

  • Jessie Young added 1 commit

    added 1 commit

    • 076f96a6 - Set claude 2.1 as model for slash commands

    Compare with previous version

  • Jessie Young added 209 commits

    added 209 commits

    Compare with previous version

  • Jessie Young changed the description

    changed the description

  • Jessie Young changed the description

    changed the description

  • Lesley Razzaghian
  • Lesley Razzaghian requested review from @mfanGitLab and removed review request for @lesley-r

    requested review from @mfanGitLab and removed review request for @lesley-r

  • mentioned in issue #455112 (closed)

  • Max Fan resolved all threads

    resolved all threads

  • Max Fan resolved all threads

    resolved all threads

  • Max Fan approved this merge request

    approved this merge request

  • Max Fan resolved all threads

    resolved all threads

  • Max Fan enabled an automatic merge when the pipeline for f528c42d succeeds

    enabled an automatic merge when the pipeline for f528c42d succeeds

  • Jessie Young resolved all threads

    resolved all threads

  • E2E Test Result Summary

    allure-report-publisher generated test report!

    e2e-test-on-gdk: :white_check_mark: test report for 7480a5d8

    expand test summary
    +------------------------------------------------------------------+
    |                          suites summary                          |
    +-------------+--------+--------+---------+-------+-------+--------+
    |             | passed | failed | skipped | flaky | total | result |
    +-------------+--------+--------+---------+-------+-------+--------+
    | Create      | 77     | 0      | 9       | 0     | 86    | ✅     |
    | Plan        | 51     | 0      | 2       | 0     | 53    | ✅     |
    | Package     | 24     | 0      | 6       | 0     | 30    | ✅     |
    | Verify      | 35     | 0      | 1       | 0     | 36    | ✅     |
    | Govern      | 66     | 0      | 0       | 0     | 66    | ✅     |
    | Data Stores | 31     | 0      | 0       | 0     | 31    | ✅     |
    | Release     | 5      | 0      | 0       | 0     | 5     | ✅     |
    | Monitor     | 7      | 0      | 0       | 0     | 7     | ✅     |
    | Manage      | 0      | 0      | 1       | 0     | 1     | ➖     |
    | Analytics   | 2      | 0      | 0       | 0     | 2     | ✅     |
    +-------------+--------+--------+---------+-------+-------+--------+
    | Total       | 298    | 0      | 19      | 0     | 317   | ✅     |
    +-------------+--------+--------+---------+-------+-------+--------+
  • merged

  • Max Fan mentioned in commit f39a6bc8

    mentioned in commit f39a6bc8

  • added workflowstaging label and removed workflowcanary label

  • mentioned in issue #454849 (closed)

  • Please register or sign in to reply
    Loading