Documentation

ChatResource

Access via client.chats

session()

Create a chat session context manager for automatic lifecycle management

python
def session(
*,
title: Optional[str] = None,
image_ids: Optional[list[str]] = None,
use_all_images: bool = True,
auto_close: bool = True,
) -> ChatSessionContext
Returns: ChatSessionContext - Context manager for use with 'async with'

send()

Send a message and get a complete response

python
async def send(
message: str,
*,
session_id: str,
force_detailed_analysis: bool = False,
expected_image_ids: Optional[list[str]] = None,
) -> ChatResponse

send_stream()

Send a message and stream response tokens as they arrive

python
async def send_stream(
message: str,
*,
session_id: str,
force_detailed_analysis: bool = False,
expected_image_ids: Optional[list[str]] = None,
debug_reasoning: bool = False,
) -> AsyncIterator[ChatToken]
Yields: ChatToken objects with type, content, and data

create_session()

Create a new chat session

python
async def create_session(
*,
title: Optional[str] = None,
image_ids: Optional[list[str]] = None,
use_all_images: bool = True,
) -> ChatSession

get_session()

Get session details with message history

python
async def get_session(
session_id: str,
*,
include_messages: bool = True,
message_limit: Optional[int] = None,
) -> ChatSessionDetail

list_sessions()

List user's chat sessions

python
async def list_sessions(
*,
limit: int = 20,
offset: int = 0,
active_only: bool = False,
) -> SessionList

iter_sessions()

Auto-paginating async iterator over all chat sessions

python
async def iter_sessions(
*,
page_size: int = 20,
active_only: bool = False,
) -> AsyncIterator[ChatSession]
Yields: ChatSession objects one at a time

get_messages()

Get messages from a chat session

python
async def get_messages(
session_id: str,
*,
limit: Optional[int] = None,
) -> list[ChatMessage]
Returns: list[ChatMessage]

update_images()

Update images for a chat session

python
async def update_images(
session_id: str,
image_ids: list[str],
) -> dict[str, Any]

close_session()

Close a chat session

python
async def close_session(session_id: str) -> dict[str, Any]

update_documents()

Update selected documents for session context

python
async def update_documents(
session_id: str,
document_ids: list[str],
) -> dict[str, Any]

update_videos()

Replace the set of videos available to the VideoAnalysisAgent for the session (max 100)

python
async def update_videos(
session_id: str,
video_ids: list[str],
) -> dict[str, Any]

update_mode()

Switch between all images and selected images mode

python
async def update_mode(
session_id: str,
use_all_images: bool,
) -> dict[str, Any]

update_domain()

Set the knowledge domain for a session to guide agent behavior

python
async def update_domain(
session_id: str,
domain: str,
) -> dict[str, Any]

rename_session()

Rename a chat session

python
async def rename_session(
session_id: str,
title: str,
) -> dict[str, Any]

export_session()

Export chat session in specified format

python
async def export_session(
session_id: str,
*,
format: str = "markdown",
include_metadata: bool = False,
) -> bytes

get_all_images()

Get all user images available for chat context

python
async def get_all_images(
*,
limit: int = 1000,
offset: int = 0,
) -> ChatImageList
Returns: ChatImageList with images and pagination info

search_images()

Search images available for chat context

python
async def search_images(
query: str,
*,
limit: int = 50,
offset: int = 0,
) -> list[ImageReference]