fix(captain): respect configured classifier model
This commit is contained in:
@@ -2,14 +2,12 @@ class Captain::Llm::AssistantActionClassifierService < Llm::BaseAiService
|
||||
include Integrations::LlmInstrumentation
|
||||
|
||||
PROMPT_VERSION = 'v1_custom_xml_precedence'.freeze
|
||||
DEFAULT_MODEL = 'gpt-4.1'.freeze
|
||||
MAX_CONTEXT_MESSAGES = 10
|
||||
|
||||
def initialize(assistant:, conversation:)
|
||||
super()
|
||||
@assistant = assistant
|
||||
@conversation = conversation
|
||||
@model = DEFAULT_MODEL
|
||||
@temperature = 0.0
|
||||
end
|
||||
|
||||
|
||||
@@ -67,6 +67,17 @@ RSpec.describe Captain::Llm::AssistantActionClassifierService do
|
||||
)
|
||||
end
|
||||
|
||||
it 'uses the configured Captain model from the base LLM service' do
|
||||
create(:installation_config, name: 'CAPTAIN_OPEN_AI_MODEL', value: 'provider/custom-model')
|
||||
|
||||
expect(RubyLLM).to receive(:chat).with(model: 'provider/custom-model').and_return(mock_chat)
|
||||
allow(mock_chat).to receive(:ask).and_return(mock_response)
|
||||
|
||||
result = service.classify(message_history: message_history, assistant_response: 'Would you like to talk to support?')
|
||||
|
||||
expect(result).to include('model' => 'provider/custom-model')
|
||||
end
|
||||
|
||||
context 'when the assistant has no custom instructions' do
|
||||
before do
|
||||
assistant.update!(config: assistant.config.except('instructions'))
|
||||
|
||||
Reference in New Issue
Block a user