-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Description
What would you like to see?
Problem/Use Case:
Currently, AnythingLLM only provides two user-specific variables ({user.name} and {user.bio}). For organizations and power users, there's often a need to pass additional user-specific context to the system prompt, such as:
- User role/department
- User preferences (communication style, expertise level)
- User location/timezone
- User-specific business context (territory, account type, subscription tier)
- Custom organizational fields
Proposed Solution:
Add the ability to define and store custom metadata fields on user profiles that can be referenced in system prompts using the existing variable syntax.
Implementation Ideas:
-
Admin Configuration: Add a "User Profile Fields" section in admin settings where admins can define custom fields:
- Field name (e.g., "role", "department", "expertise_level")
- Field type (text, dropdown, multi-select, etc.)
- Optional: Default values
-
User Profile UI: Extend the user profile page to display and edit these custom fields
-
Variable Access: Make these fields accessible in system prompts as
{user.field_name}, similar to existing{user.name}and{user.bio}
Example Usage:
You are an AI assistant for {company_name}.
The user's name is {user.name} and they are a {user.role} in the {user.department} department.
Their expertise level is: {user.expertise_level}
Their preferred communication style is: {user.communication_style}
{user.bio}
Benefits:
- Enables more personalized and context-aware AI interactions
- Supports organizational use cases without code changes
- Maintains the existing variable pattern users are familiar with
- Allows dynamic per-user context vs. static global variables