Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DEV: Rewire AI bot internals to use LlmModel #638

Merged
merged 6 commits into from
Jun 18, 2024

Conversation

romanrizzi
Copy link
Member

@romanrizzi romanrizzi commented May 23, 2024

The AI bot has one user per model, and IDs are hardcoded in the code. As a part of our migration to source LLMs from the database, we now dynamically create/delete them and store the ID in the llm_models table, meaning we no longer rely on a specific ID to identify what model a bot user proxies.

This change adds three data migrations to seed models from model credentials/URLs available in site settings while reusing the bot user if it exists.

As a bonus, you can also define custom usernames for your bots by editing the companion username field in the LLM config:

Screenshot 2024-06-13 at 4 20 38 PM

The ai_enabled_chat_bots is still fixed and needs code changes to support new models. We need core to provide a hybrid between list and enum type settings, dynamically displaying models from the database.

In the meantime, I added validation to ensure each bot in this setting has a matching DB LLM:

Screenshot 2024-06-13 at 4 19 13 PM

Following this change, we can deprecate the site settings and rely directly on the llm_models table.

@romanrizzi romanrizzi force-pushed the rewire_ai_bot_llm_to_user branch 2 times, most recently from 1f66c8a to 5d546a3 Compare June 13, 2024 19:05
@romanrizzi romanrizzi changed the title DRAFT: Create AI Bot users dynamically and support custom LlmModels DEV: Rewire AI bot internals to use LlmModel Jun 13, 2024
@romanrizzi romanrizzi marked this pull request as ready for review June 13, 2024 19:22
config/locales/client.en.yml Outdated Show resolved Hide resolved
config/settings.yml Outdated Show resolved Hide resolved
@romanrizzi romanrizzi force-pushed the rewire_ai_bot_llm_to_user branch 3 times, most recently from 2125ab9 to a38a3af Compare June 17, 2024 15:25
Copy link
Contributor

@pmusaraj pmusaraj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

config/settings.yml Outdated Show resolved Hide resolved
app/models/llm_model.rb Outdated Show resolved Hide resolved
@romanrizzi romanrizzi merged commit 8d5f901 into main Jun 18, 2024
5 checks passed
@romanrizzi romanrizzi deleted the rewire_ai_bot_llm_to_user branch June 18, 2024 17:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
4 participants