Logo IconGuided Mind
v2.4Sign In
Python SDK

API Reference

Complete method signatures and return types for all Python SDK clients.

Client

The root client. All sub-clients are accessed as attributes.

from guidedmind import Client
 
client = Client(
    api_key: str | None = None,
    base_url: str = "https://api.guidedmind.ai",
    timeout: float = 30.0,
    max_retries: int = 3,
)

client.search()

ParameterTypeDefaultDescription
queryrequiredstrNatural language search query.
limitint5Maximum results to return.
thresholdfloat0.70Minimum relevance score (0–1).
search_methodSearchMethodHYBRIDSearch algorithm. See SearchMethod enum below.
include_metadataboolFalseInclude source metadata on each result.

Returns SearchResponse

client.asearch()

Async version of search(). Same parameters, returns Awaitable[SearchResponse].

client.close() / client.aclose()

Close the underlying HTTP connection pool. Called automatically when using the client as a context manager.


client.documents

upload()

ParameterTypeDefaultDescription
file_pathrequiredstrPath to the file on disk.
metadatadict | NoneNoneKey-value metadata attached to every chunk from this document.

Returns UploadResponse{ document_id: str, status: str }

upload_and_process()

Same parameters as upload().

Returns ProcessResponse{ document_id: str, chunks_created: int, status: str }

aupload() / aupload_and_process()

Async versions. Same parameters, return Awaitable[UploadResponse | ProcessResponse].


client.memory.short

add_record()

ParameterTypeDefaultDescription
session_idrequiredstrUnique conversation session identifier.
rolerequiredstr"user" or "assistant".
contentrequiredstrMessage text.

Returns MemoryRecord{ id: str, session_id: str, role: str, content: str, created_at: datetime }

get_records()

ParameterTypeDefaultDescription
session_idrequiredstrSession to retrieve records for.

Returns RecordList{ records: list[MemoryRecord], total: int }

aadd_record() / aget_records()

Async versions. Same parameters.


client.memory.long

store_record()

ParameterTypeDefaultDescription
user_idrequiredstrUnique identifier for the user.
rolerequiredstr"user" or "assistant".
contentrequiredstrMessage text to persist.

Returns MemoryRecord

ParameterTypeDefaultDescription
queryrequiredstrSemantic search query.
limitint10Maximum results to return.
thresholdfloat0.70Minimum relevance score.

Returns SearchResponse — same shape as client.search()

astore_record() / asearch()

Async versions. Same parameters.


SearchMethod Enum

from guidedmind import SearchMethod
 
SearchMethod.DENSE   # Vector-based semantic search
SearchMethod.SPARSE  # Keyword BM25 search
SearchMethod.HYBRID  # Combined dense + sparse (recommended default)
SearchMethod.GRAPH   # Knowledge graph traversal

Exceptions

ExceptionHTTPDescription
AuthenticationError401, 403Invalid or expired API key
RateLimitError429Rate limit exceeded after all retries
NotFoundError404Resource not found
ValidationError422Invalid request parameters
APIError4xx / 5xxAll other API errors — check e.status_code
ConfigurationErrorBad client config (e.g. HTTP base URL, missing key)
GuidedMindErrorBase class for all SDK exceptions

Type Definitions

# Key return types — all are Pydantic v2 models
from guidedmind.types import (
    SearchResponse,   # .results: list[SearchResult], .metadata: SearchMetadata
    SearchResult,     # .content, .score, .document_id, .chunk_index, .metadata
    SearchMetadata,   # .search_method_used, .processing_time_ms, .total_results
    UploadResponse,   # .document_id, .status
    ProcessResponse,  # .document_id, .chunks_created, .status
    MemoryRecord,     # .id, .session_id | .user_id, .role, .content, .created_at
    RecordList,       # .records: list[MemoryRecord], .total: int
)