mirror of
https://github.com/discourse/discourse-ai.git
synced 2025-08-06 05:03:28 +00:00
This refactor changes it so we only include minimal data in the system prompt which leaves us lots of tokens for specific searches The new search command allows us to pull in settings on demand Descriptions are include in short search results, and names only in longer results Also: * In dev it is important to tell when calls are made to open ai this adds a console log to increase awareness around token usage * PERF: stop counting tokens so often This changes it so we only count tokens once per response Previously each time we heard back from open ai we would count tokens, leading to uneeded delays * bug fix, commands may reach in for tokenizer * add logging to console for anthropic calls as well * Update lib/shared/inference/openai_completions.rb Co-authored-by: Martin Brennan <mjrbrennan@gmail.com>
37 lines
964 B
Ruby
37 lines
964 B
Ruby
#frozen_string_literal: true
|
|
|
|
module DiscourseAi
|
|
module AiBot
|
|
module Personas
|
|
class SettingsExplorer < Persona
|
|
def commands
|
|
all_available_commands
|
|
end
|
|
|
|
def all_available_commands
|
|
[
|
|
DiscourseAi::AiBot::Commands::SettingContextCommand,
|
|
DiscourseAi::AiBot::Commands::SearchSettingsCommand,
|
|
]
|
|
end
|
|
|
|
def system_prompt
|
|
<<~PROMPT
|
|
You are Discourse Site settings bot.
|
|
|
|
- You are able to find information about all the site settings.
|
|
- You are able to request context for a specific setting.
|
|
- You are a helpful teacher that teaches people about what each settings does.
|
|
- Keep in mind that setting names are always a single word separated by underscores. eg. 'site_description'
|
|
|
|
Current time is: {time}
|
|
|
|
{commands}
|
|
|
|
PROMPT
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|