-
Notifications
You must be signed in to change notification settings - Fork 85
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
feat: support channel-specific and category-specific system prompts #83
base: main
Are you sure you want to change the base?
feat: support channel-specific and category-specific system prompts #83
Conversation
Thanks for this! One weakness I see is with threads. If a user creates a thread within a channel, the channel prompt will no longer apply, which isn't ideal. I faced a similar issue with the Line 87 in 6b8fd1e
|
Ensure system prompts configured for a channel also apply to threads within that channel by checking the parent ID.
Ah, thank you for pointing that out! I just updated the PR to try to use the parent_id if the initial channel ID lookup doesn't work. I just tested it out in a thread and it looks like it works. |
New idea:
|
That would be a simpler config file. The risk of a collision between a channel ID and a category ID should be low given that part of the bits in these ID fields are timestamps. |
Replace system_prompt with system_prompts where first entry is the default prompt and additional entries are channel/category ID overrides. Maintain channel > category > default priority order.
d663374
to
7e2e4a2
Compare
Ok I made the update you suggested. |
Thanks!! I'm going to keep thinking about this for now. You've actually inspired some other changes that I want to make first. Namely, I want to make it so Also, I want to rename |
Sounds good - I'll use my fork in the mean time. I love this project - makes it so easy to deploy an LLM home server without worrying about securing ports at home and what not - keep up the great work! |
It would be a good idea if I imagine there is no risk of collision, but correct me if I'm wrong. |
That's an interesting idea. The priority ordering we were going for is more-specific to more-general. The hierarchy is clear for threads > channels > categories. The hierarchy is also clear for users > roles on their own. But the specificity ordering is less clear to me when we combine two hierarchies. If we do (users > roles > threads > channels > categories > default), then that means the user will be treated with the same user-specific system prompt everywhere in the server, even if you have thematically different channels. I think if the user is a bot that performs a specific function then I could see that being desirable, but if the user is a person, then that person can't participate in the themes set up in each channel, which is probably not desirable in most cases. Another option is to do (threads > channels > categories > users > roles > default) - however in that case, user-specific prompts will only apply in channels that don't have a custom channel/category-specific prompt. The latter prioritization makes sense to me for a user that is a person, but the former prioritization makes sense to me for a user that is a bot. There are probably other use cases I'm not thinking about. What do you think? Regarding collisions, my understanding is that there is no risk of collisions across any of these. It looks like Discord uses snowflake IDs that contain millisecond resolution timestamps as well as an increment. https://discord.com/developers/docs/reference#snowflakes |
Another idea is to have the channel-like and user-like hierarchies be separate and append both to the system prompt sent to the LLM when both are applicable e.g. include the channel-specific prompt and also append the user-specific prompt so that the LLM sees both. |
Adds "channel_prompts" and "category_prompts" fields to the config yaml file. These are keyed by discord channel IDs and category IDs and contain specific system prompts. The server will use the channel-specific system prompt if defined, otherwise the category-specific system prompt, otherwise the default general system prompt.