Shadai Client API Reference
Complete reference for the main Shadai client class.Class: Shadai#
Main entry point for interacting with Shadai services.Constructor#
| Parameter | Type | Default | Description |
|---|
name | str | None | Session name (required if not temporal) |
temporal | bool | False | Create temporary session (auto-deleted) |
api_key | str | None | API key (reads from env if not provided) |
base_url | str | "http://localhost" | Shadai server URL |
timeout | int | 30 | Request timeout in seconds |
Methods#
ingest()#
Ingest documents from a folder into the session.folder_path (str): Path to folder containing documents
query()#
Query the knowledge base.query (str): Question to ask
use_memory (bool): Enable conversation memory (default: True)
Returns: Async iterator of response chunkssummarize()#
Generate summary of all documents.use_memory (bool): Enable conversation memory (default: True)
Returns: Async iterator of summary chunksweb_search()#
Search the web for information.prompt (str): Search query
use_web_search (bool): Enable web search (default: True)
use_memory (bool): Enable conversation memory (default: True)
Returns: Async iterator of response chunksengine()#
Multi-tool orchestration.prompt (str): Query or task
use_knowledge_base (bool): Query documents (default: False)
use_summary (bool): Include summary (default: False)
use_web_search (bool): Search web (default: False)
use_memory (bool): Enable memory (default: True)
Returns: Async iterator of response chunksagent()#
Execute custom tool workflow.prompt (str): Task description
tools (List[Callable]): List of custom tools
Returns: Async iterator of response chunksget_session_history()#
Retrieve conversation history.page (int): Page number (default: 1)
page_size (int): Messages per page (default: 5, max: 10)
clear_session_history()#
Clear all conversation history.Context Manager#
Shadai supports async context manager protocol:Next Steps#
Modified at 2025-10-17 17:46:10