Profile Management
Methods for searching, retrieving, and deleting user profiles, plus profile changelog.
search_profiles is a deprecated compatibility alias for search_user_profiles. New integrations should use search_user_profiles; the alias emits DeprecationWarning and will be removed in a future release.search_user_profilesmethodSearch for user profiles using semantic queries.
response = client.search_user_profiles( user_id="user_123", query="laptop preferences", tags=["hardware"], threshold=0.7, top_k=5)| Prop | Type |
|---|---|
user_idrequired | string |
generated_from_request_id | string |
query | string |
start_time | datetime |
end_time | datetime |
top_k | integer |
source | string |
custom_feature | string |
extractor_name | string |
tags | string[] |
threshold | float |
enable_reformulation | boolean |
search_mode | SearchMode |
Returns SearchUserProfileResponse — see Profile Models.
rerank_user_profilesmethodRerank a list of candidate profile IDs by query relevance using a cross-encoder. Use after search_user_profiles (or any other source of candidate IDs) when initial results are noisy. The server fetches each candidate's full content (scoped to user_id), scores (query, content) pairs, and returns the top_k profiles sorted by descending score. IDs that don't resolve for the user are silently dropped.
response = client.rerank_user_profiles( user_id="user_123", query="laptop preferences", profile_ids=["prof_1", "prof_2", "prof_3"], top_k=5,)| Prop | Type |
|---|---|
user_idrequired | string |
queryrequired | string |
profile_idsrequired | list[string] |
top_k | integer |
Returns: SearchProfilesViewResponse with success, user_profiles (sorted by descending cross-encoder score, capped at top_k), and msg.
storage_statsmethodGet a lightweight count of how many profiles and playbooks a user has, plus the modified-time range across every status. Useful for sizing top_k before retrieval.
stats = client.storage_stats(user_id="user_123")print(stats.profile_count, stats.playbook_count)| Prop | Type |
|---|---|
user_idrequired | string |
Returns StorageStatsResponse.
get_profilesmethodRetrieve user profiles.
response = client.get_profiles( user_id="user_123", tags=["hardware"], top_k=10)| Prop | Type |
|---|---|
user_idrequired | string |
profile_id | string |
query | string |
start_time | datetime |
end_time | datetime |
top_k | integer |
source | string |
profile_time_to_live | string |
status_filter | list[Status | string] |
tags | string[] |
force_refresh | boolean |
Returns GetUserProfilesResponse — see Profile Models. Cached for 10 minutes; pass force_refresh=True to bypass.
get_all_profilesmethodGet profiles across all users (admin operation).
response = client.get_all_profiles(limit=100)| Prop | Type |
|---|---|
limit | integer |
status_filter | string |
user_id | string |
profile_id | string |
query | string |
source | string |
profile_time_to_live | string |
start_time | integer |
end_time | integer |
Returns: GetUserProfilesResponse with profiles from all users.
Example
# Get profiles from all usersall_profiles = client.get_all_profiles(limit=50) # Group by userfrom collections import defaultdictby_user = defaultdict(list) for profile in all_profiles.user_profiles: by_user[profile.user_id].append(profile) for user_id, profiles in by_user.items(): print(f"User {user_id}: {len(profiles)} profiles") for p in profiles[:3]: # Show first 3 print(f" - {p.content[:50]}...")add_user_profilemethodAdd user profiles directly to storage, bypassing the inference pipeline. Useful for seeding known facts (testing, migration, manual injection). The server populates the embedding automatically.
response = client.add_user_profile( user_profiles=[ {"user_id": "user_123", "content": "Prefers concise responses"}, ])| Prop | Type |
|---|---|
user_profilesrequired | list[UserProfile | dict] |
Returns AddUserProfileResponse — see Profile Models.
delete_profilemethodDelete user profiles by ID or search query.
response = client.delete_profile( user_id, profile_id="", search_query="", wait_for_response=False)| Prop | Type |
|---|---|
user_idrequired | string |
profile_id | string |
search_query | string |
wait_for_response | boolean |
Returns DeleteUserProfileResponse — see Profile Models.
get_profile_change_logmethodRetrieve the history of profile changes.
logs = client.get_profile_change_log()Returns ProfileChangeLogResponse containing ProfileChangeLog entries — see Profile Models.
Bulk Delete Operations
delete_profiles_by_idsmethodDelete multiple profiles by their IDs.
response = client.delete_profiles_by_ids(profile_ids=["prof_1", "prof_2"])| Prop | Type |
|---|---|
profile_idsrequired | list[string] |
Returns: BulkDeleteResponse with success, deleted_count, and message.
delete_all_profilesmethodDelete all profiles.
response = client.delete_all_profiles()Returns: BulkDeleteResponse with success, deleted_count, and message.