aito.client.requests.query_api_request.BatchRequest

class aito.client.requests.query_api_request.BatchRequest(queries: List[Dict])

Bases: _PostRequest, _FinalRequest, AitoRequest

Request to the Batch API

Allows executing multiple queries (predict, similarity, search, etc.) in a single request.

Example:

from aito.client.requests import BatchRequest

# Execute multiple queries in one request
request = BatchRequest([
    {"from": "products", "where": {"name": "rye bread"}, "predict": "category"},
    {"from": "products", "similarity": {"name": "rye bread"}}
])
Parameters:

queries (List[Dict]) – A list of query dictionaries to execute in batch

Methods

make_request(method, endpoint, query)

factory method to return the appropriate request class instance after checking the input endpoint and method :param method: the method of the request :type method: str :param endpoint: the endpoint of the request :type endpoint: str :param query: an Aito query if applicable, optional :type query: Optional[Union[Dict, List]] :return: the appropriate request class intsnace :rtype: AitoRequest

Attributes

endpoint

method

classmethod make_request(method: str, endpoint: str, query: Dict | List | None) AitoRequest

factory method to return the appropriate request class instance after checking the input endpoint and method :param method: the method of the request :type method: str :param endpoint: the endpoint of the request :type endpoint: str :param query: an Aito query if applicable, optional :type query: Optional[Union[Dict, List]] :return: the appropriate request class intsnace :rtype: AitoRequest

response_cls

alias of BatchResponse