Retrieve Assistants
Get a Specific Assistant
To retrieve information about a specific assistant, the get_assistant
method is used.
This method is particularly useful when you need details about a single, specific assistant.
import taskingai
assistant = taskingai.assistant.get_assistant(
assistant_id="YOUR_ASSISTANT_ID"
)
print(assistant)
List Assistants
The list_assistants
function retrieves a list of all assistants in the project.
assistants = taskingai.assistant.list_assistants(limit=20)
print("assistants: ", assistants)
assistant_ids = [assistant.assistant_id for assistant in assistants]
print("assistant_ids: ", assistant_ids)
This method lists assistants with options for pagination, which is particularly helpful in managing and navigating through a large number of assistants.
assistants = taskingai.assistant.list_assistants(
order="asc",
limit=20,
after="YOUR_ASSISTANT_ID"
)
Parameters and Usage:
limit
: Sets the maximum number of assistants to return in the list. This parameter helps in controlling the size of the output, especially in cases where there are numerous assistants.order
: Determines the order in which the assistants are listed. It can be either ascending ("asc") or descending ("desc").before
/after
: A cursor used for pagination. It specifies the point before/after which the next set of assistants should be fetched. This is useful for navigating through the list of assistants in manageable chunks.
The list_assistants method returns a list of Assistant objects, each representing an assistant in your project. This list provides a snapshot of all the assistants, along with their respective details and configurations.