Skip to content
Snippets Groups Projects

Add additional context to Duo Chat REST API

Merged Missy Davies requested to merge md-additional-context-duo-rest-api into master
1 file
+ 4
3
Compare changes
  • Side-by-side
  • Inline
+ 4
3
@@ -9,10 +9,10 @@ class Chat < ::API::Base
allow_access_with_scope :ai_features
AVAILABLE_RESOURCES = %w[issue epic group project merge_request].freeze
MAX_BODY_SIZE = ::API::CodeSuggestions::MAX_BODY_SIZE
MAX_CONTENT_SIZE = ::API::CodeSuggestions::MAX_CONTENT_SIZE
MAX_CONTEXT_NAME_SIZE = ::API::CodeSuggestions::MAX_CONTEXT_NAME_SIZE
CONTENT_TYPES = ::CodeSuggestions::Prompts::CodeGeneration::AnthropicMessages::CONTENT_TYPES.values
before do
authenticate!
@@ -44,9 +44,10 @@ def find_resource(parameters)
optional :client_subscription_id, type: String, limit: 500, desc: 'Client Subscription ID'
optional :with_clean_history, type: Boolean,
desc: 'Indicates if we need to reset the history before and after the request'
optional :additional_context, type: Array, allow_blank: false, desc: 'List of additional context to be passed for the chat' do
optional :additional_context, type: Array, allow_blank: false,
desc: 'List of additional context to be passed for the chat' do
requires :type, type: String,
values: ::CodeSuggestions::Prompts::CodeGeneration::AnthropicMessages::CONTENT_TYPES.values,
values: CONTENT_TYPES,
desc: 'Type of the additional context.'
requires :name, type: String, limit: MAX_CONTEXT_NAME_SIZE, allow_blank: false,
desc: 'Name of the additional context.'
Loading