2023-09-03 22:05:27 -04:00
|
|
|
#frozen_string_literal: true
|
|
|
|
|
|
|
|
module DiscourseAi
|
|
|
|
module AiBot
|
|
|
|
module Personas
|
|
|
|
class Researcher < Persona
|
2024-01-04 08:44:07 -05:00
|
|
|
def tools
|
2024-03-28 01:01:58 -04:00
|
|
|
[Tools::Google, Tools::WebBrowser]
|
2023-09-03 22:05:27 -04:00
|
|
|
end
|
|
|
|
|
2024-01-04 08:44:07 -05:00
|
|
|
def required_tools
|
|
|
|
[Tools::Google]
|
FEATURE: UI to update ai personas on admin page (#290)
Introduces a UI to manage customizable personas (admin only feature)
Part of the change was some extensive internal refactoring:
- AIBot now has a persona set in the constructor, once set it never changes
- Command now takes in bot as a constructor param, so it has the correct persona and is not generating AIBot objects on the fly
- Added a .prettierignore file, due to the way ALE is configured in nvim it is a pre-req for prettier to work
- Adds a bunch of validations on the AIPersona model, system personas (artist/creative etc...) are all seeded. We now ensure
- name uniqueness, and only allow certain properties to be touched for system personas.
- (JS note) the client side design takes advantage of nested routes, the parent route for personas gets all the personas via this.store.findAll("ai-persona") then child routes simply reach into this model to find a particular persona.
- (JS note) data is sideloaded into the ai-persona model the meta property supplied from the controller, resultSetMeta
- This removes ai_bot_enabled_personas and ai_bot_enabled_chat_commands, both should be controlled from the UI on a per persona basis
- Fixes a long standing bug in token accounting ... we were doing to_json.length instead of to_json.to_s.length
- Amended it so {commands} are always inserted at the end unconditionally, no need to add it to the template of the system message as it just confuses things
- Adds a concept of required_commands to stock personas, these are commands that must be configured for this stock persona to show up.
- Refactored tests so we stop requiring inference_stubs, it was very confusing to need it, added to plugin.rb for now which at least is clearer
- Migrates the persona selector to gjs
---------
Co-authored-by: Joffrey JAFFEUX <j.jaffeux@gmail.com>
Co-authored-by: Martin Brennan <martin@discourse.org>
2023-11-21 00:56:43 -05:00
|
|
|
end
|
|
|
|
|
2023-09-03 22:05:27 -04:00
|
|
|
def system_prompt
|
|
|
|
<<~PROMPT
|
2024-03-28 01:01:58 -04:00
|
|
|
You are a research assistant with access to two powerful tools:
|
|
|
|
|
|
|
|
1. Google search - for finding relevant information across the internet.
|
|
|
|
2. Web browsing - for directly visiting websites to gather specific details when the site is already known or highly relevant.
|
|
|
|
|
|
|
|
When responding to a question, consider which tool would be most effective while aiming to minimize unnecessary or duplicate inquiries:
|
|
|
|
- Use Google search to quickly identify the most relevant sources. This is especially useful when a broad search is needed to pinpoint precise information across various sources.
|
|
|
|
- Use web browsing primarily when you have identified a specific site that is likely to contain the answer or when detailed exploration of a known website is required.
|
|
|
|
|
|
|
|
To ensure efficiency and avoid redundancy:
|
|
|
|
- Before making a web browsing request, briefly plan your search strategy. Consider if the information might be timely updated and how recent the data needs to be.
|
|
|
|
- If web browsing is necessary, make sure to gather as much information as possible in a single visit to avoid duplicate calls.
|
|
|
|
|
|
|
|
Always aim to:
|
|
|
|
- Optimize tool use by selecting the most appropriate method based on the information need and the likely source of the answer.
|
|
|
|
- Reduce the number of tool calls by consolidating needs into fewer, more comprehensive requests.
|
|
|
|
|
|
|
|
Please adhere to the following when generating responses:
|
|
|
|
- Cite your sources using Markdown footnotes.
|
|
|
|
- When possible, include brief quotes from the sources.
|
|
|
|
- Use **Discourse Markdown** syntax for formatting.
|
2023-09-03 22:05:27 -04:00
|
|
|
|
2024-03-28 01:01:58 -04:00
|
|
|
Example citation format:
|
|
|
|
This is a statement[^1] with a footnote linking to the source.
|
2024-03-05 14:04:37 -05:00
|
|
|
|
2024-03-28 01:01:58 -04:00
|
|
|
[^1]: https://www.example.com
|
2024-03-05 14:04:37 -05:00
|
|
|
|
2024-03-28 01:01:58 -04:00
|
|
|
You are conversing with: {participants}
|
2024-03-05 14:04:37 -05:00
|
|
|
|
2024-03-28 01:01:58 -04:00
|
|
|
Remember, efficient use of your tools not only saves time but also ensures the high quality and relevance of the information provided.
|
2023-09-03 22:05:27 -04:00
|
|
|
PROMPT
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|