payments-py

module ai_query_api

Global Variables


class AIQueryApi

Represents the AI Query API.

Args:

Methods:

method __init__

__init__(opts: BackendApiOptions)

method create_steps

create_steps(did: str, task_id: str, steps: Any)

It creates the step/s required to complete an AI Task. This method is used by the AI Agent to create the steps required to complete the AI Task.

Args:


method create_task

create_task(did: str, task: Any, jwt: Optional[str] = None)

Subscribers can create an AI Task for an Agent. The task must contain the input query that will be used by the AI Agent. This method is used by subscribers of a Payment Plan required to access a specific AI Agent or Service. Users who are not subscribers won’t be able to create AI Tasks for that Agent. Because only subscribers can create AI Tasks, the method requires the access token to interact with the AI Agent/Service. This is given using the queryOpts object (accessToken attribute).

Args:

Example: task = { “query”: “https://www.youtube.com/watch?v=0tZFQs7qBfQ”, “name”: “transcribe”, “additional_params”: [], “artifacts”: [] } task = subscriber.ai_protocol.create_task(agent.did, task) print(‘Task created:’, task.json())


method get_step

get_step(step_id: str)

It retrieves all the steps that the agent needs to execute to complete the different tasks assigned. This method is used by the AI Agent to retrieve information about the steps part of tasks created by users to the agents owned by the user.

Args:


method get_steps

get_steps(
    status: AgentExecutionStatus = <AgentExecutionStatus.Pending: 'Pending'>,
    dids: List[str] = []
)

Gets the steps.

Args:


method get_steps_from_task

get_steps_from_task(did: str, task_id: str, status: Optional[str] = None)

It retrieves all the steps that the agent needs to execute to complete a specific task associated to the user. This method is used by the AI Agent to retrieve information about the tasks created by users to the agents owned by the user.

Args:


method get_task_with_steps

get_task_with_steps(did: str, task_id: str, jwt: Optional[str] = None)

It returns the full task and the steps resulted of the execution of the task.

This method is used by subscribers of a Payment Plan required to access a specific AI Agent or Service. Users who are not subscribers won’t be able to create AI Tasks for that Agent.

Args:


method get_tasks_from_agents

get_tasks_from_agents()

It retrieves all the tasks that the agent needs to execute to complete the different tasks assigned. This method is used by the AI Agent to retrieve information about the tasks created by users to the agents owned by the user


method search_step

search_step(search_params: Any)

It search steps based on the search parameters. The steps belongs to the tasks part of the AI Agents owned by the user. This method is used by the AI Agent to retrieve information about the steps part of tasks created by users to the agents owned by the user.

Args:


method search_tasks

search_tasks(search_params: Any)

It searches tasks based on the search parameters associated to the user.

Args:


method subscribe

subscribe(
    callback: Any,
    join_account_room: bool = True,
    join_agent_rooms: Optional[str, List[str]] = None,
    subscribe_event_types: Optional[List[str]] = None,
    get_pending_events_on_subscribe: bool = True
)

It subscribes to the Nevermined network to retrieve new AI Tasks requested by other users. This method is used by AI agents to subscribe and receive new AI Tasks sent by other subscribers.

Args:


method update_step

update_step(
    did: str,
    task_id: str,
    step_id: str,
    step: Any,
    jwt: Optional[str] = None
)

It updates the step with the new information. This method is used by the AI Agent to update the status and output of an step. This method can not be called by a subscriber.

Args:


This file was automatically generated via lazydocs.