Skip to content

[FEAT]: User Profile Custom Metadata Fields #4677

@troylar

Description

@troylar

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:

  1. 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
  2. User Profile UI: Extend the user profile page to display and edit these custom fields

  3. 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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions