introvoyz045's picture
Migrated from GitHub
9410704 verified
Raw History Blame Contribute Delete
6.37 kB
# This file was auto-generated by Fern from our API Definition.
import typing
from ....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
from ....core.request_options import RequestOptions
from ....types.get_tool_executions_page_response_model import GetToolExecutionsPageResponseModel
from .raw_client import AsyncRawExecutionsClient, RawExecutionsClient
class ExecutionsClient:
def __init__(self, *, client_wrapper: SyncClientWrapper):
self._raw_client = RawExecutionsClient(client_wrapper=client_wrapper)
@property
def with_raw_response(self) -> RawExecutionsClient:
"""
Retrieves a raw implementation of this client that returns raw responses.
Returns
-------
RawExecutionsClient
"""
return self._raw_client
def get(
self,
tool_id: str,
*,
cursor: typing.Optional[str] = None,
page_size: typing.Optional[int] = None,
is_error: typing.Optional[bool] = None,
agent_id: typing.Optional[str] = None,
branch_id: typing.Optional[str] = None,
start_time: typing.Optional[float] = None,
end_time: typing.Optional[float] = None,
request_options: typing.Optional[RequestOptions] = None,
) -> GetToolExecutionsPageResponseModel:
"""
Get paginated list of tool executions for a specific tool.
Parameters
----------
tool_id : str
ID of the requested tool.
cursor : typing.Optional[str]
Used for fetching next page. Cursor is returned in the response.
page_size : typing.Optional[int]
How many documents to return at maximum. Can not exceed 100, defaults to 30.
is_error : typing.Optional[bool]
Filter by error status. If not provided, returns all executions.
agent_id : typing.Optional[str]
Filter by agent ID.
branch_id : typing.Optional[str]
Filter by agent branch ID.
start_time : typing.Optional[float]
Filter executions from this Unix timestamp (inclusive).
end_time : typing.Optional[float]
Filter executions until this Unix timestamp (inclusive).
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
Returns
-------
GetToolExecutionsPageResponseModel
Successful Response
Examples
--------
from elevenlabs import ElevenLabs
client = ElevenLabs(
api_key="YOUR_API_KEY",
)
client.conversational_ai.tools.executions.get(
tool_id="tool_id",
cursor="cursor",
page_size=1,
is_error=True,
agent_id="agent_id",
branch_id="branch_id",
start_time=1.1,
end_time=1.1,
)
"""
_response = self._raw_client.get(
tool_id,
cursor=cursor,
page_size=page_size,
is_error=is_error,
agent_id=agent_id,
branch_id=branch_id,
start_time=start_time,
end_time=end_time,
request_options=request_options,
)
return _response.data
class AsyncExecutionsClient:
def __init__(self, *, client_wrapper: AsyncClientWrapper):
self._raw_client = AsyncRawExecutionsClient(client_wrapper=client_wrapper)
@property
def with_raw_response(self) -> AsyncRawExecutionsClient:
"""
Retrieves a raw implementation of this client that returns raw responses.
Returns
-------
AsyncRawExecutionsClient
"""
return self._raw_client
async def get(
self,
tool_id: str,
*,
cursor: typing.Optional[str] = None,
page_size: typing.Optional[int] = None,
is_error: typing.Optional[bool] = None,
agent_id: typing.Optional[str] = None,
branch_id: typing.Optional[str] = None,
start_time: typing.Optional[float] = None,
end_time: typing.Optional[float] = None,
request_options: typing.Optional[RequestOptions] = None,
) -> GetToolExecutionsPageResponseModel:
"""
Get paginated list of tool executions for a specific tool.
Parameters
----------
tool_id : str
ID of the requested tool.
cursor : typing.Optional[str]
Used for fetching next page. Cursor is returned in the response.
page_size : typing.Optional[int]
How many documents to return at maximum. Can not exceed 100, defaults to 30.
is_error : typing.Optional[bool]
Filter by error status. If not provided, returns all executions.
agent_id : typing.Optional[str]
Filter by agent ID.
branch_id : typing.Optional[str]
Filter by agent branch ID.
start_time : typing.Optional[float]
Filter executions from this Unix timestamp (inclusive).
end_time : typing.Optional[float]
Filter executions until this Unix timestamp (inclusive).
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
Returns
-------
GetToolExecutionsPageResponseModel
Successful Response
Examples
--------
import asyncio
from elevenlabs import AsyncElevenLabs
client = AsyncElevenLabs(
api_key="YOUR_API_KEY",
)
async def main() -> None:
await client.conversational_ai.tools.executions.get(
tool_id="tool_id",
cursor="cursor",
page_size=1,
is_error=True,
agent_id="agent_id",
branch_id="branch_id",
start_time=1.1,
end_time=1.1,
)
asyncio.run(main())
"""
_response = await self._raw_client.get(
tool_id,
cursor=cursor,
page_size=page_size,
is_error=is_error,
agent_id=agent_id,
branch_id=branch_id,
start_time=start_time,
end_time=end_time,
request_options=request_options,
)
return _response.data