Documentation Index
Fetch the complete documentation index at: https://www.getmaxim.ai/docs/llms.txt
Use this file to discover all available pages before exploring further.
View module source on GitHub
Manages HTTP session pooling for efficient network requests.
This class provides a reusable session with retry logic
for handling transient network errors.
__init__
Initialize a new session with retry configuration.
get_session
@contextlib.contextmanager
def get_session()
Context manager that yields the session and ensures it’s closed after use.
Yields:
requests.Session - The HTTP session object
Client for interacting with the Maxim API.
This class provides methods for all available Maxim API endpoints,
handling authentication, request formatting, and error handling.
__init__
def __init__(base_url: str, api_key: str)
Initialize a new Maxim API client.
Arguments:
| Name | Description |
|---|
base_url | The base URL for the Maxim API |
api_key | The API key for authentication |
get_prompt
def get_prompt(id: str) -> VersionAndRulesWithPromptId
Get a prompt by ID.
Arguments:
| Name | Description |
|---|
id | The prompt ID |
Returns:
| Name | Description |
|---|
[VersionAndRulesWithPromptId](/sdk/python/references/models/prompt) | The prompt details |
Raises:
Exception - If the request fails
get_prompts
def get_prompts() -> List[VersionAndRulesWithPromptId]
Get all prompts.
Returns:
| Name | Description |
|---|
List[[VersionAndRulesWithPromptId](/sdk/python/references/models/prompt)] | List of all prompts |
Raises:
Exception - If the request fails
getPromptChain
def getPromptChain(id: str) -> VersionAndRulesWithPromptChainId
Get a prompt chain by ID.
Arguments:
| Name | Description |
|---|
id | The prompt chain ID |
Returns:
| Name | Description |
|---|
[VersionAndRulesWithPromptChainId](/sdk/python/references/models/prompt_chain) | The prompt chain details |
Raises:
Exception - If the request fails
get_prompt_chains
def get_prompt_chains() -> List[VersionAndRulesWithPromptChainId]
Get all prompt chains.
Returns:
| Name | Description |
|---|
List[[VersionAndRulesWithPromptChainId](/sdk/python/references/models/prompt_chain)] | List of all prompt chains |
Raises:
Exception - If the request fails
run_prompt
def run_prompt(model: str,
messages: List[ChatCompletionMessage],
tools: Optional[List[Tool]] = None,
**kwargs)
Run a custom prompt with the specified model and messages.
Arguments:
| Name | Description |
|---|
model | The model to use |
messages | List of chat messages |
tools | Optional list of tools to use |
**kwargs | Additional parameters to pass to the API |
Returns:
| Name | Description |
|---|
[PromptResponse](/sdk/python/references/models/prompt) | The response from the model |
Raises:
Exception - If the request fails
run_prompt_version
def run_prompt_version(
prompt_version_id: str, input: str,
image_urls: Optional[List[ImageUrls]],
variables: Optional[dict[str, str]]) -> Optional[PromptResponse]
Run a specific prompt version with the given input.
Arguments:
| Name | Description |
|---|
prompt_version_id | The ID of the prompt version to run |
input | The input text for the prompt |
image_urls | Optional list of image URLs to include |
variables | Optional dictionary of variables to use |
Returns:
| Name | Description |
|---|
Optional[[PromptResponse](/sdk/python/references/models/prompt)] | The response from the prompt |
Raises:
Exception - If the request fails
run_prompt_chain_version
def run_prompt_chain_version(
prompt_chain_version_id: str, input: str,
variables: Optional[dict[str, str]]) -> Optional[AgentResponse]
Run a specific prompt chain version with the given input.
Arguments:
| Name | Description |
|---|
prompt_chain_version_id | The ID of the prompt chain version to run |
input | The input text for the prompt chain |
variables | Optional dictionary of variables to use |
Returns:
| Name | Description |
|---|
Optional[[AgentResponse](/sdk/python/references/models/prompt_chain)] | The response from the prompt chain |
Raises:
Exception - If the request fails
get_folder
def get_folder(id: str) -> Folder
Get a folder by ID.
Arguments:
| Name | Description |
|---|
id | The folder ID |
Returns:
| Name | Description |
|---|
[Folder](/sdk/python/references/models/folder) | The folder details |
Raises:
Exception - If the request fails
get_folders
def get_folders() -> List[Folder]
Get all folders.
Returns:
| Name | Description |
|---|
List[[Folder](/sdk/python/references/models/folder)] | List of all folders |
Raises:
Exception - If the request fails
add_dataset_entries
def add_dataset_entries(dataset_id: str,
dataset_entries: List[DatasetEntry]) -> dict[str, Any]
Add entries to a dataset.
Arguments:
| Name | Description |
|---|
dataset_id | The ID of the dataset |
dataset_entries | List of dataset entries to add |
Returns:
dict[str, Any]: Response from the API
Raises:
Exception - If the request fails
get_dataset_total_rows
def get_dataset_total_rows(dataset_id: str) -> int
Get the total number of rows in a dataset.
Arguments:
| Name | Description |
|---|
dataset_id | The ID of the dataset |
Returns:
| Name | Description |
|---|
int | The total number of rows |
Raises:
Exception - If the request fails
get_dataset_row
def get_dataset_row(dataset_id: str, row_index: int) -> Optional[DatasetRow]
Get a specific row from a dataset.
Arguments:
| Name | Description |
|---|
dataset_id | The ID of the dataset |
row_index | The index of the row to retrieve |
Returns:
| Name | Description |
|---|
Optional[[DatasetRow](/sdk/python/references/models/dataset)] | The dataset row, or None if not found |
Raises:
Exception - If the request fails
get_dataset_structure
def get_dataset_structure(dataset_id: str) -> Dict[str, str]
Get the structure of a dataset.
Arguments:
| Name | Description |
|---|
dataset_id | The ID of the dataset |
Returns:
Dict[str, str]: The dataset structure
Raises:
Exception - If the request fails
does_log_repository_exist
def does_log_repository_exist(logger_id: str) -> bool
Check if a log repository exists.
Arguments:
| Name | Description |
|---|
logger_id | The ID of the logger |
Returns:
| Name | Description |
|---|
bool | True if the repository exists, False otherwise |
push_logs
def push_logs(repository_id: str, logs: str) -> None
Push logs to a repository.
Arguments:
| Name | Description |
|---|
repository_id | The ID of the repository |
logs | The logs to push |
Raises:
Exception - If the request fails
def fetch_platform_evaluator(name: str, in_workspace_id: str) -> Evaluator
Fetch a platform evaluator by name.
Arguments:
| Name | Description |
|---|
name | The name of the evaluator |
in_workspace_id | The workspace ID |
Returns:
| Name | Description |
|---|
[Evaluator](/sdk/python/references/models/evaluator) | The evaluator details |
Raises:
Exception - If the request fails
create_test_run
def create_test_run(
name: str,
workspace_id: str,
workflow_id: Optional[str],
prompt_version_id: Optional[str],
prompt_chain_version_id: Optional[str],
run_type: RunType,
evaluator_config: list[Evaluator],
requires_local_run: bool,
human_evaluation_config: Optional[HumanEvaluationConfig] = None
) -> TestRun
Create a new test run.
Arguments:
| Name | Description |
|---|
name | The name of the test run |
workspace_id | The workspace ID |
workflow_id | Optional workflow ID |
prompt_version_id | Optional prompt version ID |
prompt_chain_version_id | Optional prompt chain version ID |
run_type | The type of run |
evaluator_config | List of evaluators to use |
requires_local_run | Whether the test run requires local execution |
human_evaluation_config | Optional human evaluation configuration |
Returns:
| Name | Description |
|---|
[TestRun](/sdk/python/references/models/test_run) | The created test run |
Raises:
Exception - If the request fails
attach_dataset_to_test_run
def attach_dataset_to_test_run(test_run_id: str, dataset_id: str) -> None
Attach a dataset to a test run.
Arguments:
| Name | Description |
|---|
test_run_id | The ID of the test run |
dataset_id | The ID of the dataset |
Raises:
Exception - If the request fails
push_test_run_entry
def push_test_run_entry(test_run: Union[TestRun, TestRunWithDatasetEntry],
entry: TestRunEntry,
run_config: Optional[Dict[str, Any]] = None) -> None
Push an entry to a test run.
Arguments:
| Name | Description |
|---|
test_run | The test run |
entry | The test run entry to push |
run_config | Optional run configuration |
Raises:
Exception - If the request fails
mark_test_run_processed
def mark_test_run_processed(test_run_id: str) -> None
Mark a test run as processed.
Arguments:
| Name | Description |
|---|
test_run_id | The ID of the test run |
Raises:
Exception - If the request fails
mark_test_run_failed
def mark_test_run_failed(test_run_id: str) -> None
Mark a test run as failed.
Arguments:
| Name | Description |
|---|
test_run_id | The ID of the test run |
Raises:
Exception - If the request fails
get_test_run_status
def get_test_run_status(test_run_id: str) -> TestRunStatus
Get the status of a test run.
Arguments:
| Name | Description |
|---|
test_run_id | The ID of the test run |
Returns:
| Name | Description |
|---|
[TestRunStatus](/sdk/python/references/models/test_run) | The status of the test run |
Raises:
Exception - If the request fails
get_test_run_final_result
def get_test_run_final_result(test_run_id: str) -> TestRunResult
Get the final result of a test run.
Arguments:
| Name | Description |
|---|
test_run_id | The ID of the test run |
Returns:
| Name | Description |
|---|
[TestRunResult](/sdk/python/references/models/test_run) | The final result of the test run |
Raises:
Exception - If the request fails
get_upload_url
def get_upload_url(key: str, mime_type: str, size: int) -> SignedURLResponse
Get a signed URL for uploading a file.
Arguments:
| Name | Description |
|---|
key | The key (filename) for the upload |
mime_type | The MIME type of the file |
size | The size of the file in bytes |
Returns:
| Name | Description |
|---|
[SignedURLResponse](/sdk/python/references/models/attachment) | A dictionary containing the signed URL for upload |
Raises:
Exception - If the request fails
upload_to_signed_url
def upload_to_signed_url(url: str, data: bytes, mime_type: str) -> bool
Upload data to a signed URL using multipart form data with retry logic.
Arguments:
| Name | Description |
|---|
url | The signed URL to upload to |
data | The binary data to upload |
mime_type | The MIME type of the data |
Returns:
| Name | Description |
|---|
bool | True if upload was successful, False otherwise |