Backend for configuring a self-hosted model per Duo tool / sub-feature
Overview
In Configuration of Declared Models to Duo Feature... (#469612 - closed) we consider configuring a self-hosted model per Duo Chat tool. We need to prepare the backend to send specific self-hosted model metadata for a specific tool or Duo sub-feature.
(note: tool is the terminology specifically used for Duo Chat sub-features, but work on this issue will support both Duo Chat sub-features (aka tools) and other Duo sub-features (such as Code Generation and Code Completion for Code Suggestions)
Proposal
- List of tools: #469612 (comment 2002997874)
- Extend the list of features in
AiFeatureto contain tools:
enum feature: {
code_generations: 0,
code_completions: 1,
duo_chat: 2,
duo_chat_issue_reader: 3,
...
duo_chat_explain_code: n,
...
}
The enum in AiFeature is flat while Configuration of Declared Models to Duo Feature... (#469612 - closed) investigates grouping features into sections: for example, Code Suggestions is a section or a Feature while Code Completion and Code Generation are its sub-features.
- Then we could use the setting to fetch self-hosted model info:
def chat_feature_setting(unit_primitive: nil)
feature_name = unit_primitive ? "duo_chat_#{unit_primitive}" : :duo_chat
::Ai::FeatureSetting.find_by_feature(:duo_chat)
end
- In order to do that, we need to distinguish between tools and
unit_primitivevariable would be useful. However, it's not propagated properly and isnilat the moment and if it would, a bit different endpoint would be used. Propagating the unit primitive is a blocker to implementing this issue but can be done within this issue. It can be either aligned with groupai framework and groupduo chat (comment) or we could add a condition: if the feature is not self-hosted - nullify the unit-primitive, i.e use the value only for self-hosted features.
Note
If it's implemented alone, the UI/UX will be the following until it's reworked Configuration of Declared Models to Duo Feature... (#469612 - closed)
