Chat Flags (🧪Beta)
albert.collections.chat_flags.ChatFlagCollection
Async collection for managing flags on chat messages (🧪Beta).
Beta Feature!
Please do not use in production or without explicit guidance from Albert. You might otherwise have a bad experience. This feature currently falls outside of the Albert support contract, but we'd love your feedback!
Flags allow users to mark messages as starred, downloaded, requested, or hallucinated.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session
|
AsyncAlbertSession
|
The Albert async session instance. |
required |
Methods:
| Name | Description |
|---|---|
get_all |
Lists all flagged messages of a given flag type. |
get_by_message |
Retrieves all flags set on a specific message. |
add |
Adds a flag to a message. |
remove |
Removes a flag from a message. |
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session
|
AsyncAlbertSession
|
The async session used to make API requests. |
required |
Source code in src/albert/collections/chat_flags.py
get_all
get_all(*, type: ChatFlagType) -> list[ChatFlag]
List all flagged messages of a given type.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
type
|
ChatFlagType
|
The type of flag to filter by. |
required |
Returns:
| Type | Description |
|---|---|
list[ChatFlag]
|
Flagged messages matching the given type. |
Source code in src/albert/collections/chat_flags.py
get_by_message
get_by_message(
*,
session_id: str,
source_request_id: str,
sequence: str | None = None,
) -> ChatFlagsInMessage
Retrieve all flags set on a specific message.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session_id
|
str
|
The ID of the parent session. |
required |
source_request_id
|
str
|
The request trace identifier of the message. |
required |
sequence
|
str | None
|
The zero-padded sequence of the message. |
None
|
Returns:
| Type | Description |
|---|---|
ChatFlagsInMessage
|
The flags set on the message. |
Source code in src/albert/collections/chat_flags.py
add
add(
*,
session_id: str,
source_request_id: str,
sequence: str,
type: ChatFlagType,
component_type: ChatComponentType | None = None,
) -> ChatFlag
Add a flag to a message.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session_id
|
str
|
The ID of the parent session. |
required |
source_request_id
|
str
|
The request trace identifier of the message. |
required |
sequence
|
str
|
The zero-padded sequence of the message. |
required |
type
|
ChatFlagType
|
The type of flag to add. |
required |
component_type
|
ChatComponentType | None
|
Narrows the flag to a specific component type. |
None
|
Returns:
| Type | Description |
|---|---|
ChatFlag
|
The created flag. |
Source code in src/albert/collections/chat_flags.py
remove
remove(
*,
session_id: str,
source_request_id: str,
sequence: str,
type: ChatFlagType,
component_type: ChatComponentType | None = None,
) -> None
Remove a flag from a message.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session_id
|
str
|
The ID of the parent session. |
required |
source_request_id
|
str
|
The request trace identifier of the message. |
required |
sequence
|
str
|
The zero-padded sequence of the message. |
required |
type
|
ChatFlagType
|
The type of flag to remove. |
required |
component_type
|
ChatComponentType | None
|
Narrows the removal to a specific component type. |
None
|
Returns:
| Type | Description |
|---|---|
None
|
|