Skip to content

API Reference parrot.stores.kb.user

github-actions[bot] edited this page Dec 2, 2026 · 4 revisions

parrot.stores.kb.user

View source

Alias AbstractKnowledgeBase

Re-exported from parrot.stores.kb.abstract.AbstractKnowledgeBase.

Alias RedisKnowledgeBase

Re-exported from parrot.stores.kb.redis.RedisKnowledgeBase.

Alias RequestContext

Re-exported from parrot.utils.helpers.RequestContext.

Class SessionStateKB

KB that retrieves from session state.

Parameter Type Default Description
**kwargs {}

Method SessionStateKB.search

Extract relevant session state.

search(query: str, ctx: RequestContext = None, **kwargs) -> List[Dict]

Parameter Type Default Description
query str
ctx RequestContext None
**kwargs {}

Returns: List[Dict]

Alias TTLCache

Re-exported from parrot.stores.kb.cache.TTLCache.

Class UserInfo

Class to manage user information.

.. deprecated-note:: FEAT-406 introduces parrot.auth.userinfo.UserInfoService as the preferred structured source of curated user attributes (feeds PBAC policy evaluation and UserinfoTool's JSON output). This KB remains unchanged and fully supported for its existing purpose — flattening auth.vw_users into prose "facts" injected into <userdata> for the system prompt. The two coexist by design; this is a documentation note only, no behavioral change.

Parameter Type Default Description
**kwargs {}

Method UserInfo.should_activate

should_activate(query: str, context: dict) -> Tuple[bool, float]

Parameter Type Default Description
query str
context dict

Returns: Tuple[bool, float]

Method UserInfo.search

Query Database for User Information.

search(query: str, user_id: int, **kwargs) -> List[Dict]

Parameter Type Default Description
query str
user_id int
**kwargs {}

Returns: List[Dict]

Class UserPreferences

KB for user preferences stored in Redis.

Parameter Type Default Description
**kwargs Any {}

Method UserPreferences.search

Retrieve user preferences matching the query.

search(query: str, user_id: Optional[str] = None, **kwargs) -> List[Dict[str, Any]]

Parameter Type Default Description
query str Search query
user_id Optional[str] None User identifier (required)
**kwargs {} Additional parameters

Returns: List[Dict[str, Any]] — List of preference facts

Method UserPreferences.set_preference

Set a single user preference.

set_preference(user_id: str, preference: str, value: Any) -> bool

Parameter Type Default Description
user_id str User identifier
preference str Preference name
value Any Preference value

Returns: bool — True if successful

Method UserPreferences.get_preference

Get a single user preference.

get_preference(user_id: str, preference: str, default: Any = None) -> Any

Parameter Type Default Description
user_id str User identifier
preference str Preference name
default Any None Default value if not found

Returns: Any — Preference value or default

Method UserPreferences.delete_preference

Delete a single user preference.

delete_preference(user_id: str, preference: str) -> bool

Parameter Type Default Description
user_id str User identifier
preference str Preference name

Returns: bool — True if successful

Method UserPreferences.get_all_preferences

Get all preferences for a user.

get_all_preferences(user_id: str) -> Dict[str, Any]

Parameter Type Default Description
user_id str User identifier

Returns: Dict[str, Any] — Dict of all preferences

Method UserPreferences.clear_all_preferences

Clear all preferences for a user.

clear_all_preferences(user_id: str) -> bool

Parameter Type Default Description
user_id str User identifier

Returns: bool — True if successful

Method UserPreferences.update_preferences

Update multiple preferences at once.

update_preferences(user_id: str, preferences: Dict[str, Any]) -> bool

Parameter Type Default Description
user_id str User identifier
preferences Dict[str, Any] Dictionary of preferences to update

Returns: bool — True if successful

Method UserPreferences.has_preference

Check if a user has a specific preference set.

has_preference(user_id: str, preference: str) -> bool

Parameter Type Default Description
user_id str User identifier
preference str Preference name

Returns: bool — True if preference exists

Method UserPreferences.list_user_preference_keys

Get list of all preference keys for a user.

list_user_preference_keys(user_id: str) -> List[str]

Parameter Type Default Description
user_id str User identifier

Returns: List[str] — List of preference keys

Class UserProfileKB

KB that queries database for user information.

.. deprecated-note:: FEAT-406 introduces parrot.auth.userinfo.UserInfoService as the preferred structured source of curated user attributes (feeds PBAC policy evaluation and UserinfoTool's JSON output). This KB remains unchanged and fully supported for its existing purpose — flattening auth.vw_users into prose "facts" for the system prompt. The two coexist by design; this is a documentation note only, no behavioral change.

Parameter Type Default Description
**kwargs {}

Method UserProfileKB.should_activate

Check if query references user-specific information.

should_activate(query: str, context: Dict) -> Tuple[bool, float]

Parameter Type Default Description
query str
context Dict

Returns: Tuple[bool, float]

Method UserProfileKB.search

Query database for user information.

search(query: str, user_id: str = None, **kwargs) -> List[Dict]

Parameter Type Default Description
query str
user_id str None
**kwargs {}

Returns: List[Dict]

Alias lazy_import

Re-exported from parrot._imports.lazy_import.

Architecture

Clients

Bots & Agents

Memory

Knowledge

Tools & Toolkits

Flows

Experts

Skills

Stores & Loaders

MCP & A2A

Server & APIs

Integrations

Outputs & A2UI

Prompts

Security

Operations

Migration

SDD Tooling

LLM Wiki

Deployment

Decisions

API Reference

Clone this wiki locally