Compare commits

...
Author SHA1 Message Date
Tanmay Deep Sharma 040584fc68 optimise the label query by using cached_label_list instead of joins 2025-10-07 10:58:57 +02:00
829142c808 fix: Update max_turns config (#12604)
Pass max_turns in the run config than during the initialization.

---------

Co-authored-by: Shivam Mishra <scm.mymail@gmail.com>
2025-10-07 11:21:18 +05:30
4 changed files with 5 additions and 4 deletions
+2 -1
View File
@@ -156,7 +156,8 @@ class ConversationFinder
def filter_by_labels
return unless params[:labels]
@conversations = @conversations.tagged_with(params[:labels], any: true)
pattern = params[:labels].map { |label| Regexp.escape(label) }.join('|')
@conversations = @conversations.where('cached_label_list ~ ?', "\\y(#{pattern})\\y")
end
def filter_by_source_id
-1
View File
@@ -15,7 +15,6 @@ Rails.application.config.after_initialize do
config.openai_api_base = api_base
end
config.default_model = model
config.max_turns = 30
config.debug = false
end
end
@@ -23,7 +23,7 @@ class Captain::Assistant::AgentRunnerService
message_to_process = extract_last_user_message(message_history)
runner = Agents::Runner.with_agents(*agents)
runner = add_callbacks_to_runner(runner) if @callbacks.any?
result = runner.run(message_to_process, context: context)
result = runner.run(message_to_process, context: context, max_turns: 100)
process_agent_result(result)
rescue StandardError => e
@@ -90,7 +90,8 @@ RSpec.describe Captain::Assistant::AgentRunnerService do
expect(mock_runner).to receive(:run).with(
'I need help with my account',
context: expected_context
context: expected_context,
max_turns: 100
)
service.generate_response(message_history: message_history)