From 850d1f4722edce9bd369e1b3d43d943d2035eae2 Mon Sep 17 00:00:00 2001
From: enrique class
- AIQueryApi
get_steps_from_task
: Gets the steps from a task
- get_steps
: Gets the steps
- get_tasks_from_agents
: Gets the tasks from the agents
- - search_step
: Searches for steps
search_step
: Searches for steps
+ - get_step
: Gets the details of a step
+
__init__
__init__(opts: BackendApiOptions)
create_steps
create_steps(did: str, task_id: str, steps: Any)
@@ -173,25 +174,24 @@ create_steps
steps
(Any): The steps to create. create_task
create_task(did: str, task: Any, jwt: Optional[str] = None)
+create_task(did: str, task: Any)
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:
did
(str): The DID of the service.
task
(Any): The task to create.
-jwt
(Optional[str]): The JWT token.
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.
+Get the details of a step.
Args:
did
(str): The DID of the service.
@@ -199,21 +199,21 @@ method get_step
step_id
(str): The step ID.
-
+
method get_steps
get_steps(
status: AgentExecutionStatus = <AgentExecutionStatus.Pending: 'Pending'>,
dids: List[str] = []
)
-Gets the steps.
+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:
status
(AgentExecutionStatus): The status of the steps.
dids
(List[str]): The list of DIDs.
-
+
method get_steps_from_task
get_steps_from_task(did: str, task_id: str, status: Optional[str] = None)
@@ -225,9 +225,9 @@ method get_steps_from_task<
status
(Optional[str]): The status of the steps.
-
+
method get_task_with_steps
-get_task_with_steps(did: str, task_id: str, jwt: Optional[str] = None)
+get_task_with_steps(did: str, task_id: str)
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.
@@ -235,16 +235,15 @@ method get_task_with_steps<
did
(str): The DID of the service.
task_id
(str): The task ID.
-jwt
(Optional[str]): The JWT token.
-
+
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)
@@ -254,7 +253,7 @@ method search_step
search_params
(Any): The search parameters.
-
+
method search_tasks
search_tasks(search_params: Any)
@@ -264,7 +263,7 @@ method search_tasks
search_params
(Any): The search parameters.
-
+
method subscribe
subscribe(
callback: Any,
@@ -284,15 +283,9 @@ method subscribe
get_pending_events_on_subscribe
(bool): If True, it will get the pending events on subscribe.
-
+
method update_step
-update_step(
- did: str,
- task_id: str,
- step_id: str,
- step: Any,
- jwt: Optional[str] = None
-)
+update_step(did: str, task_id: str, step_id: str, step: Any)
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:
@@ -301,7 +294,6 @@ method update_step
task_id
(str): The task ID.
step_id
(str): The step ID.
step
(Any): The step object to update. https://docs.nevermined.io/docs/protocol/query-protocol#steps-attributes
-jwt
(Optional[str]): The JWT token.
This file was automatically generated via lazydocs.
diff --git a/site/index.html b/site/index.html
index cd145af..eee9029 100644
--- a/site/index.html
+++ b/site/index.html
@@ -187,5 +187,5 @@ Functions
diff --git a/site/nvm_backend/index.html b/site/nvm_backend/index.html
index 06c1a0a..f2f1bdc 100644
--- a/site/nvm_backend/index.html
+++ b/site/nvm_backend/index.html
@@ -82,6 +82,8 @@
method join_room
+ method parse_headers
+
method parse_url_to_backend
method parse_url_to_proxy
@@ -89,8 +91,6 @@
method post
method put
-
- method set_bearer_token
@@ -165,9 +165,9 @@ method connect_socket
connect_socket()
-
+
method delete
-delete(url: str, data: Any)
+delete(url: str, data: Any, headers: Optional[Dict[str, str]] = None)
@@ -180,12 +180,12 @@ method disconnect_socketdisconnect_socket()
-
+
method get
-get(url: str)
+get(url: str, headers: Optional[Dict[str, str]] = None)
-
+
method get_service_token
get_service_token(service_did: str) → ServiceTokenResultDto
@@ -210,7 +210,12 @@ method join_room
join_room(join_account_room: bool, room_ids: Optional[str, List[str]] = None)
-
+
+method parse_headers
+parse_headers(additional_headers: dict[str, str]) → dict[str, str]
+
+
+
method parse_url_to_backend
parse_url_to_backend(uri: str) → str
@@ -220,19 +225,14 @@ method parse_url_to_proxyparse_url_to_proxy(uri: str) → str
-
+
method post
-post(url: str, data: Any)
+post(url: str, data: Any, headers: Optional[Dict[str, str]] = None)
-
+
method put
-put(url: str, data: Any)
-
-
-
-method set_bearer_token
-set_bearer_token(token: str)
+put(url: str, data: Any, headers: Optional[Dict[str, str]] = None)
This file was automatically generated via lazydocs.
diff --git a/site/search/search_index.json b/site/search/search_index.json
index 6cce14f..6c0c53c 100644
--- a/site/search/search_index.json
+++ b/site/search/search_index.json
@@ -1 +1 @@
-{"config":{"indexing":"full","lang":["en"],"min_search_length":3,"prebuild_index":false,"separator":"[\\s\\-]+"},"docs":[{"location":"","text":"API Overview Modules ai_query_api data_models environments nvm_backend payments utils Classes ai_query_api.AIQueryApi : Represents the AI Query API. data_models.AgentExecutionStatus : An enumeration. data_models.Artifact : Represents an artifact with a unique identifier and a URL reference. data_models.BalanceResultDto data_models.BurnResultDto data_models.CreateAssetResultDto data_models.DownloadFileResultDto data_models.ExecutionInput : Represents the input for a task, such as a query and additional parameters or artifacts. data_models.ExecutionOptions : Represents options for executing a task or step, such as input, status, and output. data_models.ExecutionOutput : Represents the output of a task or step execution. data_models.MintResultDto data_models.OrderPlanResultDto data_models.PlanType : An enumeration. data_models.ServiceTokenResultDto data_models.Step : Represents a step in the execution of a task. data_models.Task : Represents a task that an agent should execute, composed of multiple steps. environments.Environment : Enum class to define the different environments nvm_backend.BackendApiOptions : Represents the backend API options. nvm_backend.NVMBackendApi payments.Payments : A class representing a payment system. Functions utils.snake_to_camel : Convert snake_case to camelCase. This file was automatically generated via lazydocs .","title":"Overview"},{"location":"#api-overview","text":"","title":"API Overview"},{"location":"#modules","text":"ai_query_api data_models environments nvm_backend payments utils","title":"Modules"},{"location":"#classes","text":"ai_query_api.AIQueryApi : Represents the AI Query API. data_models.AgentExecutionStatus : An enumeration. data_models.Artifact : Represents an artifact with a unique identifier and a URL reference. data_models.BalanceResultDto data_models.BurnResultDto data_models.CreateAssetResultDto data_models.DownloadFileResultDto data_models.ExecutionInput : Represents the input for a task, such as a query and additional parameters or artifacts. data_models.ExecutionOptions : Represents options for executing a task or step, such as input, status, and output. data_models.ExecutionOutput : Represents the output of a task or step execution. data_models.MintResultDto data_models.OrderPlanResultDto data_models.PlanType : An enumeration. data_models.ServiceTokenResultDto data_models.Step : Represents a step in the execution of a task. data_models.Task : Represents a task that an agent should execute, composed of multiple steps. environments.Environment : Enum class to define the different environments nvm_backend.BackendApiOptions : Represents the backend API options. nvm_backend.NVMBackendApi payments.Payments : A class representing a payment system.","title":"Classes"},{"location":"#functions","text":"utils.snake_to_camel : Convert snake_case to camelCase. This file was automatically generated via lazydocs .","title":"Functions"},{"location":"ai_query_api/","text":"module ai_query_api Global Variables SEARCH_TASKS_ENDPOINT SEARCH_STEPS_ENDPOINT CREATE_STEPS_ENDPOINT UPDATE_STEP_ENDPOINT GET_AGENTS_ENDPOINT GET_BUILDER_STEPS_ENDPOINT GET_TASK_STEPS_ENDPOINT TASK_ENDPOINT GET_TASK_ENDPOINT class AIQueryApi Represents the AI Query API. Args: opts (BackendApiOptions): The backend API options Methods: - create_task : Creates a task for an agent to execute - create_steps : Creates steps for a task - update_step : Updates a step - search_tasks : Searches for tasks - get_task_with_steps : Gets a task with its steps - get_steps_from_task : Gets the steps from a task - get_steps : Gets the steps - get_tasks_from_agents : Gets the tasks from the agents - search_step : Searches for steps 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: did (str): The DID of the service. task_id (str): The task ID. steps (Any): The steps to create. 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: did (str): The DID of the service. task (Any): The task to create. jwt (Optional[str]): The JWT token. 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: did (str): The DID of the service. task_id (str): The task ID. step_id (str): The step ID. method get_steps get_steps( status: AgentExecutionStatus = , dids: List[str] = [] ) Gets the steps. Args: status (AgentExecutionStatus): The status of the steps. dids (List[str]): The list of DIDs. 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: did (str): The DID of the service. task_id (str): The task ID. status (Optional[str]): The status of the steps. 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: did (str): The DID of the service. task_id (str): The task ID. jwt (Optional[str]): The JWT token. 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: search_params (Any): The search parameters. method search_tasks search_tasks(search_params: Any) It searches tasks based on the search parameters associated to the user. Args: search_params (Any): The search parameters. 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: callback (Any): The callback function to be called when a new event is received. join_account_room (bool): If True, it will join the account room. join_agent_rooms (Optional[Union[str, List[str]]]): The agent rooms to join. subscribe_event_types (Optional[List[str]]): The event types to subscribe to. get_pending_events_on_subscribe (bool): If True, it will get the pending events on subscribe. 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: did (str): The DID of the service. task_id (str): The task ID. step_id (str): The step ID. step (Any): The step object to update. https://docs.nevermined.io/docs/protocol/query-protocol#steps-attributes jwt (Optional[str]): The JWT token. This file was automatically generated via lazydocs .","title":"Ai query api"},{"location":"ai_query_api/#module-ai_query_api","text":"","title":"module ai_query_api"},{"location":"ai_query_api/#global-variables","text":"SEARCH_TASKS_ENDPOINT SEARCH_STEPS_ENDPOINT CREATE_STEPS_ENDPOINT UPDATE_STEP_ENDPOINT GET_AGENTS_ENDPOINT GET_BUILDER_STEPS_ENDPOINT GET_TASK_STEPS_ENDPOINT TASK_ENDPOINT GET_TASK_ENDPOINT","title":"Global Variables"},{"location":"ai_query_api/#class-aiqueryapi","text":"Represents the AI Query API. Args: opts (BackendApiOptions): The backend API options Methods: - create_task : Creates a task for an agent to execute - create_steps : Creates steps for a task - update_step : Updates a step - search_tasks : Searches for tasks - get_task_with_steps : Gets a task with its steps - get_steps_from_task : Gets the steps from a task - get_steps : Gets the steps - get_tasks_from_agents : Gets the tasks from the agents - search_step : Searches for steps","title":"class AIQueryApi"},{"location":"ai_query_api/#method-__init__","text":"__init__(opts: BackendApiOptions)","title":"method __init__"},{"location":"ai_query_api/#method-create_steps","text":"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: did (str): The DID of the service. task_id (str): The task ID. steps (Any): The steps to create.","title":"method create_steps"},{"location":"ai_query_api/#method-create_task","text":"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: did (str): The DID of the service. task (Any): The task to create. jwt (Optional[str]): The JWT token. 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())","title":"method create_task"},{"location":"ai_query_api/#method-get_step","text":"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: did (str): The DID of the service. task_id (str): The task ID. step_id (str): The step ID.","title":"method get_step"},{"location":"ai_query_api/#method-get_steps","text":"get_steps( status: AgentExecutionStatus = , dids: List[str] = [] ) Gets the steps. Args: status (AgentExecutionStatus): The status of the steps. dids (List[str]): The list of DIDs.","title":"method get_steps"},{"location":"ai_query_api/#method-get_steps_from_task","text":"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: did (str): The DID of the service. task_id (str): The task ID. status (Optional[str]): The status of the steps.","title":"method get_steps_from_task"},{"location":"ai_query_api/#method-get_task_with_steps","text":"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: did (str): The DID of the service. task_id (str): The task ID. jwt (Optional[str]): The JWT token.","title":"method get_task_with_steps"},{"location":"ai_query_api/#method-get_tasks_from_agents","text":"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","title":"method get_tasks_from_agents"},{"location":"ai_query_api/#method-search_step","text":"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: search_params (Any): The search parameters.","title":"method search_step"},{"location":"ai_query_api/#method-search_tasks","text":"search_tasks(search_params: Any) It searches tasks based on the search parameters associated to the user. Args: search_params (Any): The search parameters.","title":"method search_tasks"},{"location":"ai_query_api/#method-subscribe","text":"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: callback (Any): The callback function to be called when a new event is received. join_account_room (bool): If True, it will join the account room. join_agent_rooms (Optional[Union[str, List[str]]]): The agent rooms to join. subscribe_event_types (Optional[List[str]]): The event types to subscribe to. get_pending_events_on_subscribe (bool): If True, it will get the pending events on subscribe.","title":"method subscribe"},{"location":"ai_query_api/#method-update_step","text":"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: did (str): The DID of the service. task_id (str): The task ID. step_id (str): The step ID. step (Any): The step object to update. https://docs.nevermined.io/docs/protocol/query-protocol#steps-attributes jwt (Optional[str]): The JWT token. This file was automatically generated via lazydocs .","title":"method update_step"},{"location":"data_models/","text":"module data_models Global Variables FIRST_STEP_NAME LAST_STEP_NAME class PlanType An enumeration. class BalanceResultDto property model_extra Get extra fields set during validation. Returns: A dictionary of extra fields, or None if config.extra is not set to \"allow\" . property model_fields_set Returns the set of fields that have been explicitly set on this model instance. Returns: A set of strings representing the fields that have been set, i.e. that were not filled from defaults. class MintResultDto property model_extra Get extra fields set during validation. Returns: A dictionary of extra fields, or None if config.extra is not set to \"allow\" . property model_fields_set Returns the set of fields that have been explicitly set on this model instance. Returns: A set of strings representing the fields that have been set, i.e. that were not filled from defaults. class BurnResultDto property model_extra Get extra fields set during validation. Returns: A dictionary of extra fields, or None if config.extra is not set to \"allow\" . property model_fields_set Returns the set of fields that have been explicitly set on this model instance. Returns: A set of strings representing the fields that have been set, i.e. that were not filled from defaults. class CreateAssetResultDto property model_extra Get extra fields set during validation. Returns: A dictionary of extra fields, or None if config.extra is not set to \"allow\" . property model_fields_set Returns the set of fields that have been explicitly set on this model instance. Returns: A set of strings representing the fields that have been set, i.e. that were not filled from defaults. class DownloadFileResultDto property model_extra Get extra fields set during validation. Returns: A dictionary of extra fields, or None if config.extra is not set to \"allow\" . property model_fields_set Returns the set of fields that have been explicitly set on this model instance. Returns: A set of strings representing the fields that have been set, i.e. that were not filled from defaults. class OrderPlanResultDto property model_extra Get extra fields set during validation. Returns: A dictionary of extra fields, or None if config.extra is not set to \"allow\" . property model_fields_set Returns the set of fields that have been explicitly set on this model instance. Returns: A set of strings representing the fields that have been set, i.e. that were not filled from defaults. class ServiceTokenResultDto property model_extra Get extra fields set during validation. Returns: A dictionary of extra fields, or None if config.extra is not set to \"allow\" . property model_fields_set Returns the set of fields that have been explicitly set on this model instance. Returns: A set of strings representing the fields that have been set, i.e. that were not filled from defaults. class AgentExecutionStatus An enumeration. class Artifact Represents an artifact with a unique identifier and a URL reference. class ExecutionInput Represents the input for a task, such as a query and additional parameters or artifacts. class ExecutionOutput Represents the output of a task or step execution. class ExecutionOptions Represents options for executing a task or step, such as input, status, and output. class Step Represents a step in the execution of a task. class Task Represents a task that an agent should execute, composed of multiple steps. This file was automatically generated via lazydocs .","title":"Data models"},{"location":"data_models/#module-data_models","text":"","title":"module data_models"},{"location":"data_models/#global-variables","text":"FIRST_STEP_NAME LAST_STEP_NAME","title":"Global Variables"},{"location":"data_models/#class-plantype","text":"An enumeration.","title":"class PlanType"},{"location":"data_models/#class-balanceresultdto","text":"","title":"class BalanceResultDto"},{"location":"data_models/#property-model_extra","text":"Get extra fields set during validation. Returns: A dictionary of extra fields, or None if config.extra is not set to \"allow\" .","title":"property model_extra"},{"location":"data_models/#property-model_fields_set","text":"Returns the set of fields that have been explicitly set on this model instance. Returns: A set of strings representing the fields that have been set, i.e. that were not filled from defaults.","title":"property model_fields_set"},{"location":"data_models/#class-mintresultdto","text":"","title":"class MintResultDto"},{"location":"data_models/#property-model_extra_1","text":"Get extra fields set during validation. Returns: A dictionary of extra fields, or None if config.extra is not set to \"allow\" .","title":"property model_extra"},{"location":"data_models/#property-model_fields_set_1","text":"Returns the set of fields that have been explicitly set on this model instance. Returns: A set of strings representing the fields that have been set, i.e. that were not filled from defaults.","title":"property model_fields_set"},{"location":"data_models/#class-burnresultdto","text":"","title":"class BurnResultDto"},{"location":"data_models/#property-model_extra_2","text":"Get extra fields set during validation. Returns: A dictionary of extra fields, or None if config.extra is not set to \"allow\" .","title":"property model_extra"},{"location":"data_models/#property-model_fields_set_2","text":"Returns the set of fields that have been explicitly set on this model instance. Returns: A set of strings representing the fields that have been set, i.e. that were not filled from defaults.","title":"property model_fields_set"},{"location":"data_models/#class-createassetresultdto","text":"","title":"class CreateAssetResultDto"},{"location":"data_models/#property-model_extra_3","text":"Get extra fields set during validation. Returns: A dictionary of extra fields, or None if config.extra is not set to \"allow\" .","title":"property model_extra"},{"location":"data_models/#property-model_fields_set_3","text":"Returns the set of fields that have been explicitly set on this model instance. Returns: A set of strings representing the fields that have been set, i.e. that were not filled from defaults.","title":"property model_fields_set"},{"location":"data_models/#class-downloadfileresultdto","text":"","title":"class DownloadFileResultDto"},{"location":"data_models/#property-model_extra_4","text":"Get extra fields set during validation. Returns: A dictionary of extra fields, or None if config.extra is not set to \"allow\" .","title":"property model_extra"},{"location":"data_models/#property-model_fields_set_4","text":"Returns the set of fields that have been explicitly set on this model instance. Returns: A set of strings representing the fields that have been set, i.e. that were not filled from defaults.","title":"property model_fields_set"},{"location":"data_models/#class-orderplanresultdto","text":"","title":"class OrderPlanResultDto"},{"location":"data_models/#property-model_extra_5","text":"Get extra fields set during validation. Returns: A dictionary of extra fields, or None if config.extra is not set to \"allow\" .","title":"property model_extra"},{"location":"data_models/#property-model_fields_set_5","text":"Returns the set of fields that have been explicitly set on this model instance. Returns: A set of strings representing the fields that have been set, i.e. that were not filled from defaults.","title":"property model_fields_set"},{"location":"data_models/#class-servicetokenresultdto","text":"","title":"class ServiceTokenResultDto"},{"location":"data_models/#property-model_extra_6","text":"Get extra fields set during validation. Returns: A dictionary of extra fields, or None if config.extra is not set to \"allow\" .","title":"property model_extra"},{"location":"data_models/#property-model_fields_set_6","text":"Returns the set of fields that have been explicitly set on this model instance. Returns: A set of strings representing the fields that have been set, i.e. that were not filled from defaults.","title":"property model_fields_set"},{"location":"data_models/#class-agentexecutionstatus","text":"An enumeration.","title":"class AgentExecutionStatus"},{"location":"data_models/#class-artifact","text":"Represents an artifact with a unique identifier and a URL reference.","title":"class Artifact"},{"location":"data_models/#class-executioninput","text":"Represents the input for a task, such as a query and additional parameters or artifacts.","title":"class ExecutionInput"},{"location":"data_models/#class-executionoutput","text":"Represents the output of a task or step execution.","title":"class ExecutionOutput"},{"location":"data_models/#class-executionoptions","text":"Represents options for executing a task or step, such as input, status, and output.","title":"class ExecutionOptions"},{"location":"data_models/#class-step","text":"Represents a step in the execution of a task.","title":"class Step"},{"location":"data_models/#class-task","text":"Represents a task that an agent should execute, composed of multiple steps. This file was automatically generated via lazydocs .","title":"class Task"},{"location":"environments/","text":"module environments class Environment Enum class to define the different environments Attributes: local : Local environment appStaging : Staging environment appTesting : Testing environment appArbitrum : Arbitrum environment appPeaq : Peaq network This file was automatically generated via lazydocs .","title":"Environments"},{"location":"environments/#module-environments","text":"","title":"module environments"},{"location":"environments/#class-environment","text":"Enum class to define the different environments Attributes: local : Local environment appStaging : Staging environment appTesting : Testing environment appArbitrum : Arbitrum environment appPeaq : Peaq network This file was automatically generated via lazydocs .","title":"class Environment"},{"location":"nvm_backend/","text":"module nvm_backend class BackendApiOptions Represents the backend API options. Args: environment (Environment): The environment. api_key (Optional[str]): The Nevermined API Key. This key identify your user and is required to interact with the Nevermined API. You can get your API key by logging in to the Nevermined App. See https://docs.nevermined.app/docs/tutorials/integration/nvm-api-keys headers (Optional[Dict[str, str]]): Additional headers to send with the requests web_socket_options (Optional[Dict[str, Any]]): Configuration of the websocket connection method __init__ __init__( environment: Environment, api_key: Optional[str] = None, headers: Optional[Dict[str, str]] = None, web_socket_options: Optional[Dict[str, Any]] = None ) class NVMBackendApi method __init__ __init__(opts: BackendApiOptions) method connect_socket connect_socket() method delete delete(url: str, data: Any) method disconnect disconnect() method disconnect_socket disconnect_socket() method get get(url: str) method get_service_token get_service_token(service_did: str) \u2192 ServiceTokenResultDto Gets the service token. Args: service_did (str): The DID of the service. Returns: ServiceTokenResultDto : The result of the creation operation. Raises: HTTPError : If the API call fails. Example: response = your_instance.get_service_token(service_did=\"did:nv:xyz789\") print(response) method join_room join_room(join_account_room: bool, room_ids: Optional[str, List[str]] = None) method parse_url_to_backend parse_url_to_backend(uri: str) \u2192 str method parse_url_to_proxy parse_url_to_proxy(uri: str) \u2192 str method post post(url: str, data: Any) method put put(url: str, data: Any) method set_bearer_token set_bearer_token(token: str) This file was automatically generated via lazydocs .","title":"Nvm backend"},{"location":"nvm_backend/#module-nvm_backend","text":"","title":"module nvm_backend"},{"location":"nvm_backend/#class-backendapioptions","text":"Represents the backend API options. Args: environment (Environment): The environment. api_key (Optional[str]): The Nevermined API Key. This key identify your user and is required to interact with the Nevermined API. You can get your API key by logging in to the Nevermined App. See https://docs.nevermined.app/docs/tutorials/integration/nvm-api-keys headers (Optional[Dict[str, str]]): Additional headers to send with the requests web_socket_options (Optional[Dict[str, Any]]): Configuration of the websocket connection","title":"class BackendApiOptions"},{"location":"nvm_backend/#method-__init__","text":"__init__( environment: Environment, api_key: Optional[str] = None, headers: Optional[Dict[str, str]] = None, web_socket_options: Optional[Dict[str, Any]] = None )","title":"method __init__"},{"location":"nvm_backend/#class-nvmbackendapi","text":"","title":"class NVMBackendApi"},{"location":"nvm_backend/#method-__init___1","text":"__init__(opts: BackendApiOptions)","title":"method __init__"},{"location":"nvm_backend/#method-connect_socket","text":"connect_socket()","title":"method connect_socket"},{"location":"nvm_backend/#method-delete","text":"delete(url: str, data: Any)","title":"method delete"},{"location":"nvm_backend/#method-disconnect","text":"disconnect()","title":"method disconnect"},{"location":"nvm_backend/#method-disconnect_socket","text":"disconnect_socket()","title":"method disconnect_socket"},{"location":"nvm_backend/#method-get","text":"get(url: str)","title":"method get"},{"location":"nvm_backend/#method-get_service_token","text":"get_service_token(service_did: str) \u2192 ServiceTokenResultDto Gets the service token. Args: service_did (str): The DID of the service. Returns: ServiceTokenResultDto : The result of the creation operation. Raises: HTTPError : If the API call fails. Example: response = your_instance.get_service_token(service_did=\"did:nv:xyz789\") print(response)","title":"method get_service_token"},{"location":"nvm_backend/#method-join_room","text":"join_room(join_account_room: bool, room_ids: Optional[str, List[str]] = None)","title":"method join_room"},{"location":"nvm_backend/#method-parse_url_to_backend","text":"parse_url_to_backend(uri: str) \u2192 str","title":"method parse_url_to_backend"},{"location":"nvm_backend/#method-parse_url_to_proxy","text":"parse_url_to_proxy(uri: str) \u2192 str","title":"method parse_url_to_proxy"},{"location":"nvm_backend/#method-post","text":"post(url: str, data: Any)","title":"method post"},{"location":"nvm_backend/#method-put","text":"put(url: str, data: Any)","title":"method put"},{"location":"nvm_backend/#method-set_bearer_token","text":"set_bearer_token(token: str) This file was automatically generated via lazydocs .","title":"method set_bearer_token"},{"location":"payments/","text":"module payments class Payments A class representing a payment system. Attributes: nvm_api_key (str): The nvm api key for authentication. environment (Environment): The environment for the payment system. app_id (str, optional): The application ID. version (str, optional): The version of the payment system. ai_protocol (bool): Indicates if the AI protocol is enabled. headers (dict, optional): The headers for the payment system. web_socket_options (dict, optional): The web socket options for the payment system. Methods: - create_credits_plan : Creates a new credits plan. - create_time_plan : Creates a new time plan. - create_service : Creates a new service. - create_file : Creates a new file. - order_plan : Orders the plan. - get_asset_ddo : Gets the asset DDO. - get_plan_balance : Gets the plan balance. - get_service_token : Gets the service token. - get_plan_associated_services : Gets the plan associated services. - get_plan_associated_files : Gets the plan associated files. - get_plan_details : Gets the plan details. - get_service_details : Gets the service details. - get_file_details : Gets the file details. - get_checkout_plan : Gets the checkout plan. - download_file : Downloads the file. - mint_credits : Mints the credits associated to a plan and send to the receiver. - burn_credits : Burns credits associated to a plan that you own. - ai_protocol : The AI Query API. method __init__ __init__( nvm_api_key: str, environment: Environment, app_id: Optional[str] = None, version: Optional[str] = None, ai_protocol: bool = False, headers: Optional[dict] = None, web_socket_options: Optional[dict] = None ) method burn_credits burn_credits(plan_did: str, amount: str) \u2192 BurnResultDto Burn credits for a given Payment Plan DID. This method is only can be called by the owner of the Payment Plan. Args: plan_did (str): The DID of the plan. amount (str): The amount of credits to burn. Returns: BurnResultDto : The result of the burning operation. Raises: HTTPError : If the API call fails. Example: response = your_instance.burn_credits(plan_did=\"did:nv:e405a91e3152be1430c5d0607ebdf9236c19f34bfba0320798d81ba5f5e3e3a5\", amount=\"12\") print(response) method create_credits_plan create_credits_plan( name: str, description: str, price: int, token_address: str, amount_of_credits: int, tags: Optional[List[str]] = None ) \u2192 CreateAssetResultDto It allows to an AI Builder to create a Payment Plan on Nevermined based on Credits. A Nevermined Credits Plan limits the access by the access/usage of the Plan. With them, AI Builders control the number of requests that can be made to an agent or service. Every time a user accesses any resouce associated to the Payment Plan, the usage consumes from a capped amount of credits. When the user consumes all the credits, the plan automatically expires and the user needs to top up to continue using the service. This method is oriented to AI Builders. https://docs.nevermined.app/docs/tutorials/builders/create-plan Args: name (str): The name of the plan. description (str): The description of the plan. price (int): The price of the plan. token_address (str): The token address. amount_of_credits (int): The amount of credits for the plan. tags (List[str], optional): The tags associated with the plan. Returns: CreateAssetResultDto : The result of the creation operation. Raises: HTTPError : If the API call fails. Example: response = your_instance.create_credits_plan(name=\"Basic Plan\", description=\"100 credits plan\", price=1, token_address=\"0x1234\", amount_of_credits=100, tags=[\"basic\"]) print(response) method create_file create_file( plan_did: str, asset_type: str, name: str, description: str, files: List[dict], data_schema: Optional[str] = None, sample_code: Optional[str] = None, files_format: Optional[str] = None, usage_example: Optional[str] = None, programming_language: Optional[str] = None, framework: Optional[str] = None, task: Optional[str] = None, training_details: Optional[str] = None, variations: Optional[str] = None, fine_tunable: Optional[bool] = None, amount_of_credits: Optional[int] = None, tags: Optional[List[str]] = None ) \u2192 CreateAssetResultDto It creates a new asset with file associated to it. The file asset must be associated to a Payment Plan. Users that are subscribers of a payment plan can download the files attached to it. Depending on the Payment Plan and the configuration of the file asset, the download will consume credits. When the plan expires (because the time is over or the credits are consumed), the user needs to renew the plan to continue downloading the files. This method is oriented to AI Builders https://docs.nevermined.app/docs/tutorials/builders/register-file-asset Args: plan_did (str): The DID of the plan. asset_type (str): The type of the asset. -> 'algorithm' | 'model' | 'dataset' | 'file' name (str): The name of the file. description (str): The description of the file. files (List[dict]): The files of the file. data_schema (str, optional): The data schema of the file. sample_code (str, optional): The sample code of the file. files_format (str, optional): The files format of the file. usage_example (str, optional): The usage example of the file. programming_language (str, optional): The programming language of the file. framework (str, optional): The framework of the file. task (str, optional): The task of the file. training_details (str, optional): The training details of the file. variations (str, optional): The variations of the file. fine_tunable (bool, optional): The fine tunable of the file. amount_of_credits (int, optional): The amount of credits for the file. tags (List[str], optional): The tags associated with the file. Returns: CreateAssetResultDto : The result of the creation operation. Raises: HTTPError : If the API call fails. Example: response = your_instance.create_file(plan_did=\"did:nv:xyz789\", asset_type=\"dataset\", name=\"Sample Dataset\", description=\"A sample dataset\", files=[{\"name\": \"file1.csv\", \"url\": \"https://example.com/file1.csv\"}]) print(response) method create_service create_service( plan_did: str, service_type: str, name: str, description: str, service_charge_type: str, auth_type: str, amount_of_credits: int = 1, min_credits_to_charge: Optional[int] = 1, max_credits_to_charge: Optional[int] = 1, username: Optional[str] = None, password: Optional[str] = None, token: Optional[str] = None, endpoints: Optional[List[dict]] = None, open_endpoints: Optional[List[str]] = [], open_api_url: Optional[str] = None, integration: Optional[str] = None, sample_link: Optional[str] = None, api_description: Optional[str] = None, tags: Optional[List[str]] = None, is_nevermined_hosted: Optional[bool] = None, implements_query_protocol: Optional[bool] = None, query_protocol_version: Optional[str] = None, service_host: Optional[str] = None ) \u2192 CreateAssetResultDto It creates a new AI Agent or Service on Nevermined. The agent/service must be associated to a Payment Plan. Users that are subscribers of a payment plan can access the agent/service. Depending on the Payment Plan and the configuration of the agent/service, the usage of the agent/service will consume credits. When the plan expires (because the time is over or the credits are consumed), the user needs to renew the plan to continue using the agent/service. This method is oriented to AI Builders https://docs.nevermined.app/docs/tutorials/builders/register-agent Args: plan_did (str): The DID of the plan. service_type (str): The type of the service. Options: 'service', 'agent', 'assistant' name (str): The name of the service. description (str): The description of the service. service_charge_type (str): The charge type of the service. Options: 'fixed', 'dynamic' auth_type (str): The authentication type of the service. Options: 'none', 'basic', 'oauth' amount_of_credits (int): The amount of credits for the service. min_credits_to_charge (int, optional): The minimum credits to charge for the service. Only required for dynamic services. max_credits_to_charge (int, optional): The maximum credits to charge for the service. Only required for dynamic services. username (str, optional): The username for authentication. password (str, optional): The password for authentication. token (str, optional): The token for authentication. endpoints (List[Dict[str, str]], optional): The endpoints of the service. open_endpoints (List[str], optional): The open endpoints of the service. open_api_url (str, optional): The OpenAPI URL of the service. integration (str, optional): The integration type of the service. sample_link (str, optional): The sample link of the service. api_description (str, optional): The API description of the service. tags (List[str], optional): The tags associated with the service. is_nevermined_hosted (bool, optional): Indicates if the service is hosted by Nevermined. implements_query_protocol (bool, optional): Indicates if the service implements the query protocol. query_protocol_version (str, optional): The version of the query protocol implemented by the service. service_host (str, optional): The host of the service. Returns: CreateAssetResultDto : The result of the creation operation. Raises: HTTPError : If the API call fails. Example: response = your_instance.create_service(plan_did=\"did:nv:abc123\", service_type=\"service\", name=\"My Service\", description=\"A sample service\", service_charge_type=\"fixed\", auth_type=\"none\") print(response) method create_time_plan create_time_plan( name: str, description: str, price: int, token_address: str, duration: Optional[int] = 0, tags: Optional[List[str]] = None ) \u2192 CreateAssetResultDto It allows to an AI Builder to create a Payment Plan on Nevermined based on Time. A Nevermined Time Plan limits the access by the a specific amount of time. With them, AI Builders can specify the duration of the Payment Plan (1 month, 1 year, etc.). When the time period is over, the plan automatically expires and the user needs to renew it. This method is oriented to AI Builders https://docs.nevermined.app/docs/tutorials/builders/create-plan Args: name (str): The name of the plan. description (str): The description of the plan. price (int): The price of the plan. token_address (str): The token address. duration (int, optional): The duration of the plan in days. If not provided, the plan will be valid forever. tags (List[str], optional): The tags associated with the plan. Returns: CreateAssetResultDto : The result of the creation operation. Raises: HTTPError : If the API call fails. Example: response = your_instance.create_time_plan(name=\"Yearly Plan\", description=\"Annual plan\", price=1200, token_address=\"0x5678\", duration=365, tags=[\"yearly\", \"premium\"]) print(response) method download_file download_file( file_did: str, destination: str, agreement_id: Optional[str] = None ) \u2192 DownloadFileResultDto Downloads the file. Args: file_did (str): The DID of the file. agreement_id (str, optional): The agreement ID. destination str : The destination of the file. Returns: Response : The url of the file. Returns: DownloadFileResultDto : The result of the download operation. Raises: HTTPError : If the API call fails. Example: response = your_instance.download_file(file_did=\"did:nv:7e38d39405445ab3e5435d8c1c6653a00ddc425ba629789f58fbefccaa5e5a5d\", destination=\"/tmp\") print(response) method get_asset_ddo get_asset_ddo(did: str) Get the Metadata (aka Decentralized Document or DDO) for a given asset identifier (DID). https://docs.nevermined.io/docs/architecture/specs/Spec-DID https://docs.nevermined.io/docs/architecture/specs/Spec-METADATA Args: did (str): The unique identifier (aka DID) of the asset (payment plan, agent, file, etc). Returns: Response : The response from the API call. method get_checkout_plan get_checkout_plan(plan_did: str) Gets the checkout plan. Args: plan_did (str): The DID of the plan. Returns: Response : The url of the checkout plan. method get_file_details_url get_file_details_url(file_did: str) Gets the file details. Args: file_did (str): The DID of the file. Returns: Response : The url of the file details. method get_plan_associated_files get_plan_associated_files(plan_did: str) Get array of files DIDs associated with a payment plan. Args: plan_did (str): The DID of the plan. Returns: Response : List of DIDs of the associated files. method get_plan_associated_services get_plan_associated_services(plan_did: str) Get array of services/agent DIDs associated with a payment plan. Args: plan_did (str): The DID of the plan. Returns: Response : List of DIDs of the associated services. method get_plan_balance get_plan_balance(plan_did: str, account_address: str) \u2192 BalanceResultDto Get the balance of an account for a Payment Plan. Args: plan_did (str): The DID of the plan. account_address (str): The account address. Returns: BalanceResultDto : The response from the API call formatted as a BalanceResultDto. Raises: HTTPError : If the API call fails. Example: response = your_instance.get_plan_balance(plan_did=\"did:example:123456\", account_address=\"0xABC123\") response.raise_for_status() balance = BalanceResultDto.model_validate(response.json()) print(balance) Expected Response: { \"planType\": \"credits\", \"isOwner\": True, \"isSubscriptor\": True, \"balance\": 10000000 } method get_plan_details_url get_plan_details_url(plan_did: str) Gets the plan details. Args: plan_did (str): The DID of the plan. Returns: Response : The url of the plan details. method get_service_details_url get_service_details_url(service_did: str) Gets the service details. Args: service_did (str): The DID of the service. Returns: Response : The url of the service details. method get_service_token get_service_token(service_did: str) \u2192 ServiceTokenResultDto Get the required configuration for accessing a remote service agent. This configuration includes: - The JWT access token - The Proxy url that can be used to query the agent/service. Args: service_did (str): The DID of the service. Returns: ServiceTokenResultDto : The result of the creation operation. Raises: HTTPError : If the API call fails. Example: response = your_instance.get_service_token(service_did=\"did:nv:xyz789\") print(response) method mint_credits mint_credits(plan_did: str, amount: str, receiver: str) \u2192 MintResultDto Mints the credits associated with a plan and sends them to the receiver. Args: plan_did (str): The DID of the plan. amount (str): The amount of credits to mint. receiver (str): The receiver address of the credits. Returns: MintResultDto : The result of the minting operation. Raises: HTTPError : If the API call fails. Example: response = your_instance.mint_credits(plan_did=\"did:nv:e405a91e3152be1430c5d0607ebdf9236c19f34bfba0320798d81ba5f5e3e3a5\", amount=\"12\", receiver=\"0x4fe3e7d42fA83be4E8cF03451Ac3F25980a73fF6\") print(response) method order_plan order_plan( plan_did: str, agreementId: Optional[str] = None ) \u2192 OrderPlanResultDto Orders a Payment Plan. The user needs to have enough balance in the token selected by the owner of the Payment Plan. The payment is done using Crypto. Payments using Fiat can be done via the Nevermined App. Args: plan_did (str): The DID of the plan. agreementId (str, optional): The agreement ID. Returns: OrderPlanResultDto : The result of the order operation, containing the agreement ID and success status. Raises: HTTPError : If the API call fails. Example: response = your_instance.order_plan(plan_did=\"did:nv:a0079b517e580d430916924f1940b764e17c31e368c509483426f8c2ac2e7116\") print(response) This file was automatically generated via lazydocs .","title":"Payments"},{"location":"payments/#module-payments","text":"","title":"module payments"},{"location":"payments/#class-payments","text":"A class representing a payment system. Attributes: nvm_api_key (str): The nvm api key for authentication. environment (Environment): The environment for the payment system. app_id (str, optional): The application ID. version (str, optional): The version of the payment system. ai_protocol (bool): Indicates if the AI protocol is enabled. headers (dict, optional): The headers for the payment system. web_socket_options (dict, optional): The web socket options for the payment system. Methods: - create_credits_plan : Creates a new credits plan. - create_time_plan : Creates a new time plan. - create_service : Creates a new service. - create_file : Creates a new file. - order_plan : Orders the plan. - get_asset_ddo : Gets the asset DDO. - get_plan_balance : Gets the plan balance. - get_service_token : Gets the service token. - get_plan_associated_services : Gets the plan associated services. - get_plan_associated_files : Gets the plan associated files. - get_plan_details : Gets the plan details. - get_service_details : Gets the service details. - get_file_details : Gets the file details. - get_checkout_plan : Gets the checkout plan. - download_file : Downloads the file. - mint_credits : Mints the credits associated to a plan and send to the receiver. - burn_credits : Burns credits associated to a plan that you own. - ai_protocol : The AI Query API.","title":"class Payments"},{"location":"payments/#method-__init__","text":"__init__( nvm_api_key: str, environment: Environment, app_id: Optional[str] = None, version: Optional[str] = None, ai_protocol: bool = False, headers: Optional[dict] = None, web_socket_options: Optional[dict] = None )","title":"method __init__"},{"location":"payments/#method-burn_credits","text":"burn_credits(plan_did: str, amount: str) \u2192 BurnResultDto Burn credits for a given Payment Plan DID. This method is only can be called by the owner of the Payment Plan. Args: plan_did (str): The DID of the plan. amount (str): The amount of credits to burn. Returns: BurnResultDto : The result of the burning operation. Raises: HTTPError : If the API call fails. Example: response = your_instance.burn_credits(plan_did=\"did:nv:e405a91e3152be1430c5d0607ebdf9236c19f34bfba0320798d81ba5f5e3e3a5\", amount=\"12\") print(response)","title":"method burn_credits"},{"location":"payments/#method-create_credits_plan","text":"create_credits_plan( name: str, description: str, price: int, token_address: str, amount_of_credits: int, tags: Optional[List[str]] = None ) \u2192 CreateAssetResultDto It allows to an AI Builder to create a Payment Plan on Nevermined based on Credits. A Nevermined Credits Plan limits the access by the access/usage of the Plan. With them, AI Builders control the number of requests that can be made to an agent or service. Every time a user accesses any resouce associated to the Payment Plan, the usage consumes from a capped amount of credits. When the user consumes all the credits, the plan automatically expires and the user needs to top up to continue using the service. This method is oriented to AI Builders. https://docs.nevermined.app/docs/tutorials/builders/create-plan Args: name (str): The name of the plan. description (str): The description of the plan. price (int): The price of the plan. token_address (str): The token address. amount_of_credits (int): The amount of credits for the plan. tags (List[str], optional): The tags associated with the plan. Returns: CreateAssetResultDto : The result of the creation operation. Raises: HTTPError : If the API call fails. Example: response = your_instance.create_credits_plan(name=\"Basic Plan\", description=\"100 credits plan\", price=1, token_address=\"0x1234\", amount_of_credits=100, tags=[\"basic\"]) print(response)","title":"method create_credits_plan"},{"location":"payments/#method-create_file","text":"create_file( plan_did: str, asset_type: str, name: str, description: str, files: List[dict], data_schema: Optional[str] = None, sample_code: Optional[str] = None, files_format: Optional[str] = None, usage_example: Optional[str] = None, programming_language: Optional[str] = None, framework: Optional[str] = None, task: Optional[str] = None, training_details: Optional[str] = None, variations: Optional[str] = None, fine_tunable: Optional[bool] = None, amount_of_credits: Optional[int] = None, tags: Optional[List[str]] = None ) \u2192 CreateAssetResultDto It creates a new asset with file associated to it. The file asset must be associated to a Payment Plan. Users that are subscribers of a payment plan can download the files attached to it. Depending on the Payment Plan and the configuration of the file asset, the download will consume credits. When the plan expires (because the time is over or the credits are consumed), the user needs to renew the plan to continue downloading the files. This method is oriented to AI Builders https://docs.nevermined.app/docs/tutorials/builders/register-file-asset Args: plan_did (str): The DID of the plan. asset_type (str): The type of the asset. -> 'algorithm' | 'model' | 'dataset' | 'file' name (str): The name of the file. description (str): The description of the file. files (List[dict]): The files of the file. data_schema (str, optional): The data schema of the file. sample_code (str, optional): The sample code of the file. files_format (str, optional): The files format of the file. usage_example (str, optional): The usage example of the file. programming_language (str, optional): The programming language of the file. framework (str, optional): The framework of the file. task (str, optional): The task of the file. training_details (str, optional): The training details of the file. variations (str, optional): The variations of the file. fine_tunable (bool, optional): The fine tunable of the file. amount_of_credits (int, optional): The amount of credits for the file. tags (List[str], optional): The tags associated with the file. Returns: CreateAssetResultDto : The result of the creation operation. Raises: HTTPError : If the API call fails. Example: response = your_instance.create_file(plan_did=\"did:nv:xyz789\", asset_type=\"dataset\", name=\"Sample Dataset\", description=\"A sample dataset\", files=[{\"name\": \"file1.csv\", \"url\": \"https://example.com/file1.csv\"}]) print(response)","title":"method create_file"},{"location":"payments/#method-create_service","text":"create_service( plan_did: str, service_type: str, name: str, description: str, service_charge_type: str, auth_type: str, amount_of_credits: int = 1, min_credits_to_charge: Optional[int] = 1, max_credits_to_charge: Optional[int] = 1, username: Optional[str] = None, password: Optional[str] = None, token: Optional[str] = None, endpoints: Optional[List[dict]] = None, open_endpoints: Optional[List[str]] = [], open_api_url: Optional[str] = None, integration: Optional[str] = None, sample_link: Optional[str] = None, api_description: Optional[str] = None, tags: Optional[List[str]] = None, is_nevermined_hosted: Optional[bool] = None, implements_query_protocol: Optional[bool] = None, query_protocol_version: Optional[str] = None, service_host: Optional[str] = None ) \u2192 CreateAssetResultDto It creates a new AI Agent or Service on Nevermined. The agent/service must be associated to a Payment Plan. Users that are subscribers of a payment plan can access the agent/service. Depending on the Payment Plan and the configuration of the agent/service, the usage of the agent/service will consume credits. When the plan expires (because the time is over or the credits are consumed), the user needs to renew the plan to continue using the agent/service. This method is oriented to AI Builders https://docs.nevermined.app/docs/tutorials/builders/register-agent Args: plan_did (str): The DID of the plan. service_type (str): The type of the service. Options: 'service', 'agent', 'assistant' name (str): The name of the service. description (str): The description of the service. service_charge_type (str): The charge type of the service. Options: 'fixed', 'dynamic' auth_type (str): The authentication type of the service. Options: 'none', 'basic', 'oauth' amount_of_credits (int): The amount of credits for the service. min_credits_to_charge (int, optional): The minimum credits to charge for the service. Only required for dynamic services. max_credits_to_charge (int, optional): The maximum credits to charge for the service. Only required for dynamic services. username (str, optional): The username for authentication. password (str, optional): The password for authentication. token (str, optional): The token for authentication. endpoints (List[Dict[str, str]], optional): The endpoints of the service. open_endpoints (List[str], optional): The open endpoints of the service. open_api_url (str, optional): The OpenAPI URL of the service. integration (str, optional): The integration type of the service. sample_link (str, optional): The sample link of the service. api_description (str, optional): The API description of the service. tags (List[str], optional): The tags associated with the service. is_nevermined_hosted (bool, optional): Indicates if the service is hosted by Nevermined. implements_query_protocol (bool, optional): Indicates if the service implements the query protocol. query_protocol_version (str, optional): The version of the query protocol implemented by the service. service_host (str, optional): The host of the service. Returns: CreateAssetResultDto : The result of the creation operation. Raises: HTTPError : If the API call fails. Example: response = your_instance.create_service(plan_did=\"did:nv:abc123\", service_type=\"service\", name=\"My Service\", description=\"A sample service\", service_charge_type=\"fixed\", auth_type=\"none\") print(response)","title":"method create_service"},{"location":"payments/#method-create_time_plan","text":"create_time_plan( name: str, description: str, price: int, token_address: str, duration: Optional[int] = 0, tags: Optional[List[str]] = None ) \u2192 CreateAssetResultDto It allows to an AI Builder to create a Payment Plan on Nevermined based on Time. A Nevermined Time Plan limits the access by the a specific amount of time. With them, AI Builders can specify the duration of the Payment Plan (1 month, 1 year, etc.). When the time period is over, the plan automatically expires and the user needs to renew it. This method is oriented to AI Builders https://docs.nevermined.app/docs/tutorials/builders/create-plan Args: name (str): The name of the plan. description (str): The description of the plan. price (int): The price of the plan. token_address (str): The token address. duration (int, optional): The duration of the plan in days. If not provided, the plan will be valid forever. tags (List[str], optional): The tags associated with the plan. Returns: CreateAssetResultDto : The result of the creation operation. Raises: HTTPError : If the API call fails. Example: response = your_instance.create_time_plan(name=\"Yearly Plan\", description=\"Annual plan\", price=1200, token_address=\"0x5678\", duration=365, tags=[\"yearly\", \"premium\"]) print(response)","title":"method create_time_plan"},{"location":"payments/#method-download_file","text":"download_file( file_did: str, destination: str, agreement_id: Optional[str] = None ) \u2192 DownloadFileResultDto Downloads the file. Args: file_did (str): The DID of the file. agreement_id (str, optional): The agreement ID. destination str : The destination of the file. Returns: Response : The url of the file. Returns: DownloadFileResultDto : The result of the download operation. Raises: HTTPError : If the API call fails. Example: response = your_instance.download_file(file_did=\"did:nv:7e38d39405445ab3e5435d8c1c6653a00ddc425ba629789f58fbefccaa5e5a5d\", destination=\"/tmp\") print(response)","title":"method download_file"},{"location":"payments/#method-get_asset_ddo","text":"get_asset_ddo(did: str) Get the Metadata (aka Decentralized Document or DDO) for a given asset identifier (DID). https://docs.nevermined.io/docs/architecture/specs/Spec-DID https://docs.nevermined.io/docs/architecture/specs/Spec-METADATA Args: did (str): The unique identifier (aka DID) of the asset (payment plan, agent, file, etc). Returns: Response : The response from the API call.","title":"method get_asset_ddo"},{"location":"payments/#method-get_checkout_plan","text":"get_checkout_plan(plan_did: str) Gets the checkout plan. Args: plan_did (str): The DID of the plan. Returns: Response : The url of the checkout plan.","title":"method get_checkout_plan"},{"location":"payments/#method-get_file_details_url","text":"get_file_details_url(file_did: str) Gets the file details. Args: file_did (str): The DID of the file. Returns: Response : The url of the file details.","title":"method get_file_details_url"},{"location":"payments/#method-get_plan_associated_files","text":"get_plan_associated_files(plan_did: str) Get array of files DIDs associated with a payment plan. Args: plan_did (str): The DID of the plan. Returns: Response : List of DIDs of the associated files.","title":"method get_plan_associated_files"},{"location":"payments/#method-get_plan_associated_services","text":"get_plan_associated_services(plan_did: str) Get array of services/agent DIDs associated with a payment plan. Args: plan_did (str): The DID of the plan. Returns: Response : List of DIDs of the associated services.","title":"method get_plan_associated_services"},{"location":"payments/#method-get_plan_balance","text":"get_plan_balance(plan_did: str, account_address: str) \u2192 BalanceResultDto Get the balance of an account for a Payment Plan. Args: plan_did (str): The DID of the plan. account_address (str): The account address. Returns: BalanceResultDto : The response from the API call formatted as a BalanceResultDto. Raises: HTTPError : If the API call fails. Example: response = your_instance.get_plan_balance(plan_did=\"did:example:123456\", account_address=\"0xABC123\") response.raise_for_status() balance = BalanceResultDto.model_validate(response.json()) print(balance) Expected Response: { \"planType\": \"credits\", \"isOwner\": True, \"isSubscriptor\": True, \"balance\": 10000000 }","title":"method get_plan_balance"},{"location":"payments/#method-get_plan_details_url","text":"get_plan_details_url(plan_did: str) Gets the plan details. Args: plan_did (str): The DID of the plan. Returns: Response : The url of the plan details.","title":"method get_plan_details_url"},{"location":"payments/#method-get_service_details_url","text":"get_service_details_url(service_did: str) Gets the service details. Args: service_did (str): The DID of the service. Returns: Response : The url of the service details.","title":"method get_service_details_url"},{"location":"payments/#method-get_service_token","text":"get_service_token(service_did: str) \u2192 ServiceTokenResultDto Get the required configuration for accessing a remote service agent. This configuration includes: - The JWT access token - The Proxy url that can be used to query the agent/service. Args: service_did (str): The DID of the service. Returns: ServiceTokenResultDto : The result of the creation operation. Raises: HTTPError : If the API call fails. Example: response = your_instance.get_service_token(service_did=\"did:nv:xyz789\") print(response)","title":"method get_service_token"},{"location":"payments/#method-mint_credits","text":"mint_credits(plan_did: str, amount: str, receiver: str) \u2192 MintResultDto Mints the credits associated with a plan and sends them to the receiver. Args: plan_did (str): The DID of the plan. amount (str): The amount of credits to mint. receiver (str): The receiver address of the credits. Returns: MintResultDto : The result of the minting operation. Raises: HTTPError : If the API call fails. Example: response = your_instance.mint_credits(plan_did=\"did:nv:e405a91e3152be1430c5d0607ebdf9236c19f34bfba0320798d81ba5f5e3e3a5\", amount=\"12\", receiver=\"0x4fe3e7d42fA83be4E8cF03451Ac3F25980a73fF6\") print(response)","title":"method mint_credits"},{"location":"payments/#method-order_plan","text":"order_plan( plan_did: str, agreementId: Optional[str] = None ) \u2192 OrderPlanResultDto Orders a Payment Plan. The user needs to have enough balance in the token selected by the owner of the Payment Plan. The payment is done using Crypto. Payments using Fiat can be done via the Nevermined App. Args: plan_did (str): The DID of the plan. agreementId (str, optional): The agreement ID. Returns: OrderPlanResultDto : The result of the order operation, containing the agreement ID and success status. Raises: HTTPError : If the API call fails. Example: response = your_instance.order_plan(plan_did=\"did:nv:a0079b517e580d430916924f1940b764e17c31e368c509483426f8c2ac2e7116\") print(response) This file was automatically generated via lazydocs .","title":"method order_plan"},{"location":"utils/","text":"module utils function snake_to_camel snake_to_camel(name) Convert snake_case to camelCase. :param name: str :return: str This file was automatically generated via lazydocs .","title":"Utils"},{"location":"utils/#module-utils","text":"","title":"module utils"},{"location":"utils/#function-snake_to_camel","text":"snake_to_camel(name) Convert snake_case to camelCase. :param name: str :return: str This file was automatically generated via lazydocs .","title":"function snake_to_camel"}]}
\ No newline at end of file
+{"config":{"indexing":"full","lang":["en"],"min_search_length":3,"prebuild_index":false,"separator":"[\\s\\-]+"},"docs":[{"location":"","text":"API Overview Modules ai_query_api data_models environments nvm_backend payments utils Classes ai_query_api.AIQueryApi : Represents the AI Query API. data_models.AgentExecutionStatus : An enumeration. data_models.Artifact : Represents an artifact with a unique identifier and a URL reference. data_models.BalanceResultDto data_models.BurnResultDto data_models.CreateAssetResultDto data_models.DownloadFileResultDto data_models.ExecutionInput : Represents the input for a task, such as a query and additional parameters or artifacts. data_models.ExecutionOptions : Represents options for executing a task or step, such as input, status, and output. data_models.ExecutionOutput : Represents the output of a task or step execution. data_models.MintResultDto data_models.OrderPlanResultDto data_models.PlanType : An enumeration. data_models.ServiceTokenResultDto data_models.Step : Represents a step in the execution of a task. data_models.Task : Represents a task that an agent should execute, composed of multiple steps. environments.Environment : Enum class to define the different environments nvm_backend.BackendApiOptions : Represents the backend API options. nvm_backend.NVMBackendApi payments.Payments : A class representing a payment system. Functions utils.snake_to_camel : Convert snake_case to camelCase. This file was automatically generated via lazydocs .","title":"Overview"},{"location":"#api-overview","text":"","title":"API Overview"},{"location":"#modules","text":"ai_query_api data_models environments nvm_backend payments utils","title":"Modules"},{"location":"#classes","text":"ai_query_api.AIQueryApi : Represents the AI Query API. data_models.AgentExecutionStatus : An enumeration. data_models.Artifact : Represents an artifact with a unique identifier and a URL reference. data_models.BalanceResultDto data_models.BurnResultDto data_models.CreateAssetResultDto data_models.DownloadFileResultDto data_models.ExecutionInput : Represents the input for a task, such as a query and additional parameters or artifacts. data_models.ExecutionOptions : Represents options for executing a task or step, such as input, status, and output. data_models.ExecutionOutput : Represents the output of a task or step execution. data_models.MintResultDto data_models.OrderPlanResultDto data_models.PlanType : An enumeration. data_models.ServiceTokenResultDto data_models.Step : Represents a step in the execution of a task. data_models.Task : Represents a task that an agent should execute, composed of multiple steps. environments.Environment : Enum class to define the different environments nvm_backend.BackendApiOptions : Represents the backend API options. nvm_backend.NVMBackendApi payments.Payments : A class representing a payment system.","title":"Classes"},{"location":"#functions","text":"utils.snake_to_camel : Convert snake_case to camelCase. This file was automatically generated via lazydocs .","title":"Functions"},{"location":"ai_query_api/","text":"module ai_query_api Global Variables SEARCH_TASKS_ENDPOINT SEARCH_STEPS_ENDPOINT CREATE_STEPS_ENDPOINT UPDATE_STEP_ENDPOINT GET_AGENTS_ENDPOINT GET_BUILDER_STEPS_ENDPOINT GET_TASK_STEPS_ENDPOINT TASK_ENDPOINT GET_TASK_ENDPOINT class AIQueryApi Represents the AI Query API. Args: opts (BackendApiOptions): The backend API options Methods: - create_task : Creates a task for an agent to execute - create_steps : Creates steps for a task - update_step : Updates a step - search_tasks : Searches for tasks - get_task_with_steps : Gets a task with its steps - get_steps_from_task : Gets the steps from a task - get_steps : Gets the steps - get_tasks_from_agents : Gets the tasks from the agents - search_step : Searches for steps - get_step : Gets the details of a step 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: did (str): The DID of the service. task_id (str): The task ID. steps (Any): The steps to create. method create_task create_task(did: str, task: Any) 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: did (str): The DID of the service. task (Any): The task to create. 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) Get the details of a step. Args: did (str): The DID of the service. task_id (str): The task ID. step_id (str): The step ID. method get_steps get_steps( status: AgentExecutionStatus = , dids: List[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: status (AgentExecutionStatus): The status of the steps. dids (List[str]): The list of DIDs. 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: did (str): The DID of the service. task_id (str): The task ID. status (Optional[str]): The status of the steps. method get_task_with_steps get_task_with_steps(did: str, task_id: str) 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: did (str): The DID of the service. task_id (str): The task ID. 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: search_params (Any): The search parameters. method search_tasks search_tasks(search_params: Any) It searches tasks based on the search parameters associated to the user. Args: search_params (Any): The search parameters. 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: callback (Any): The callback function to be called when a new event is received. join_account_room (bool): If True, it will join the account room. join_agent_rooms (Optional[Union[str, List[str]]]): The agent rooms to join. subscribe_event_types (Optional[List[str]]): The event types to subscribe to. get_pending_events_on_subscribe (bool): If True, it will get the pending events on subscribe. method update_step update_step(did: str, task_id: str, step_id: str, step: Any) 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: did (str): The DID of the service. task_id (str): The task ID. step_id (str): The step ID. step (Any): The step object to update. https://docs.nevermined.io/docs/protocol/query-protocol#steps-attributes This file was automatically generated via lazydocs .","title":"Ai query api"},{"location":"ai_query_api/#module-ai_query_api","text":"","title":"module ai_query_api"},{"location":"ai_query_api/#global-variables","text":"SEARCH_TASKS_ENDPOINT SEARCH_STEPS_ENDPOINT CREATE_STEPS_ENDPOINT UPDATE_STEP_ENDPOINT GET_AGENTS_ENDPOINT GET_BUILDER_STEPS_ENDPOINT GET_TASK_STEPS_ENDPOINT TASK_ENDPOINT GET_TASK_ENDPOINT","title":"Global Variables"},{"location":"ai_query_api/#class-aiqueryapi","text":"Represents the AI Query API. Args: opts (BackendApiOptions): The backend API options Methods: - create_task : Creates a task for an agent to execute - create_steps : Creates steps for a task - update_step : Updates a step - search_tasks : Searches for tasks - get_task_with_steps : Gets a task with its steps - get_steps_from_task : Gets the steps from a task - get_steps : Gets the steps - get_tasks_from_agents : Gets the tasks from the agents - search_step : Searches for steps - get_step : Gets the details of a step","title":"class AIQueryApi"},{"location":"ai_query_api/#method-__init__","text":"__init__(opts: BackendApiOptions)","title":"method __init__"},{"location":"ai_query_api/#method-create_steps","text":"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: did (str): The DID of the service. task_id (str): The task ID. steps (Any): The steps to create.","title":"method create_steps"},{"location":"ai_query_api/#method-create_task","text":"create_task(did: str, task: Any) 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: did (str): The DID of the service. task (Any): The task to create. 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())","title":"method create_task"},{"location":"ai_query_api/#method-get_step","text":"get_step(step_id: str) Get the details of a step. Args: did (str): The DID of the service. task_id (str): The task ID. step_id (str): The step ID.","title":"method get_step"},{"location":"ai_query_api/#method-get_steps","text":"get_steps( status: AgentExecutionStatus = , dids: List[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: status (AgentExecutionStatus): The status of the steps. dids (List[str]): The list of DIDs.","title":"method get_steps"},{"location":"ai_query_api/#method-get_steps_from_task","text":"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: did (str): The DID of the service. task_id (str): The task ID. status (Optional[str]): The status of the steps.","title":"method get_steps_from_task"},{"location":"ai_query_api/#method-get_task_with_steps","text":"get_task_with_steps(did: str, task_id: str) 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: did (str): The DID of the service. task_id (str): The task ID.","title":"method get_task_with_steps"},{"location":"ai_query_api/#method-get_tasks_from_agents","text":"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","title":"method get_tasks_from_agents"},{"location":"ai_query_api/#method-search_step","text":"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: search_params (Any): The search parameters.","title":"method search_step"},{"location":"ai_query_api/#method-search_tasks","text":"search_tasks(search_params: Any) It searches tasks based on the search parameters associated to the user. Args: search_params (Any): The search parameters.","title":"method search_tasks"},{"location":"ai_query_api/#method-subscribe","text":"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: callback (Any): The callback function to be called when a new event is received. join_account_room (bool): If True, it will join the account room. join_agent_rooms (Optional[Union[str, List[str]]]): The agent rooms to join. subscribe_event_types (Optional[List[str]]): The event types to subscribe to. get_pending_events_on_subscribe (bool): If True, it will get the pending events on subscribe.","title":"method subscribe"},{"location":"ai_query_api/#method-update_step","text":"update_step(did: str, task_id: str, step_id: str, step: Any) 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: did (str): The DID of the service. task_id (str): The task ID. step_id (str): The step ID. step (Any): The step object to update. https://docs.nevermined.io/docs/protocol/query-protocol#steps-attributes This file was automatically generated via lazydocs .","title":"method update_step"},{"location":"data_models/","text":"module data_models Global Variables FIRST_STEP_NAME LAST_STEP_NAME class PlanType An enumeration. class BalanceResultDto property model_extra Get extra fields set during validation. Returns: A dictionary of extra fields, or None if config.extra is not set to \"allow\" . property model_fields_set Returns the set of fields that have been explicitly set on this model instance. Returns: A set of strings representing the fields that have been set, i.e. that were not filled from defaults. class MintResultDto property model_extra Get extra fields set during validation. Returns: A dictionary of extra fields, or None if config.extra is not set to \"allow\" . property model_fields_set Returns the set of fields that have been explicitly set on this model instance. Returns: A set of strings representing the fields that have been set, i.e. that were not filled from defaults. class BurnResultDto property model_extra Get extra fields set during validation. Returns: A dictionary of extra fields, or None if config.extra is not set to \"allow\" . property model_fields_set Returns the set of fields that have been explicitly set on this model instance. Returns: A set of strings representing the fields that have been set, i.e. that were not filled from defaults. class CreateAssetResultDto property model_extra Get extra fields set during validation. Returns: A dictionary of extra fields, or None if config.extra is not set to \"allow\" . property model_fields_set Returns the set of fields that have been explicitly set on this model instance. Returns: A set of strings representing the fields that have been set, i.e. that were not filled from defaults. class DownloadFileResultDto property model_extra Get extra fields set during validation. Returns: A dictionary of extra fields, or None if config.extra is not set to \"allow\" . property model_fields_set Returns the set of fields that have been explicitly set on this model instance. Returns: A set of strings representing the fields that have been set, i.e. that were not filled from defaults. class OrderPlanResultDto property model_extra Get extra fields set during validation. Returns: A dictionary of extra fields, or None if config.extra is not set to \"allow\" . property model_fields_set Returns the set of fields that have been explicitly set on this model instance. Returns: A set of strings representing the fields that have been set, i.e. that were not filled from defaults. class ServiceTokenResultDto property model_extra Get extra fields set during validation. Returns: A dictionary of extra fields, or None if config.extra is not set to \"allow\" . property model_fields_set Returns the set of fields that have been explicitly set on this model instance. Returns: A set of strings representing the fields that have been set, i.e. that were not filled from defaults. class AgentExecutionStatus An enumeration. class Artifact Represents an artifact with a unique identifier and a URL reference. class ExecutionInput Represents the input for a task, such as a query and additional parameters or artifacts. class ExecutionOutput Represents the output of a task or step execution. class ExecutionOptions Represents options for executing a task or step, such as input, status, and output. class Step Represents a step in the execution of a task. class Task Represents a task that an agent should execute, composed of multiple steps. This file was automatically generated via lazydocs .","title":"Data models"},{"location":"data_models/#module-data_models","text":"","title":"module data_models"},{"location":"data_models/#global-variables","text":"FIRST_STEP_NAME LAST_STEP_NAME","title":"Global Variables"},{"location":"data_models/#class-plantype","text":"An enumeration.","title":"class PlanType"},{"location":"data_models/#class-balanceresultdto","text":"","title":"class BalanceResultDto"},{"location":"data_models/#property-model_extra","text":"Get extra fields set during validation. Returns: A dictionary of extra fields, or None if config.extra is not set to \"allow\" .","title":"property model_extra"},{"location":"data_models/#property-model_fields_set","text":"Returns the set of fields that have been explicitly set on this model instance. Returns: A set of strings representing the fields that have been set, i.e. that were not filled from defaults.","title":"property model_fields_set"},{"location":"data_models/#class-mintresultdto","text":"","title":"class MintResultDto"},{"location":"data_models/#property-model_extra_1","text":"Get extra fields set during validation. Returns: A dictionary of extra fields, or None if config.extra is not set to \"allow\" .","title":"property model_extra"},{"location":"data_models/#property-model_fields_set_1","text":"Returns the set of fields that have been explicitly set on this model instance. Returns: A set of strings representing the fields that have been set, i.e. that were not filled from defaults.","title":"property model_fields_set"},{"location":"data_models/#class-burnresultdto","text":"","title":"class BurnResultDto"},{"location":"data_models/#property-model_extra_2","text":"Get extra fields set during validation. Returns: A dictionary of extra fields, or None if config.extra is not set to \"allow\" .","title":"property model_extra"},{"location":"data_models/#property-model_fields_set_2","text":"Returns the set of fields that have been explicitly set on this model instance. Returns: A set of strings representing the fields that have been set, i.e. that were not filled from defaults.","title":"property model_fields_set"},{"location":"data_models/#class-createassetresultdto","text":"","title":"class CreateAssetResultDto"},{"location":"data_models/#property-model_extra_3","text":"Get extra fields set during validation. Returns: A dictionary of extra fields, or None if config.extra is not set to \"allow\" .","title":"property model_extra"},{"location":"data_models/#property-model_fields_set_3","text":"Returns the set of fields that have been explicitly set on this model instance. Returns: A set of strings representing the fields that have been set, i.e. that were not filled from defaults.","title":"property model_fields_set"},{"location":"data_models/#class-downloadfileresultdto","text":"","title":"class DownloadFileResultDto"},{"location":"data_models/#property-model_extra_4","text":"Get extra fields set during validation. Returns: A dictionary of extra fields, or None if config.extra is not set to \"allow\" .","title":"property model_extra"},{"location":"data_models/#property-model_fields_set_4","text":"Returns the set of fields that have been explicitly set on this model instance. Returns: A set of strings representing the fields that have been set, i.e. that were not filled from defaults.","title":"property model_fields_set"},{"location":"data_models/#class-orderplanresultdto","text":"","title":"class OrderPlanResultDto"},{"location":"data_models/#property-model_extra_5","text":"Get extra fields set during validation. Returns: A dictionary of extra fields, or None if config.extra is not set to \"allow\" .","title":"property model_extra"},{"location":"data_models/#property-model_fields_set_5","text":"Returns the set of fields that have been explicitly set on this model instance. Returns: A set of strings representing the fields that have been set, i.e. that were not filled from defaults.","title":"property model_fields_set"},{"location":"data_models/#class-servicetokenresultdto","text":"","title":"class ServiceTokenResultDto"},{"location":"data_models/#property-model_extra_6","text":"Get extra fields set during validation. Returns: A dictionary of extra fields, or None if config.extra is not set to \"allow\" .","title":"property model_extra"},{"location":"data_models/#property-model_fields_set_6","text":"Returns the set of fields that have been explicitly set on this model instance. Returns: A set of strings representing the fields that have been set, i.e. that were not filled from defaults.","title":"property model_fields_set"},{"location":"data_models/#class-agentexecutionstatus","text":"An enumeration.","title":"class AgentExecutionStatus"},{"location":"data_models/#class-artifact","text":"Represents an artifact with a unique identifier and a URL reference.","title":"class Artifact"},{"location":"data_models/#class-executioninput","text":"Represents the input for a task, such as a query and additional parameters or artifacts.","title":"class ExecutionInput"},{"location":"data_models/#class-executionoutput","text":"Represents the output of a task or step execution.","title":"class ExecutionOutput"},{"location":"data_models/#class-executionoptions","text":"Represents options for executing a task or step, such as input, status, and output.","title":"class ExecutionOptions"},{"location":"data_models/#class-step","text":"Represents a step in the execution of a task.","title":"class Step"},{"location":"data_models/#class-task","text":"Represents a task that an agent should execute, composed of multiple steps. This file was automatically generated via lazydocs .","title":"class Task"},{"location":"environments/","text":"module environments class Environment Enum class to define the different environments Attributes: local : Local environment appStaging : Staging environment appTesting : Testing environment appArbitrum : Arbitrum environment appPeaq : Peaq network This file was automatically generated via lazydocs .","title":"Environments"},{"location":"environments/#module-environments","text":"","title":"module environments"},{"location":"environments/#class-environment","text":"Enum class to define the different environments Attributes: local : Local environment appStaging : Staging environment appTesting : Testing environment appArbitrum : Arbitrum environment appPeaq : Peaq network This file was automatically generated via lazydocs .","title":"class Environment"},{"location":"nvm_backend/","text":"module nvm_backend class BackendApiOptions Represents the backend API options. Args: environment (Environment): The environment. api_key (Optional[str]): The Nevermined API Key. This key identify your user and is required to interact with the Nevermined API. You can get your API key by logging in to the Nevermined App. See https://docs.nevermined.app/docs/tutorials/integration/nvm-api-keys headers (Optional[Dict[str, str]]): Additional headers to send with the requests web_socket_options (Optional[Dict[str, Any]]): Configuration of the websocket connection method __init__ __init__( environment: Environment, api_key: Optional[str] = None, headers: Optional[Dict[str, str]] = None, web_socket_options: Optional[Dict[str, Any]] = None ) class NVMBackendApi method __init__ __init__(opts: BackendApiOptions) method connect_socket connect_socket() method delete delete(url: str, data: Any, headers: Optional[Dict[str, str]] = None) method disconnect disconnect() method disconnect_socket disconnect_socket() method get get(url: str, headers: Optional[Dict[str, str]] = None) method get_service_token get_service_token(service_did: str) \u2192 ServiceTokenResultDto Gets the service token. Args: service_did (str): The DID of the service. Returns: ServiceTokenResultDto : The result of the creation operation. Raises: HTTPError : If the API call fails. Example: response = your_instance.get_service_token(service_did=\"did:nv:xyz789\") print(response) method join_room join_room(join_account_room: bool, room_ids: Optional[str, List[str]] = None) method parse_headers parse_headers(additional_headers: dict[str, str]) \u2192 dict[str, str] method parse_url_to_backend parse_url_to_backend(uri: str) \u2192 str method parse_url_to_proxy parse_url_to_proxy(uri: str) \u2192 str method post post(url: str, data: Any, headers: Optional[Dict[str, str]] = None) method put put(url: str, data: Any, headers: Optional[Dict[str, str]] = None) This file was automatically generated via lazydocs .","title":"Nvm backend"},{"location":"nvm_backend/#module-nvm_backend","text":"","title":"module nvm_backend"},{"location":"nvm_backend/#class-backendapioptions","text":"Represents the backend API options. Args: environment (Environment): The environment. api_key (Optional[str]): The Nevermined API Key. This key identify your user and is required to interact with the Nevermined API. You can get your API key by logging in to the Nevermined App. See https://docs.nevermined.app/docs/tutorials/integration/nvm-api-keys headers (Optional[Dict[str, str]]): Additional headers to send with the requests web_socket_options (Optional[Dict[str, Any]]): Configuration of the websocket connection","title":"class BackendApiOptions"},{"location":"nvm_backend/#method-__init__","text":"__init__( environment: Environment, api_key: Optional[str] = None, headers: Optional[Dict[str, str]] = None, web_socket_options: Optional[Dict[str, Any]] = None )","title":"method __init__"},{"location":"nvm_backend/#class-nvmbackendapi","text":"","title":"class NVMBackendApi"},{"location":"nvm_backend/#method-__init___1","text":"__init__(opts: BackendApiOptions)","title":"method __init__"},{"location":"nvm_backend/#method-connect_socket","text":"connect_socket()","title":"method connect_socket"},{"location":"nvm_backend/#method-delete","text":"delete(url: str, data: Any, headers: Optional[Dict[str, str]] = None)","title":"method delete"},{"location":"nvm_backend/#method-disconnect","text":"disconnect()","title":"method disconnect"},{"location":"nvm_backend/#method-disconnect_socket","text":"disconnect_socket()","title":"method disconnect_socket"},{"location":"nvm_backend/#method-get","text":"get(url: str, headers: Optional[Dict[str, str]] = None)","title":"method get"},{"location":"nvm_backend/#method-get_service_token","text":"get_service_token(service_did: str) \u2192 ServiceTokenResultDto Gets the service token. Args: service_did (str): The DID of the service. Returns: ServiceTokenResultDto : The result of the creation operation. Raises: HTTPError : If the API call fails. Example: response = your_instance.get_service_token(service_did=\"did:nv:xyz789\") print(response)","title":"method get_service_token"},{"location":"nvm_backend/#method-join_room","text":"join_room(join_account_room: bool, room_ids: Optional[str, List[str]] = None)","title":"method join_room"},{"location":"nvm_backend/#method-parse_headers","text":"parse_headers(additional_headers: dict[str, str]) \u2192 dict[str, str]","title":"method parse_headers"},{"location":"nvm_backend/#method-parse_url_to_backend","text":"parse_url_to_backend(uri: str) \u2192 str","title":"method parse_url_to_backend"},{"location":"nvm_backend/#method-parse_url_to_proxy","text":"parse_url_to_proxy(uri: str) \u2192 str","title":"method parse_url_to_proxy"},{"location":"nvm_backend/#method-post","text":"post(url: str, data: Any, headers: Optional[Dict[str, str]] = None)","title":"method post"},{"location":"nvm_backend/#method-put","text":"put(url: str, data: Any, headers: Optional[Dict[str, str]] = None) This file was automatically generated via lazydocs .","title":"method put"},{"location":"payments/","text":"module payments class Payments A class representing a payment system. Attributes: nvm_api_key (str): The nvm api key for authentication. environment (Environment): The environment for the payment system. app_id (str, optional): The application ID. version (str, optional): The version of the payment system. ai_protocol (bool): Indicates if the AI protocol is enabled. headers (dict, optional): The headers for the payment system. web_socket_options (dict, optional): The web socket options for the payment system. Methods: - create_credits_plan : Creates a new credits plan. - create_time_plan : Creates a new time plan. - create_service : Creates a new service. - create_file : Creates a new file. - order_plan : Orders the plan. - get_asset_ddo : Gets the asset DDO. - get_plan_balance : Gets the plan balance. - get_service_token : Gets the service token. - get_plan_associated_services : Gets the plan associated services. - get_plan_associated_files : Gets the plan associated files. - get_plan_details : Gets the plan details. - get_service_details : Gets the service details. - get_file_details : Gets the file details. - get_checkout_plan : Gets the checkout plan. - download_file : Downloads the file. - mint_credits : Mints the credits associated to a plan and send to the receiver. - burn_credits : Burns credits associated to a plan that you own. - ai_protocol : The AI Query API. method __init__ __init__( nvm_api_key: str, environment: Environment, app_id: Optional[str] = None, version: Optional[str] = None, ai_protocol: bool = False, headers: Optional[dict] = None, web_socket_options: Optional[dict] = None ) method burn_credits burn_credits(plan_did: str, amount: str) \u2192 BurnResultDto Burn credits for a given Payment Plan DID. This method is only can be called by the owner of the Payment Plan. Args: plan_did (str): The DID of the plan. amount (str): The amount of credits to burn. Returns: BurnResultDto : The result of the burning operation. Raises: HTTPError : If the API call fails. Example: response = your_instance.burn_credits(plan_did=\"did:nv:e405a91e3152be1430c5d0607ebdf9236c19f34bfba0320798d81ba5f5e3e3a5\", amount=\"12\") print(response) method create_credits_plan create_credits_plan( name: str, description: str, price: int, token_address: str, amount_of_credits: int, tags: Optional[List[str]] = None ) \u2192 CreateAssetResultDto It allows to an AI Builder to create a Payment Plan on Nevermined based on Credits. A Nevermined Credits Plan limits the access by the access/usage of the Plan. With them, AI Builders control the number of requests that can be made to an agent or service. Every time a user accesses any resouce associated to the Payment Plan, the usage consumes from a capped amount of credits. When the user consumes all the credits, the plan automatically expires and the user needs to top up to continue using the service. This method is oriented to AI Builders. https://docs.nevermined.app/docs/tutorials/builders/create-plan Args: name (str): The name of the plan. description (str): The description of the plan. price (int): The price of the plan. token_address (str): The token address. amount_of_credits (int): The amount of credits for the plan. tags (List[str], optional): The tags associated with the plan. Returns: CreateAssetResultDto : The result of the creation operation. Raises: HTTPError : If the API call fails. Example: response = your_instance.create_credits_plan(name=\"Basic Plan\", description=\"100 credits plan\", price=1, token_address=\"0x1234\", amount_of_credits=100, tags=[\"basic\"]) print(response) method create_file create_file( plan_did: str, asset_type: str, name: str, description: str, files: List[dict], data_schema: Optional[str] = None, sample_code: Optional[str] = None, files_format: Optional[str] = None, usage_example: Optional[str] = None, programming_language: Optional[str] = None, framework: Optional[str] = None, task: Optional[str] = None, training_details: Optional[str] = None, variations: Optional[str] = None, fine_tunable: Optional[bool] = None, amount_of_credits: Optional[int] = None, tags: Optional[List[str]] = None ) \u2192 CreateAssetResultDto It creates a new asset with file associated to it. The file asset must be associated to a Payment Plan. Users that are subscribers of a payment plan can download the files attached to it. Depending on the Payment Plan and the configuration of the file asset, the download will consume credits. When the plan expires (because the time is over or the credits are consumed), the user needs to renew the plan to continue downloading the files. This method is oriented to AI Builders https://docs.nevermined.app/docs/tutorials/builders/register-file-asset Args: plan_did (str): The DID of the plan. asset_type (str): The type of the asset. -> 'algorithm' | 'model' | 'dataset' | 'file' name (str): The name of the file. description (str): The description of the file. files (List[dict]): The files of the file. data_schema (str, optional): The data schema of the file. sample_code (str, optional): The sample code of the file. files_format (str, optional): The files format of the file. usage_example (str, optional): The usage example of the file. programming_language (str, optional): The programming language of the file. framework (str, optional): The framework of the file. task (str, optional): The task of the file. training_details (str, optional): The training details of the file. variations (str, optional): The variations of the file. fine_tunable (bool, optional): The fine tunable of the file. amount_of_credits (int, optional): The amount of credits for the file. tags (List[str], optional): The tags associated with the file. Returns: CreateAssetResultDto : The result of the creation operation. Raises: HTTPError : If the API call fails. Example: response = your_instance.create_file(plan_did=\"did:nv:xyz789\", asset_type=\"dataset\", name=\"Sample Dataset\", description=\"A sample dataset\", files=[{\"name\": \"file1.csv\", \"url\": \"https://example.com/file1.csv\"}]) print(response) method create_service create_service( plan_did: str, service_type: str, name: str, description: str, service_charge_type: str, auth_type: str, amount_of_credits: int = 1, min_credits_to_charge: Optional[int] = 1, max_credits_to_charge: Optional[int] = 1, username: Optional[str] = None, password: Optional[str] = None, token: Optional[str] = None, endpoints: Optional[List[dict]] = None, open_endpoints: Optional[List[str]] = [], open_api_url: Optional[str] = None, integration: Optional[str] = None, sample_link: Optional[str] = None, api_description: Optional[str] = None, tags: Optional[List[str]] = None, is_nevermined_hosted: Optional[bool] = None, implements_query_protocol: Optional[bool] = None, query_protocol_version: Optional[str] = None, service_host: Optional[str] = None ) \u2192 CreateAssetResultDto It creates a new AI Agent or Service on Nevermined. The agent/service must be associated to a Payment Plan. Users that are subscribers of a payment plan can access the agent/service. Depending on the Payment Plan and the configuration of the agent/service, the usage of the agent/service will consume credits. When the plan expires (because the time is over or the credits are consumed), the user needs to renew the plan to continue using the agent/service. This method is oriented to AI Builders https://docs.nevermined.app/docs/tutorials/builders/register-agent Args: plan_did (str): The DID of the plan. service_type (str): The type of the service. Options: 'service', 'agent', 'assistant' name (str): The name of the service. description (str): The description of the service. service_charge_type (str): The charge type of the service. Options: 'fixed', 'dynamic' auth_type (str): The authentication type of the service. Options: 'none', 'basic', 'oauth' amount_of_credits (int): The amount of credits for the service. min_credits_to_charge (int, optional): The minimum credits to charge for the service. Only required for dynamic services. max_credits_to_charge (int, optional): The maximum credits to charge for the service. Only required for dynamic services. username (str, optional): The username for authentication. password (str, optional): The password for authentication. token (str, optional): The token for authentication. endpoints (List[Dict[str, str]], optional): The endpoints of the service. open_endpoints (List[str], optional): The open endpoints of the service. open_api_url (str, optional): The OpenAPI URL of the service. integration (str, optional): The integration type of the service. sample_link (str, optional): The sample link of the service. api_description (str, optional): The API description of the service. tags (List[str], optional): The tags associated with the service. is_nevermined_hosted (bool, optional): Indicates if the service is hosted by Nevermined. implements_query_protocol (bool, optional): Indicates if the service implements the query protocol. query_protocol_version (str, optional): The version of the query protocol implemented by the service. service_host (str, optional): The host of the service. Returns: CreateAssetResultDto : The result of the creation operation. Raises: HTTPError : If the API call fails. Example: response = your_instance.create_service(plan_did=\"did:nv:abc123\", service_type=\"service\", name=\"My Service\", description=\"A sample service\", service_charge_type=\"fixed\", auth_type=\"none\") print(response) method create_time_plan create_time_plan( name: str, description: str, price: int, token_address: str, duration: Optional[int] = 0, tags: Optional[List[str]] = None ) \u2192 CreateAssetResultDto It allows to an AI Builder to create a Payment Plan on Nevermined based on Time. A Nevermined Time Plan limits the access by the a specific amount of time. With them, AI Builders can specify the duration of the Payment Plan (1 month, 1 year, etc.). When the time period is over, the plan automatically expires and the user needs to renew it. This method is oriented to AI Builders https://docs.nevermined.app/docs/tutorials/builders/create-plan Args: name (str): The name of the plan. description (str): The description of the plan. price (int): The price of the plan. token_address (str): The token address. duration (int, optional): The duration of the plan in days. If not provided, the plan will be valid forever. tags (List[str], optional): The tags associated with the plan. Returns: CreateAssetResultDto : The result of the creation operation. Raises: HTTPError : If the API call fails. Example: response = your_instance.create_time_plan(name=\"Yearly Plan\", description=\"Annual plan\", price=1200, token_address=\"0x5678\", duration=365, tags=[\"yearly\", \"premium\"]) print(response) method download_file download_file( file_did: str, destination: str, agreement_id: Optional[str] = None ) \u2192 DownloadFileResultDto Downloads the file. Args: file_did (str): The DID of the file. agreement_id (str, optional): The agreement ID. destination str : The destination of the file. Returns: Response : The url of the file. Returns: DownloadFileResultDto : The result of the download operation. Raises: HTTPError : If the API call fails. Example: response = your_instance.download_file(file_did=\"did:nv:7e38d39405445ab3e5435d8c1c6653a00ddc425ba629789f58fbefccaa5e5a5d\", destination=\"/tmp\") print(response) method get_asset_ddo get_asset_ddo(did: str) Get the Metadata (aka Decentralized Document or DDO) for a given asset identifier (DID). https://docs.nevermined.io/docs/architecture/specs/Spec-DID https://docs.nevermined.io/docs/architecture/specs/Spec-METADATA Args: did (str): The unique identifier (aka DID) of the asset (payment plan, agent, file, etc). Returns: Response : The response from the API call. method get_checkout_plan get_checkout_plan(plan_did: str) Gets the checkout plan. Args: plan_did (str): The DID of the plan. Returns: Response : The url of the checkout plan. method get_file_details_url get_file_details_url(file_did: str) Gets the file details. Args: file_did (str): The DID of the file. Returns: Response : The url of the file details. method get_plan_associated_files get_plan_associated_files(plan_did: str) Get array of files DIDs associated with a payment plan. Args: plan_did (str): The DID of the plan. Returns: Response : List of DIDs of the associated files. method get_plan_associated_services get_plan_associated_services(plan_did: str) Get array of services/agent DIDs associated with a payment plan. Args: plan_did (str): The DID of the plan. Returns: Response : List of DIDs of the associated services. method get_plan_balance get_plan_balance(plan_did: str, account_address: str) \u2192 BalanceResultDto Get the balance of an account for a Payment Plan. Args: plan_did (str): The DID of the plan. account_address (str): The account address. Returns: BalanceResultDto : The response from the API call formatted as a BalanceResultDto. Raises: HTTPError : If the API call fails. Example: response = your_instance.get_plan_balance(plan_did=\"did:example:123456\", account_address=\"0xABC123\") response.raise_for_status() balance = BalanceResultDto.model_validate(response.json()) print(balance) Expected Response: { \"planType\": \"credits\", \"isOwner\": True, \"isSubscriptor\": True, \"balance\": 10000000 } method get_plan_details_url get_plan_details_url(plan_did: str) Gets the plan details. Args: plan_did (str): The DID of the plan. Returns: Response : The url of the plan details. method get_service_details_url get_service_details_url(service_did: str) Gets the service details. Args: service_did (str): The DID of the service. Returns: Response : The url of the service details. method get_service_token get_service_token(service_did: str) \u2192 ServiceTokenResultDto Get the required configuration for accessing a remote service agent. This configuration includes: - The JWT access token - The Proxy url that can be used to query the agent/service. Args: service_did (str): The DID of the service. Returns: ServiceTokenResultDto : The result of the creation operation. Raises: HTTPError : If the API call fails. Example: response = your_instance.get_service_token(service_did=\"did:nv:xyz789\") print(response) method mint_credits mint_credits(plan_did: str, amount: str, receiver: str) \u2192 MintResultDto Mints the credits associated with a plan and sends them to the receiver. Args: plan_did (str): The DID of the plan. amount (str): The amount of credits to mint. receiver (str): The receiver address of the credits. Returns: MintResultDto : The result of the minting operation. Raises: HTTPError : If the API call fails. Example: response = your_instance.mint_credits(plan_did=\"did:nv:e405a91e3152be1430c5d0607ebdf9236c19f34bfba0320798d81ba5f5e3e3a5\", amount=\"12\", receiver=\"0x4fe3e7d42fA83be4E8cF03451Ac3F25980a73fF6\") print(response) method order_plan order_plan( plan_did: str, agreementId: Optional[str] = None ) \u2192 OrderPlanResultDto Orders a Payment Plan. The user needs to have enough balance in the token selected by the owner of the Payment Plan. The payment is done using Crypto. Payments using Fiat can be done via the Nevermined App. Args: plan_did (str): The DID of the plan. agreementId (str, optional): The agreement ID. Returns: OrderPlanResultDto : The result of the order operation, containing the agreement ID and success status. Raises: HTTPError : If the API call fails. Example: response = your_instance.order_plan(plan_did=\"did:nv:a0079b517e580d430916924f1940b764e17c31e368c509483426f8c2ac2e7116\") print(response) This file was automatically generated via lazydocs .","title":"Payments"},{"location":"payments/#module-payments","text":"","title":"module payments"},{"location":"payments/#class-payments","text":"A class representing a payment system. Attributes: nvm_api_key (str): The nvm api key for authentication. environment (Environment): The environment for the payment system. app_id (str, optional): The application ID. version (str, optional): The version of the payment system. ai_protocol (bool): Indicates if the AI protocol is enabled. headers (dict, optional): The headers for the payment system. web_socket_options (dict, optional): The web socket options for the payment system. Methods: - create_credits_plan : Creates a new credits plan. - create_time_plan : Creates a new time plan. - create_service : Creates a new service. - create_file : Creates a new file. - order_plan : Orders the plan. - get_asset_ddo : Gets the asset DDO. - get_plan_balance : Gets the plan balance. - get_service_token : Gets the service token. - get_plan_associated_services : Gets the plan associated services. - get_plan_associated_files : Gets the plan associated files. - get_plan_details : Gets the plan details. - get_service_details : Gets the service details. - get_file_details : Gets the file details. - get_checkout_plan : Gets the checkout plan. - download_file : Downloads the file. - mint_credits : Mints the credits associated to a plan and send to the receiver. - burn_credits : Burns credits associated to a plan that you own. - ai_protocol : The AI Query API.","title":"class Payments"},{"location":"payments/#method-__init__","text":"__init__( nvm_api_key: str, environment: Environment, app_id: Optional[str] = None, version: Optional[str] = None, ai_protocol: bool = False, headers: Optional[dict] = None, web_socket_options: Optional[dict] = None )","title":"method __init__"},{"location":"payments/#method-burn_credits","text":"burn_credits(plan_did: str, amount: str) \u2192 BurnResultDto Burn credits for a given Payment Plan DID. This method is only can be called by the owner of the Payment Plan. Args: plan_did (str): The DID of the plan. amount (str): The amount of credits to burn. Returns: BurnResultDto : The result of the burning operation. Raises: HTTPError : If the API call fails. Example: response = your_instance.burn_credits(plan_did=\"did:nv:e405a91e3152be1430c5d0607ebdf9236c19f34bfba0320798d81ba5f5e3e3a5\", amount=\"12\") print(response)","title":"method burn_credits"},{"location":"payments/#method-create_credits_plan","text":"create_credits_plan( name: str, description: str, price: int, token_address: str, amount_of_credits: int, tags: Optional[List[str]] = None ) \u2192 CreateAssetResultDto It allows to an AI Builder to create a Payment Plan on Nevermined based on Credits. A Nevermined Credits Plan limits the access by the access/usage of the Plan. With them, AI Builders control the number of requests that can be made to an agent or service. Every time a user accesses any resouce associated to the Payment Plan, the usage consumes from a capped amount of credits. When the user consumes all the credits, the plan automatically expires and the user needs to top up to continue using the service. This method is oriented to AI Builders. https://docs.nevermined.app/docs/tutorials/builders/create-plan Args: name (str): The name of the plan. description (str): The description of the plan. price (int): The price of the plan. token_address (str): The token address. amount_of_credits (int): The amount of credits for the plan. tags (List[str], optional): The tags associated with the plan. Returns: CreateAssetResultDto : The result of the creation operation. Raises: HTTPError : If the API call fails. Example: response = your_instance.create_credits_plan(name=\"Basic Plan\", description=\"100 credits plan\", price=1, token_address=\"0x1234\", amount_of_credits=100, tags=[\"basic\"]) print(response)","title":"method create_credits_plan"},{"location":"payments/#method-create_file","text":"create_file( plan_did: str, asset_type: str, name: str, description: str, files: List[dict], data_schema: Optional[str] = None, sample_code: Optional[str] = None, files_format: Optional[str] = None, usage_example: Optional[str] = None, programming_language: Optional[str] = None, framework: Optional[str] = None, task: Optional[str] = None, training_details: Optional[str] = None, variations: Optional[str] = None, fine_tunable: Optional[bool] = None, amount_of_credits: Optional[int] = None, tags: Optional[List[str]] = None ) \u2192 CreateAssetResultDto It creates a new asset with file associated to it. The file asset must be associated to a Payment Plan. Users that are subscribers of a payment plan can download the files attached to it. Depending on the Payment Plan and the configuration of the file asset, the download will consume credits. When the plan expires (because the time is over or the credits are consumed), the user needs to renew the plan to continue downloading the files. This method is oriented to AI Builders https://docs.nevermined.app/docs/tutorials/builders/register-file-asset Args: plan_did (str): The DID of the plan. asset_type (str): The type of the asset. -> 'algorithm' | 'model' | 'dataset' | 'file' name (str): The name of the file. description (str): The description of the file. files (List[dict]): The files of the file. data_schema (str, optional): The data schema of the file. sample_code (str, optional): The sample code of the file. files_format (str, optional): The files format of the file. usage_example (str, optional): The usage example of the file. programming_language (str, optional): The programming language of the file. framework (str, optional): The framework of the file. task (str, optional): The task of the file. training_details (str, optional): The training details of the file. variations (str, optional): The variations of the file. fine_tunable (bool, optional): The fine tunable of the file. amount_of_credits (int, optional): The amount of credits for the file. tags (List[str], optional): The tags associated with the file. Returns: CreateAssetResultDto : The result of the creation operation. Raises: HTTPError : If the API call fails. Example: response = your_instance.create_file(plan_did=\"did:nv:xyz789\", asset_type=\"dataset\", name=\"Sample Dataset\", description=\"A sample dataset\", files=[{\"name\": \"file1.csv\", \"url\": \"https://example.com/file1.csv\"}]) print(response)","title":"method create_file"},{"location":"payments/#method-create_service","text":"create_service( plan_did: str, service_type: str, name: str, description: str, service_charge_type: str, auth_type: str, amount_of_credits: int = 1, min_credits_to_charge: Optional[int] = 1, max_credits_to_charge: Optional[int] = 1, username: Optional[str] = None, password: Optional[str] = None, token: Optional[str] = None, endpoints: Optional[List[dict]] = None, open_endpoints: Optional[List[str]] = [], open_api_url: Optional[str] = None, integration: Optional[str] = None, sample_link: Optional[str] = None, api_description: Optional[str] = None, tags: Optional[List[str]] = None, is_nevermined_hosted: Optional[bool] = None, implements_query_protocol: Optional[bool] = None, query_protocol_version: Optional[str] = None, service_host: Optional[str] = None ) \u2192 CreateAssetResultDto It creates a new AI Agent or Service on Nevermined. The agent/service must be associated to a Payment Plan. Users that are subscribers of a payment plan can access the agent/service. Depending on the Payment Plan and the configuration of the agent/service, the usage of the agent/service will consume credits. When the plan expires (because the time is over or the credits are consumed), the user needs to renew the plan to continue using the agent/service. This method is oriented to AI Builders https://docs.nevermined.app/docs/tutorials/builders/register-agent Args: plan_did (str): The DID of the plan. service_type (str): The type of the service. Options: 'service', 'agent', 'assistant' name (str): The name of the service. description (str): The description of the service. service_charge_type (str): The charge type of the service. Options: 'fixed', 'dynamic' auth_type (str): The authentication type of the service. Options: 'none', 'basic', 'oauth' amount_of_credits (int): The amount of credits for the service. min_credits_to_charge (int, optional): The minimum credits to charge for the service. Only required for dynamic services. max_credits_to_charge (int, optional): The maximum credits to charge for the service. Only required for dynamic services. username (str, optional): The username for authentication. password (str, optional): The password for authentication. token (str, optional): The token for authentication. endpoints (List[Dict[str, str]], optional): The endpoints of the service. open_endpoints (List[str], optional): The open endpoints of the service. open_api_url (str, optional): The OpenAPI URL of the service. integration (str, optional): The integration type of the service. sample_link (str, optional): The sample link of the service. api_description (str, optional): The API description of the service. tags (List[str], optional): The tags associated with the service. is_nevermined_hosted (bool, optional): Indicates if the service is hosted by Nevermined. implements_query_protocol (bool, optional): Indicates if the service implements the query protocol. query_protocol_version (str, optional): The version of the query protocol implemented by the service. service_host (str, optional): The host of the service. Returns: CreateAssetResultDto : The result of the creation operation. Raises: HTTPError : If the API call fails. Example: response = your_instance.create_service(plan_did=\"did:nv:abc123\", service_type=\"service\", name=\"My Service\", description=\"A sample service\", service_charge_type=\"fixed\", auth_type=\"none\") print(response)","title":"method create_service"},{"location":"payments/#method-create_time_plan","text":"create_time_plan( name: str, description: str, price: int, token_address: str, duration: Optional[int] = 0, tags: Optional[List[str]] = None ) \u2192 CreateAssetResultDto It allows to an AI Builder to create a Payment Plan on Nevermined based on Time. A Nevermined Time Plan limits the access by the a specific amount of time. With them, AI Builders can specify the duration of the Payment Plan (1 month, 1 year, etc.). When the time period is over, the plan automatically expires and the user needs to renew it. This method is oriented to AI Builders https://docs.nevermined.app/docs/tutorials/builders/create-plan Args: name (str): The name of the plan. description (str): The description of the plan. price (int): The price of the plan. token_address (str): The token address. duration (int, optional): The duration of the plan in days. If not provided, the plan will be valid forever. tags (List[str], optional): The tags associated with the plan. Returns: CreateAssetResultDto : The result of the creation operation. Raises: HTTPError : If the API call fails. Example: response = your_instance.create_time_plan(name=\"Yearly Plan\", description=\"Annual plan\", price=1200, token_address=\"0x5678\", duration=365, tags=[\"yearly\", \"premium\"]) print(response)","title":"method create_time_plan"},{"location":"payments/#method-download_file","text":"download_file( file_did: str, destination: str, agreement_id: Optional[str] = None ) \u2192 DownloadFileResultDto Downloads the file. Args: file_did (str): The DID of the file. agreement_id (str, optional): The agreement ID. destination str : The destination of the file. Returns: Response : The url of the file. Returns: DownloadFileResultDto : The result of the download operation. Raises: HTTPError : If the API call fails. Example: response = your_instance.download_file(file_did=\"did:nv:7e38d39405445ab3e5435d8c1c6653a00ddc425ba629789f58fbefccaa5e5a5d\", destination=\"/tmp\") print(response)","title":"method download_file"},{"location":"payments/#method-get_asset_ddo","text":"get_asset_ddo(did: str) Get the Metadata (aka Decentralized Document or DDO) for a given asset identifier (DID). https://docs.nevermined.io/docs/architecture/specs/Spec-DID https://docs.nevermined.io/docs/architecture/specs/Spec-METADATA Args: did (str): The unique identifier (aka DID) of the asset (payment plan, agent, file, etc). Returns: Response : The response from the API call.","title":"method get_asset_ddo"},{"location":"payments/#method-get_checkout_plan","text":"get_checkout_plan(plan_did: str) Gets the checkout plan. Args: plan_did (str): The DID of the plan. Returns: Response : The url of the checkout plan.","title":"method get_checkout_plan"},{"location":"payments/#method-get_file_details_url","text":"get_file_details_url(file_did: str) Gets the file details. Args: file_did (str): The DID of the file. Returns: Response : The url of the file details.","title":"method get_file_details_url"},{"location":"payments/#method-get_plan_associated_files","text":"get_plan_associated_files(plan_did: str) Get array of files DIDs associated with a payment plan. Args: plan_did (str): The DID of the plan. Returns: Response : List of DIDs of the associated files.","title":"method get_plan_associated_files"},{"location":"payments/#method-get_plan_associated_services","text":"get_plan_associated_services(plan_did: str) Get array of services/agent DIDs associated with a payment plan. Args: plan_did (str): The DID of the plan. Returns: Response : List of DIDs of the associated services.","title":"method get_plan_associated_services"},{"location":"payments/#method-get_plan_balance","text":"get_plan_balance(plan_did: str, account_address: str) \u2192 BalanceResultDto Get the balance of an account for a Payment Plan. Args: plan_did (str): The DID of the plan. account_address (str): The account address. Returns: BalanceResultDto : The response from the API call formatted as a BalanceResultDto. Raises: HTTPError : If the API call fails. Example: response = your_instance.get_plan_balance(plan_did=\"did:example:123456\", account_address=\"0xABC123\") response.raise_for_status() balance = BalanceResultDto.model_validate(response.json()) print(balance) Expected Response: { \"planType\": \"credits\", \"isOwner\": True, \"isSubscriptor\": True, \"balance\": 10000000 }","title":"method get_plan_balance"},{"location":"payments/#method-get_plan_details_url","text":"get_plan_details_url(plan_did: str) Gets the plan details. Args: plan_did (str): The DID of the plan. Returns: Response : The url of the plan details.","title":"method get_plan_details_url"},{"location":"payments/#method-get_service_details_url","text":"get_service_details_url(service_did: str) Gets the service details. Args: service_did (str): The DID of the service. Returns: Response : The url of the service details.","title":"method get_service_details_url"},{"location":"payments/#method-get_service_token","text":"get_service_token(service_did: str) \u2192 ServiceTokenResultDto Get the required configuration for accessing a remote service agent. This configuration includes: - The JWT access token - The Proxy url that can be used to query the agent/service. Args: service_did (str): The DID of the service. Returns: ServiceTokenResultDto : The result of the creation operation. Raises: HTTPError : If the API call fails. Example: response = your_instance.get_service_token(service_did=\"did:nv:xyz789\") print(response)","title":"method get_service_token"},{"location":"payments/#method-mint_credits","text":"mint_credits(plan_did: str, amount: str, receiver: str) \u2192 MintResultDto Mints the credits associated with a plan and sends them to the receiver. Args: plan_did (str): The DID of the plan. amount (str): The amount of credits to mint. receiver (str): The receiver address of the credits. Returns: MintResultDto : The result of the minting operation. Raises: HTTPError : If the API call fails. Example: response = your_instance.mint_credits(plan_did=\"did:nv:e405a91e3152be1430c5d0607ebdf9236c19f34bfba0320798d81ba5f5e3e3a5\", amount=\"12\", receiver=\"0x4fe3e7d42fA83be4E8cF03451Ac3F25980a73fF6\") print(response)","title":"method mint_credits"},{"location":"payments/#method-order_plan","text":"order_plan( plan_did: str, agreementId: Optional[str] = None ) \u2192 OrderPlanResultDto Orders a Payment Plan. The user needs to have enough balance in the token selected by the owner of the Payment Plan. The payment is done using Crypto. Payments using Fiat can be done via the Nevermined App. Args: plan_did (str): The DID of the plan. agreementId (str, optional): The agreement ID. Returns: OrderPlanResultDto : The result of the order operation, containing the agreement ID and success status. Raises: HTTPError : If the API call fails. Example: response = your_instance.order_plan(plan_did=\"did:nv:a0079b517e580d430916924f1940b764e17c31e368c509483426f8c2ac2e7116\") print(response) This file was automatically generated via lazydocs .","title":"method order_plan"},{"location":"utils/","text":"module utils function snake_to_camel snake_to_camel(name) Convert snake_case to camelCase. :param name: str :return: str This file was automatically generated via lazydocs .","title":"Utils"},{"location":"utils/#module-utils","text":"","title":"module utils"},{"location":"utils/#function-snake_to_camel","text":"snake_to_camel(name) Convert snake_case to camelCase. :param name: str :return: str This file was automatically generated via lazydocs .","title":"function snake_to_camel"}]}
\ No newline at end of file
diff --git a/tests/protocol_test.py b/tests/protocol_test.py
index 1756884..4a85a2f 100644
--- a/tests/protocol_test.py
+++ b/tests/protocol_test.py
@@ -124,7 +124,7 @@ async def test_AIQueryApi_create_task_in_plan_purchased(ai_query_api_build_fixtu
builder.ai_protocol.socket_client.on("_join-rooms_", on_join_rooms)
await asyncio.wait_for(room_joined_event.wait(), timeout=10)
- task = subscriber.ai_protocol.create_task(agent.did, {'query': 'sample_query', 'name': 'sample_task', 'additional_params': {'param1': 'value1', 'param2': 'value2'}})
+ task = subscriber.ai_protocol.create_task(agent.did, {'query': 'sample_query', 'name': 'sample_task'})
print('Task created:', task.json())
await asyncio.wait_for(response_event.wait(), timeout=120)
@@ -149,7 +149,7 @@ async def test_AIQueryApi_create_task_in_plan_purchased(ai_query_api_build_fixtu
with pytest.raises(Exception) as excinfo:
task = subscriber.ai_protocol.create_task(did=agent.did, task={})
exception_args = excinfo.value.args[0]
- assert exception_args['status'] == 401
+ assert exception_args['status'] == 400
# Disconnect both clients after test
await builder.ai_protocol.socket_client.disconnect()
From f20e8dfa9e6823531859ee9453e844da7e151bc5 Mon Sep 17 00:00:00 2001
From: enrique
Date: Fri, 18 Oct 2024 17:20:20 +0200
Subject: [PATCH 3/4] feat: update environments name
---
README.md | 2 +-
docs/environments.md | 6 +++---
payments_py/environments.py | 12 ++++++------
site/environments/index.html | 6 +++---
site/index.html | 2 +-
site/search/search_index.json | 2 +-
tests/payments_test.py | 4 ++--
tests/protocol_test.py | 12 ++++++------
8 files changed, 23 insertions(+), 23 deletions(-)
diff --git a/README.md b/README.md
index 748a24a..c2a7026 100644
--- a/README.md
+++ b/README.md
@@ -13,7 +13,7 @@ pip install nevermined/payments-py
```
-Payments(nvm_api_key=nvm_api_key, environment=Environment.appStaging, app_id="your_app_id", version="1.0.0")
+Payments(nvm_api_key=nvm_api_key, environment=Environment.staging, app_id="your_app_id", version="1.0.0")
```
diff --git a/docs/environments.md b/docs/environments.md
index 172f8d1..2ba9e92 100644
--- a/docs/environments.md
+++ b/docs/environments.md
@@ -21,9 +21,9 @@ Enum class to define the different environments
**Attributes:**
- `local`: Local environment
- - `appStaging`: Staging environment
- - `appTesting`: Testing environment
- - `appArbitrum`: Arbitrum environment
+ - `staging`: Staging environment
+ - `testing`: Testing environment
+ - `arbitrum`: Arbitrum environment
- `appPeaq`: Peaq network
diff --git a/payments_py/environments.py b/payments_py/environments.py
index 6bb188f..0a94ee9 100644
--- a/payments_py/environments.py
+++ b/payments_py/environments.py
@@ -6,15 +6,15 @@ class Environment(Enum):
Attributes:
local: Local environment
- appStaging: Staging environment
- appTesting: Testing environment
- appArbitrum: Arbitrum environment
+ staging: Staging environment
+ testing: Testing environment
+ arbitrum: Arbitrum environment
appPeaq: Peaq network
"""
local = {"frontend": "http://localhost:3000", "backend": "http://localhost:3200", "websocket": "ws://localhost:3200", "proxy": "http://localhost:3100"}
- appStaging = {"frontend": "https://staging.nevermined.app", "backend": "https://one-backend.staging.nevermined.app", "websocket": "wss://one-backend.staging.nevermined.app", "proxy": "https://proxy.staging.nevermined.app"}
- appTesting = {"frontend": "https://testing.nevermined.app", "backend": "https://one-backend.testing.nevermined.app", "websocket": "wss://one-backend.testing.nevermined.app", "proxy": "https://proxy.testing.nevermined.app"}
- appArbitrum = {"frontend": "https://nevermined.app", "backend": "https://one-backend.arbitrum.nevermined.app", "websocket": "wss://one-backend.arbitrum.nevermined.app", "proxy": "https://proxy.arbitrum.nevermined.app"}
+ staging = {"frontend": "https://staging.nevermined.app", "backend": "https://one-backend.staging.nevermined.app", "websocket": "wss://one-backend.staging.nevermined.app", "proxy": "https://proxy.staging.nevermined.app"}
+ testing = {"frontend": "https://testing.nevermined.app", "backend": "https://one-backend.testing.nevermined.app", "websocket": "wss://one-backend.testing.nevermined.app", "proxy": "https://proxy.testing.nevermined.app"}
+ arbitrum = {"frontend": "https://nevermined.app", "backend": "https://one-backend.arbitrum.nevermined.app", "websocket": "wss://one-backend.arbitrum.nevermined.app", "proxy": "https://proxy.arbitrum.nevermined.app"}
appPeaq = {"frontend": "https://peaq.nevermined.app", "backend": "https://one-backend.peaq.nevermined.app"}
# Define more environments as needed...
\ No newline at end of file
diff --git a/site/environments/index.html b/site/environments/index.html
index 52fd28a..4bfddc4 100644
--- a/site/environments/index.html
+++ b/site/environments/index.html
@@ -105,9 +105,9 @@ class Environment
Attributes:
local
: Local environment
-appStaging
: Staging environment
-appTesting
: Testing environment
-appArbitrum
: Arbitrum environment
+staging
: Staging environment
+testing
: Testing environment
+arbitrum
: Arbitrum environment
appPeaq
: Peaq network
diff --git a/site/index.html b/site/index.html
index eee9029..b00c454 100644
--- a/site/index.html
+++ b/site/index.html
@@ -187,5 +187,5 @@ Functions
diff --git a/site/search/search_index.json b/site/search/search_index.json
index 6c0c53c..49b7a7f 100644
--- a/site/search/search_index.json
+++ b/site/search/search_index.json
@@ -1 +1 @@
-{"config":{"indexing":"full","lang":["en"],"min_search_length":3,"prebuild_index":false,"separator":"[\\s\\-]+"},"docs":[{"location":"","text":"API Overview Modules ai_query_api data_models environments nvm_backend payments utils Classes ai_query_api.AIQueryApi : Represents the AI Query API. data_models.AgentExecutionStatus : An enumeration. data_models.Artifact : Represents an artifact with a unique identifier and a URL reference. data_models.BalanceResultDto data_models.BurnResultDto data_models.CreateAssetResultDto data_models.DownloadFileResultDto data_models.ExecutionInput : Represents the input for a task, such as a query and additional parameters or artifacts. data_models.ExecutionOptions : Represents options for executing a task or step, such as input, status, and output. data_models.ExecutionOutput : Represents the output of a task or step execution. data_models.MintResultDto data_models.OrderPlanResultDto data_models.PlanType : An enumeration. data_models.ServiceTokenResultDto data_models.Step : Represents a step in the execution of a task. data_models.Task : Represents a task that an agent should execute, composed of multiple steps. environments.Environment : Enum class to define the different environments nvm_backend.BackendApiOptions : Represents the backend API options. nvm_backend.NVMBackendApi payments.Payments : A class representing a payment system. Functions utils.snake_to_camel : Convert snake_case to camelCase. This file was automatically generated via lazydocs .","title":"Overview"},{"location":"#api-overview","text":"","title":"API Overview"},{"location":"#modules","text":"ai_query_api data_models environments nvm_backend payments utils","title":"Modules"},{"location":"#classes","text":"ai_query_api.AIQueryApi : Represents the AI Query API. data_models.AgentExecutionStatus : An enumeration. data_models.Artifact : Represents an artifact with a unique identifier and a URL reference. data_models.BalanceResultDto data_models.BurnResultDto data_models.CreateAssetResultDto data_models.DownloadFileResultDto data_models.ExecutionInput : Represents the input for a task, such as a query and additional parameters or artifacts. data_models.ExecutionOptions : Represents options for executing a task or step, such as input, status, and output. data_models.ExecutionOutput : Represents the output of a task or step execution. data_models.MintResultDto data_models.OrderPlanResultDto data_models.PlanType : An enumeration. data_models.ServiceTokenResultDto data_models.Step : Represents a step in the execution of a task. data_models.Task : Represents a task that an agent should execute, composed of multiple steps. environments.Environment : Enum class to define the different environments nvm_backend.BackendApiOptions : Represents the backend API options. nvm_backend.NVMBackendApi payments.Payments : A class representing a payment system.","title":"Classes"},{"location":"#functions","text":"utils.snake_to_camel : Convert snake_case to camelCase. This file was automatically generated via lazydocs .","title":"Functions"},{"location":"ai_query_api/","text":"module ai_query_api Global Variables SEARCH_TASKS_ENDPOINT SEARCH_STEPS_ENDPOINT CREATE_STEPS_ENDPOINT UPDATE_STEP_ENDPOINT GET_AGENTS_ENDPOINT GET_BUILDER_STEPS_ENDPOINT GET_TASK_STEPS_ENDPOINT TASK_ENDPOINT GET_TASK_ENDPOINT class AIQueryApi Represents the AI Query API. Args: opts (BackendApiOptions): The backend API options Methods: - create_task : Creates a task for an agent to execute - create_steps : Creates steps for a task - update_step : Updates a step - search_tasks : Searches for tasks - get_task_with_steps : Gets a task with its steps - get_steps_from_task : Gets the steps from a task - get_steps : Gets the steps - get_tasks_from_agents : Gets the tasks from the agents - search_step : Searches for steps - get_step : Gets the details of a step 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: did (str): The DID of the service. task_id (str): The task ID. steps (Any): The steps to create. method create_task create_task(did: str, task: Any) 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: did (str): The DID of the service. task (Any): The task to create. 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) Get the details of a step. Args: did (str): The DID of the service. task_id (str): The task ID. step_id (str): The step ID. method get_steps get_steps( status: AgentExecutionStatus = , dids: List[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: status (AgentExecutionStatus): The status of the steps. dids (List[str]): The list of DIDs. 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: did (str): The DID of the service. task_id (str): The task ID. status (Optional[str]): The status of the steps. method get_task_with_steps get_task_with_steps(did: str, task_id: str) 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: did (str): The DID of the service. task_id (str): The task ID. 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: search_params (Any): The search parameters. method search_tasks search_tasks(search_params: Any) It searches tasks based on the search parameters associated to the user. Args: search_params (Any): The search parameters. 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: callback (Any): The callback function to be called when a new event is received. join_account_room (bool): If True, it will join the account room. join_agent_rooms (Optional[Union[str, List[str]]]): The agent rooms to join. subscribe_event_types (Optional[List[str]]): The event types to subscribe to. get_pending_events_on_subscribe (bool): If True, it will get the pending events on subscribe. method update_step update_step(did: str, task_id: str, step_id: str, step: Any) 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: did (str): The DID of the service. task_id (str): The task ID. step_id (str): The step ID. step (Any): The step object to update. https://docs.nevermined.io/docs/protocol/query-protocol#steps-attributes This file was automatically generated via lazydocs .","title":"Ai query api"},{"location":"ai_query_api/#module-ai_query_api","text":"","title":"module ai_query_api"},{"location":"ai_query_api/#global-variables","text":"SEARCH_TASKS_ENDPOINT SEARCH_STEPS_ENDPOINT CREATE_STEPS_ENDPOINT UPDATE_STEP_ENDPOINT GET_AGENTS_ENDPOINT GET_BUILDER_STEPS_ENDPOINT GET_TASK_STEPS_ENDPOINT TASK_ENDPOINT GET_TASK_ENDPOINT","title":"Global Variables"},{"location":"ai_query_api/#class-aiqueryapi","text":"Represents the AI Query API. Args: opts (BackendApiOptions): The backend API options Methods: - create_task : Creates a task for an agent to execute - create_steps : Creates steps for a task - update_step : Updates a step - search_tasks : Searches for tasks - get_task_with_steps : Gets a task with its steps - get_steps_from_task : Gets the steps from a task - get_steps : Gets the steps - get_tasks_from_agents : Gets the tasks from the agents - search_step : Searches for steps - get_step : Gets the details of a step","title":"class AIQueryApi"},{"location":"ai_query_api/#method-__init__","text":"__init__(opts: BackendApiOptions)","title":"method __init__"},{"location":"ai_query_api/#method-create_steps","text":"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: did (str): The DID of the service. task_id (str): The task ID. steps (Any): The steps to create.","title":"method create_steps"},{"location":"ai_query_api/#method-create_task","text":"create_task(did: str, task: Any) 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: did (str): The DID of the service. task (Any): The task to create. 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())","title":"method create_task"},{"location":"ai_query_api/#method-get_step","text":"get_step(step_id: str) Get the details of a step. Args: did (str): The DID of the service. task_id (str): The task ID. step_id (str): The step ID.","title":"method get_step"},{"location":"ai_query_api/#method-get_steps","text":"get_steps( status: AgentExecutionStatus = , dids: List[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: status (AgentExecutionStatus): The status of the steps. dids (List[str]): The list of DIDs.","title":"method get_steps"},{"location":"ai_query_api/#method-get_steps_from_task","text":"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: did (str): The DID of the service. task_id (str): The task ID. status (Optional[str]): The status of the steps.","title":"method get_steps_from_task"},{"location":"ai_query_api/#method-get_task_with_steps","text":"get_task_with_steps(did: str, task_id: str) 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: did (str): The DID of the service. task_id (str): The task ID.","title":"method get_task_with_steps"},{"location":"ai_query_api/#method-get_tasks_from_agents","text":"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","title":"method get_tasks_from_agents"},{"location":"ai_query_api/#method-search_step","text":"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: search_params (Any): The search parameters.","title":"method search_step"},{"location":"ai_query_api/#method-search_tasks","text":"search_tasks(search_params: Any) It searches tasks based on the search parameters associated to the user. Args: search_params (Any): The search parameters.","title":"method search_tasks"},{"location":"ai_query_api/#method-subscribe","text":"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: callback (Any): The callback function to be called when a new event is received. join_account_room (bool): If True, it will join the account room. join_agent_rooms (Optional[Union[str, List[str]]]): The agent rooms to join. subscribe_event_types (Optional[List[str]]): The event types to subscribe to. get_pending_events_on_subscribe (bool): If True, it will get the pending events on subscribe.","title":"method subscribe"},{"location":"ai_query_api/#method-update_step","text":"update_step(did: str, task_id: str, step_id: str, step: Any) 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: did (str): The DID of the service. task_id (str): The task ID. step_id (str): The step ID. step (Any): The step object to update. https://docs.nevermined.io/docs/protocol/query-protocol#steps-attributes This file was automatically generated via lazydocs .","title":"method update_step"},{"location":"data_models/","text":"module data_models Global Variables FIRST_STEP_NAME LAST_STEP_NAME class PlanType An enumeration. class BalanceResultDto property model_extra Get extra fields set during validation. Returns: A dictionary of extra fields, or None if config.extra is not set to \"allow\" . property model_fields_set Returns the set of fields that have been explicitly set on this model instance. Returns: A set of strings representing the fields that have been set, i.e. that were not filled from defaults. class MintResultDto property model_extra Get extra fields set during validation. Returns: A dictionary of extra fields, or None if config.extra is not set to \"allow\" . property model_fields_set Returns the set of fields that have been explicitly set on this model instance. Returns: A set of strings representing the fields that have been set, i.e. that were not filled from defaults. class BurnResultDto property model_extra Get extra fields set during validation. Returns: A dictionary of extra fields, or None if config.extra is not set to \"allow\" . property model_fields_set Returns the set of fields that have been explicitly set on this model instance. Returns: A set of strings representing the fields that have been set, i.e. that were not filled from defaults. class CreateAssetResultDto property model_extra Get extra fields set during validation. Returns: A dictionary of extra fields, or None if config.extra is not set to \"allow\" . property model_fields_set Returns the set of fields that have been explicitly set on this model instance. Returns: A set of strings representing the fields that have been set, i.e. that were not filled from defaults. class DownloadFileResultDto property model_extra Get extra fields set during validation. Returns: A dictionary of extra fields, or None if config.extra is not set to \"allow\" . property model_fields_set Returns the set of fields that have been explicitly set on this model instance. Returns: A set of strings representing the fields that have been set, i.e. that were not filled from defaults. class OrderPlanResultDto property model_extra Get extra fields set during validation. Returns: A dictionary of extra fields, or None if config.extra is not set to \"allow\" . property model_fields_set Returns the set of fields that have been explicitly set on this model instance. Returns: A set of strings representing the fields that have been set, i.e. that were not filled from defaults. class ServiceTokenResultDto property model_extra Get extra fields set during validation. Returns: A dictionary of extra fields, or None if config.extra is not set to \"allow\" . property model_fields_set Returns the set of fields that have been explicitly set on this model instance. Returns: A set of strings representing the fields that have been set, i.e. that were not filled from defaults. class AgentExecutionStatus An enumeration. class Artifact Represents an artifact with a unique identifier and a URL reference. class ExecutionInput Represents the input for a task, such as a query and additional parameters or artifacts. class ExecutionOutput Represents the output of a task or step execution. class ExecutionOptions Represents options for executing a task or step, such as input, status, and output. class Step Represents a step in the execution of a task. class Task Represents a task that an agent should execute, composed of multiple steps. This file was automatically generated via lazydocs .","title":"Data models"},{"location":"data_models/#module-data_models","text":"","title":"module data_models"},{"location":"data_models/#global-variables","text":"FIRST_STEP_NAME LAST_STEP_NAME","title":"Global Variables"},{"location":"data_models/#class-plantype","text":"An enumeration.","title":"class PlanType"},{"location":"data_models/#class-balanceresultdto","text":"","title":"class BalanceResultDto"},{"location":"data_models/#property-model_extra","text":"Get extra fields set during validation. Returns: A dictionary of extra fields, or None if config.extra is not set to \"allow\" .","title":"property model_extra"},{"location":"data_models/#property-model_fields_set","text":"Returns the set of fields that have been explicitly set on this model instance. Returns: A set of strings representing the fields that have been set, i.e. that were not filled from defaults.","title":"property model_fields_set"},{"location":"data_models/#class-mintresultdto","text":"","title":"class MintResultDto"},{"location":"data_models/#property-model_extra_1","text":"Get extra fields set during validation. Returns: A dictionary of extra fields, or None if config.extra is not set to \"allow\" .","title":"property model_extra"},{"location":"data_models/#property-model_fields_set_1","text":"Returns the set of fields that have been explicitly set on this model instance. Returns: A set of strings representing the fields that have been set, i.e. that were not filled from defaults.","title":"property model_fields_set"},{"location":"data_models/#class-burnresultdto","text":"","title":"class BurnResultDto"},{"location":"data_models/#property-model_extra_2","text":"Get extra fields set during validation. Returns: A dictionary of extra fields, or None if config.extra is not set to \"allow\" .","title":"property model_extra"},{"location":"data_models/#property-model_fields_set_2","text":"Returns the set of fields that have been explicitly set on this model instance. Returns: A set of strings representing the fields that have been set, i.e. that were not filled from defaults.","title":"property model_fields_set"},{"location":"data_models/#class-createassetresultdto","text":"","title":"class CreateAssetResultDto"},{"location":"data_models/#property-model_extra_3","text":"Get extra fields set during validation. Returns: A dictionary of extra fields, or None if config.extra is not set to \"allow\" .","title":"property model_extra"},{"location":"data_models/#property-model_fields_set_3","text":"Returns the set of fields that have been explicitly set on this model instance. Returns: A set of strings representing the fields that have been set, i.e. that were not filled from defaults.","title":"property model_fields_set"},{"location":"data_models/#class-downloadfileresultdto","text":"","title":"class DownloadFileResultDto"},{"location":"data_models/#property-model_extra_4","text":"Get extra fields set during validation. Returns: A dictionary of extra fields, or None if config.extra is not set to \"allow\" .","title":"property model_extra"},{"location":"data_models/#property-model_fields_set_4","text":"Returns the set of fields that have been explicitly set on this model instance. Returns: A set of strings representing the fields that have been set, i.e. that were not filled from defaults.","title":"property model_fields_set"},{"location":"data_models/#class-orderplanresultdto","text":"","title":"class OrderPlanResultDto"},{"location":"data_models/#property-model_extra_5","text":"Get extra fields set during validation. Returns: A dictionary of extra fields, or None if config.extra is not set to \"allow\" .","title":"property model_extra"},{"location":"data_models/#property-model_fields_set_5","text":"Returns the set of fields that have been explicitly set on this model instance. Returns: A set of strings representing the fields that have been set, i.e. that were not filled from defaults.","title":"property model_fields_set"},{"location":"data_models/#class-servicetokenresultdto","text":"","title":"class ServiceTokenResultDto"},{"location":"data_models/#property-model_extra_6","text":"Get extra fields set during validation. Returns: A dictionary of extra fields, or None if config.extra is not set to \"allow\" .","title":"property model_extra"},{"location":"data_models/#property-model_fields_set_6","text":"Returns the set of fields that have been explicitly set on this model instance. Returns: A set of strings representing the fields that have been set, i.e. that were not filled from defaults.","title":"property model_fields_set"},{"location":"data_models/#class-agentexecutionstatus","text":"An enumeration.","title":"class AgentExecutionStatus"},{"location":"data_models/#class-artifact","text":"Represents an artifact with a unique identifier and a URL reference.","title":"class Artifact"},{"location":"data_models/#class-executioninput","text":"Represents the input for a task, such as a query and additional parameters or artifacts.","title":"class ExecutionInput"},{"location":"data_models/#class-executionoutput","text":"Represents the output of a task or step execution.","title":"class ExecutionOutput"},{"location":"data_models/#class-executionoptions","text":"Represents options for executing a task or step, such as input, status, and output.","title":"class ExecutionOptions"},{"location":"data_models/#class-step","text":"Represents a step in the execution of a task.","title":"class Step"},{"location":"data_models/#class-task","text":"Represents a task that an agent should execute, composed of multiple steps. This file was automatically generated via lazydocs .","title":"class Task"},{"location":"environments/","text":"module environments class Environment Enum class to define the different environments Attributes: local : Local environment appStaging : Staging environment appTesting : Testing environment appArbitrum : Arbitrum environment appPeaq : Peaq network This file was automatically generated via lazydocs .","title":"Environments"},{"location":"environments/#module-environments","text":"","title":"module environments"},{"location":"environments/#class-environment","text":"Enum class to define the different environments Attributes: local : Local environment appStaging : Staging environment appTesting : Testing environment appArbitrum : Arbitrum environment appPeaq : Peaq network This file was automatically generated via lazydocs .","title":"class Environment"},{"location":"nvm_backend/","text":"module nvm_backend class BackendApiOptions Represents the backend API options. Args: environment (Environment): The environment. api_key (Optional[str]): The Nevermined API Key. This key identify your user and is required to interact with the Nevermined API. You can get your API key by logging in to the Nevermined App. See https://docs.nevermined.app/docs/tutorials/integration/nvm-api-keys headers (Optional[Dict[str, str]]): Additional headers to send with the requests web_socket_options (Optional[Dict[str, Any]]): Configuration of the websocket connection method __init__ __init__( environment: Environment, api_key: Optional[str] = None, headers: Optional[Dict[str, str]] = None, web_socket_options: Optional[Dict[str, Any]] = None ) class NVMBackendApi method __init__ __init__(opts: BackendApiOptions) method connect_socket connect_socket() method delete delete(url: str, data: Any, headers: Optional[Dict[str, str]] = None) method disconnect disconnect() method disconnect_socket disconnect_socket() method get get(url: str, headers: Optional[Dict[str, str]] = None) method get_service_token get_service_token(service_did: str) \u2192 ServiceTokenResultDto Gets the service token. Args: service_did (str): The DID of the service. Returns: ServiceTokenResultDto : The result of the creation operation. Raises: HTTPError : If the API call fails. Example: response = your_instance.get_service_token(service_did=\"did:nv:xyz789\") print(response) method join_room join_room(join_account_room: bool, room_ids: Optional[str, List[str]] = None) method parse_headers parse_headers(additional_headers: dict[str, str]) \u2192 dict[str, str] method parse_url_to_backend parse_url_to_backend(uri: str) \u2192 str method parse_url_to_proxy parse_url_to_proxy(uri: str) \u2192 str method post post(url: str, data: Any, headers: Optional[Dict[str, str]] = None) method put put(url: str, data: Any, headers: Optional[Dict[str, str]] = None) This file was automatically generated via lazydocs .","title":"Nvm backend"},{"location":"nvm_backend/#module-nvm_backend","text":"","title":"module nvm_backend"},{"location":"nvm_backend/#class-backendapioptions","text":"Represents the backend API options. Args: environment (Environment): The environment. api_key (Optional[str]): The Nevermined API Key. This key identify your user and is required to interact with the Nevermined API. You can get your API key by logging in to the Nevermined App. See https://docs.nevermined.app/docs/tutorials/integration/nvm-api-keys headers (Optional[Dict[str, str]]): Additional headers to send with the requests web_socket_options (Optional[Dict[str, Any]]): Configuration of the websocket connection","title":"class BackendApiOptions"},{"location":"nvm_backend/#method-__init__","text":"__init__( environment: Environment, api_key: Optional[str] = None, headers: Optional[Dict[str, str]] = None, web_socket_options: Optional[Dict[str, Any]] = None )","title":"method __init__"},{"location":"nvm_backend/#class-nvmbackendapi","text":"","title":"class NVMBackendApi"},{"location":"nvm_backend/#method-__init___1","text":"__init__(opts: BackendApiOptions)","title":"method __init__"},{"location":"nvm_backend/#method-connect_socket","text":"connect_socket()","title":"method connect_socket"},{"location":"nvm_backend/#method-delete","text":"delete(url: str, data: Any, headers: Optional[Dict[str, str]] = None)","title":"method delete"},{"location":"nvm_backend/#method-disconnect","text":"disconnect()","title":"method disconnect"},{"location":"nvm_backend/#method-disconnect_socket","text":"disconnect_socket()","title":"method disconnect_socket"},{"location":"nvm_backend/#method-get","text":"get(url: str, headers: Optional[Dict[str, str]] = None)","title":"method get"},{"location":"nvm_backend/#method-get_service_token","text":"get_service_token(service_did: str) \u2192 ServiceTokenResultDto Gets the service token. Args: service_did (str): The DID of the service. Returns: ServiceTokenResultDto : The result of the creation operation. Raises: HTTPError : If the API call fails. Example: response = your_instance.get_service_token(service_did=\"did:nv:xyz789\") print(response)","title":"method get_service_token"},{"location":"nvm_backend/#method-join_room","text":"join_room(join_account_room: bool, room_ids: Optional[str, List[str]] = None)","title":"method join_room"},{"location":"nvm_backend/#method-parse_headers","text":"parse_headers(additional_headers: dict[str, str]) \u2192 dict[str, str]","title":"method parse_headers"},{"location":"nvm_backend/#method-parse_url_to_backend","text":"parse_url_to_backend(uri: str) \u2192 str","title":"method parse_url_to_backend"},{"location":"nvm_backend/#method-parse_url_to_proxy","text":"parse_url_to_proxy(uri: str) \u2192 str","title":"method parse_url_to_proxy"},{"location":"nvm_backend/#method-post","text":"post(url: str, data: Any, headers: Optional[Dict[str, str]] = None)","title":"method post"},{"location":"nvm_backend/#method-put","text":"put(url: str, data: Any, headers: Optional[Dict[str, str]] = None) This file was automatically generated via lazydocs .","title":"method put"},{"location":"payments/","text":"module payments class Payments A class representing a payment system. Attributes: nvm_api_key (str): The nvm api key for authentication. environment (Environment): The environment for the payment system. app_id (str, optional): The application ID. version (str, optional): The version of the payment system. ai_protocol (bool): Indicates if the AI protocol is enabled. headers (dict, optional): The headers for the payment system. web_socket_options (dict, optional): The web socket options for the payment system. Methods: - create_credits_plan : Creates a new credits plan. - create_time_plan : Creates a new time plan. - create_service : Creates a new service. - create_file : Creates a new file. - order_plan : Orders the plan. - get_asset_ddo : Gets the asset DDO. - get_plan_balance : Gets the plan balance. - get_service_token : Gets the service token. - get_plan_associated_services : Gets the plan associated services. - get_plan_associated_files : Gets the plan associated files. - get_plan_details : Gets the plan details. - get_service_details : Gets the service details. - get_file_details : Gets the file details. - get_checkout_plan : Gets the checkout plan. - download_file : Downloads the file. - mint_credits : Mints the credits associated to a plan and send to the receiver. - burn_credits : Burns credits associated to a plan that you own. - ai_protocol : The AI Query API. method __init__ __init__( nvm_api_key: str, environment: Environment, app_id: Optional[str] = None, version: Optional[str] = None, ai_protocol: bool = False, headers: Optional[dict] = None, web_socket_options: Optional[dict] = None ) method burn_credits burn_credits(plan_did: str, amount: str) \u2192 BurnResultDto Burn credits for a given Payment Plan DID. This method is only can be called by the owner of the Payment Plan. Args: plan_did (str): The DID of the plan. amount (str): The amount of credits to burn. Returns: BurnResultDto : The result of the burning operation. Raises: HTTPError : If the API call fails. Example: response = your_instance.burn_credits(plan_did=\"did:nv:e405a91e3152be1430c5d0607ebdf9236c19f34bfba0320798d81ba5f5e3e3a5\", amount=\"12\") print(response) method create_credits_plan create_credits_plan( name: str, description: str, price: int, token_address: str, amount_of_credits: int, tags: Optional[List[str]] = None ) \u2192 CreateAssetResultDto It allows to an AI Builder to create a Payment Plan on Nevermined based on Credits. A Nevermined Credits Plan limits the access by the access/usage of the Plan. With them, AI Builders control the number of requests that can be made to an agent or service. Every time a user accesses any resouce associated to the Payment Plan, the usage consumes from a capped amount of credits. When the user consumes all the credits, the plan automatically expires and the user needs to top up to continue using the service. This method is oriented to AI Builders. https://docs.nevermined.app/docs/tutorials/builders/create-plan Args: name (str): The name of the plan. description (str): The description of the plan. price (int): The price of the plan. token_address (str): The token address. amount_of_credits (int): The amount of credits for the plan. tags (List[str], optional): The tags associated with the plan. Returns: CreateAssetResultDto : The result of the creation operation. Raises: HTTPError : If the API call fails. Example: response = your_instance.create_credits_plan(name=\"Basic Plan\", description=\"100 credits plan\", price=1, token_address=\"0x1234\", amount_of_credits=100, tags=[\"basic\"]) print(response) method create_file create_file( plan_did: str, asset_type: str, name: str, description: str, files: List[dict], data_schema: Optional[str] = None, sample_code: Optional[str] = None, files_format: Optional[str] = None, usage_example: Optional[str] = None, programming_language: Optional[str] = None, framework: Optional[str] = None, task: Optional[str] = None, training_details: Optional[str] = None, variations: Optional[str] = None, fine_tunable: Optional[bool] = None, amount_of_credits: Optional[int] = None, tags: Optional[List[str]] = None ) \u2192 CreateAssetResultDto It creates a new asset with file associated to it. The file asset must be associated to a Payment Plan. Users that are subscribers of a payment plan can download the files attached to it. Depending on the Payment Plan and the configuration of the file asset, the download will consume credits. When the plan expires (because the time is over or the credits are consumed), the user needs to renew the plan to continue downloading the files. This method is oriented to AI Builders https://docs.nevermined.app/docs/tutorials/builders/register-file-asset Args: plan_did (str): The DID of the plan. asset_type (str): The type of the asset. -> 'algorithm' | 'model' | 'dataset' | 'file' name (str): The name of the file. description (str): The description of the file. files (List[dict]): The files of the file. data_schema (str, optional): The data schema of the file. sample_code (str, optional): The sample code of the file. files_format (str, optional): The files format of the file. usage_example (str, optional): The usage example of the file. programming_language (str, optional): The programming language of the file. framework (str, optional): The framework of the file. task (str, optional): The task of the file. training_details (str, optional): The training details of the file. variations (str, optional): The variations of the file. fine_tunable (bool, optional): The fine tunable of the file. amount_of_credits (int, optional): The amount of credits for the file. tags (List[str], optional): The tags associated with the file. Returns: CreateAssetResultDto : The result of the creation operation. Raises: HTTPError : If the API call fails. Example: response = your_instance.create_file(plan_did=\"did:nv:xyz789\", asset_type=\"dataset\", name=\"Sample Dataset\", description=\"A sample dataset\", files=[{\"name\": \"file1.csv\", \"url\": \"https://example.com/file1.csv\"}]) print(response) method create_service create_service( plan_did: str, service_type: str, name: str, description: str, service_charge_type: str, auth_type: str, amount_of_credits: int = 1, min_credits_to_charge: Optional[int] = 1, max_credits_to_charge: Optional[int] = 1, username: Optional[str] = None, password: Optional[str] = None, token: Optional[str] = None, endpoints: Optional[List[dict]] = None, open_endpoints: Optional[List[str]] = [], open_api_url: Optional[str] = None, integration: Optional[str] = None, sample_link: Optional[str] = None, api_description: Optional[str] = None, tags: Optional[List[str]] = None, is_nevermined_hosted: Optional[bool] = None, implements_query_protocol: Optional[bool] = None, query_protocol_version: Optional[str] = None, service_host: Optional[str] = None ) \u2192 CreateAssetResultDto It creates a new AI Agent or Service on Nevermined. The agent/service must be associated to a Payment Plan. Users that are subscribers of a payment plan can access the agent/service. Depending on the Payment Plan and the configuration of the agent/service, the usage of the agent/service will consume credits. When the plan expires (because the time is over or the credits are consumed), the user needs to renew the plan to continue using the agent/service. This method is oriented to AI Builders https://docs.nevermined.app/docs/tutorials/builders/register-agent Args: plan_did (str): The DID of the plan. service_type (str): The type of the service. Options: 'service', 'agent', 'assistant' name (str): The name of the service. description (str): The description of the service. service_charge_type (str): The charge type of the service. Options: 'fixed', 'dynamic' auth_type (str): The authentication type of the service. Options: 'none', 'basic', 'oauth' amount_of_credits (int): The amount of credits for the service. min_credits_to_charge (int, optional): The minimum credits to charge for the service. Only required for dynamic services. max_credits_to_charge (int, optional): The maximum credits to charge for the service. Only required for dynamic services. username (str, optional): The username for authentication. password (str, optional): The password for authentication. token (str, optional): The token for authentication. endpoints (List[Dict[str, str]], optional): The endpoints of the service. open_endpoints (List[str], optional): The open endpoints of the service. open_api_url (str, optional): The OpenAPI URL of the service. integration (str, optional): The integration type of the service. sample_link (str, optional): The sample link of the service. api_description (str, optional): The API description of the service. tags (List[str], optional): The tags associated with the service. is_nevermined_hosted (bool, optional): Indicates if the service is hosted by Nevermined. implements_query_protocol (bool, optional): Indicates if the service implements the query protocol. query_protocol_version (str, optional): The version of the query protocol implemented by the service. service_host (str, optional): The host of the service. Returns: CreateAssetResultDto : The result of the creation operation. Raises: HTTPError : If the API call fails. Example: response = your_instance.create_service(plan_did=\"did:nv:abc123\", service_type=\"service\", name=\"My Service\", description=\"A sample service\", service_charge_type=\"fixed\", auth_type=\"none\") print(response) method create_time_plan create_time_plan( name: str, description: str, price: int, token_address: str, duration: Optional[int] = 0, tags: Optional[List[str]] = None ) \u2192 CreateAssetResultDto It allows to an AI Builder to create a Payment Plan on Nevermined based on Time. A Nevermined Time Plan limits the access by the a specific amount of time. With them, AI Builders can specify the duration of the Payment Plan (1 month, 1 year, etc.). When the time period is over, the plan automatically expires and the user needs to renew it. This method is oriented to AI Builders https://docs.nevermined.app/docs/tutorials/builders/create-plan Args: name (str): The name of the plan. description (str): The description of the plan. price (int): The price of the plan. token_address (str): The token address. duration (int, optional): The duration of the plan in days. If not provided, the plan will be valid forever. tags (List[str], optional): The tags associated with the plan. Returns: CreateAssetResultDto : The result of the creation operation. Raises: HTTPError : If the API call fails. Example: response = your_instance.create_time_plan(name=\"Yearly Plan\", description=\"Annual plan\", price=1200, token_address=\"0x5678\", duration=365, tags=[\"yearly\", \"premium\"]) print(response) method download_file download_file( file_did: str, destination: str, agreement_id: Optional[str] = None ) \u2192 DownloadFileResultDto Downloads the file. Args: file_did (str): The DID of the file. agreement_id (str, optional): The agreement ID. destination str : The destination of the file. Returns: Response : The url of the file. Returns: DownloadFileResultDto : The result of the download operation. Raises: HTTPError : If the API call fails. Example: response = your_instance.download_file(file_did=\"did:nv:7e38d39405445ab3e5435d8c1c6653a00ddc425ba629789f58fbefccaa5e5a5d\", destination=\"/tmp\") print(response) method get_asset_ddo get_asset_ddo(did: str) Get the Metadata (aka Decentralized Document or DDO) for a given asset identifier (DID). https://docs.nevermined.io/docs/architecture/specs/Spec-DID https://docs.nevermined.io/docs/architecture/specs/Spec-METADATA Args: did (str): The unique identifier (aka DID) of the asset (payment plan, agent, file, etc). Returns: Response : The response from the API call. method get_checkout_plan get_checkout_plan(plan_did: str) Gets the checkout plan. Args: plan_did (str): The DID of the plan. Returns: Response : The url of the checkout plan. method get_file_details_url get_file_details_url(file_did: str) Gets the file details. Args: file_did (str): The DID of the file. Returns: Response : The url of the file details. method get_plan_associated_files get_plan_associated_files(plan_did: str) Get array of files DIDs associated with a payment plan. Args: plan_did (str): The DID of the plan. Returns: Response : List of DIDs of the associated files. method get_plan_associated_services get_plan_associated_services(plan_did: str) Get array of services/agent DIDs associated with a payment plan. Args: plan_did (str): The DID of the plan. Returns: Response : List of DIDs of the associated services. method get_plan_balance get_plan_balance(plan_did: str, account_address: str) \u2192 BalanceResultDto Get the balance of an account for a Payment Plan. Args: plan_did (str): The DID of the plan. account_address (str): The account address. Returns: BalanceResultDto : The response from the API call formatted as a BalanceResultDto. Raises: HTTPError : If the API call fails. Example: response = your_instance.get_plan_balance(plan_did=\"did:example:123456\", account_address=\"0xABC123\") response.raise_for_status() balance = BalanceResultDto.model_validate(response.json()) print(balance) Expected Response: { \"planType\": \"credits\", \"isOwner\": True, \"isSubscriptor\": True, \"balance\": 10000000 } method get_plan_details_url get_plan_details_url(plan_did: str) Gets the plan details. Args: plan_did (str): The DID of the plan. Returns: Response : The url of the plan details. method get_service_details_url get_service_details_url(service_did: str) Gets the service details. Args: service_did (str): The DID of the service. Returns: Response : The url of the service details. method get_service_token get_service_token(service_did: str) \u2192 ServiceTokenResultDto Get the required configuration for accessing a remote service agent. This configuration includes: - The JWT access token - The Proxy url that can be used to query the agent/service. Args: service_did (str): The DID of the service. Returns: ServiceTokenResultDto : The result of the creation operation. Raises: HTTPError : If the API call fails. Example: response = your_instance.get_service_token(service_did=\"did:nv:xyz789\") print(response) method mint_credits mint_credits(plan_did: str, amount: str, receiver: str) \u2192 MintResultDto Mints the credits associated with a plan and sends them to the receiver. Args: plan_did (str): The DID of the plan. amount (str): The amount of credits to mint. receiver (str): The receiver address of the credits. Returns: MintResultDto : The result of the minting operation. Raises: HTTPError : If the API call fails. Example: response = your_instance.mint_credits(plan_did=\"did:nv:e405a91e3152be1430c5d0607ebdf9236c19f34bfba0320798d81ba5f5e3e3a5\", amount=\"12\", receiver=\"0x4fe3e7d42fA83be4E8cF03451Ac3F25980a73fF6\") print(response) method order_plan order_plan( plan_did: str, agreementId: Optional[str] = None ) \u2192 OrderPlanResultDto Orders a Payment Plan. The user needs to have enough balance in the token selected by the owner of the Payment Plan. The payment is done using Crypto. Payments using Fiat can be done via the Nevermined App. Args: plan_did (str): The DID of the plan. agreementId (str, optional): The agreement ID. Returns: OrderPlanResultDto : The result of the order operation, containing the agreement ID and success status. Raises: HTTPError : If the API call fails. Example: response = your_instance.order_plan(plan_did=\"did:nv:a0079b517e580d430916924f1940b764e17c31e368c509483426f8c2ac2e7116\") print(response) This file was automatically generated via lazydocs .","title":"Payments"},{"location":"payments/#module-payments","text":"","title":"module payments"},{"location":"payments/#class-payments","text":"A class representing a payment system. Attributes: nvm_api_key (str): The nvm api key for authentication. environment (Environment): The environment for the payment system. app_id (str, optional): The application ID. version (str, optional): The version of the payment system. ai_protocol (bool): Indicates if the AI protocol is enabled. headers (dict, optional): The headers for the payment system. web_socket_options (dict, optional): The web socket options for the payment system. Methods: - create_credits_plan : Creates a new credits plan. - create_time_plan : Creates a new time plan. - create_service : Creates a new service. - create_file : Creates a new file. - order_plan : Orders the plan. - get_asset_ddo : Gets the asset DDO. - get_plan_balance : Gets the plan balance. - get_service_token : Gets the service token. - get_plan_associated_services : Gets the plan associated services. - get_plan_associated_files : Gets the plan associated files. - get_plan_details : Gets the plan details. - get_service_details : Gets the service details. - get_file_details : Gets the file details. - get_checkout_plan : Gets the checkout plan. - download_file : Downloads the file. - mint_credits : Mints the credits associated to a plan and send to the receiver. - burn_credits : Burns credits associated to a plan that you own. - ai_protocol : The AI Query API.","title":"class Payments"},{"location":"payments/#method-__init__","text":"__init__( nvm_api_key: str, environment: Environment, app_id: Optional[str] = None, version: Optional[str] = None, ai_protocol: bool = False, headers: Optional[dict] = None, web_socket_options: Optional[dict] = None )","title":"method __init__"},{"location":"payments/#method-burn_credits","text":"burn_credits(plan_did: str, amount: str) \u2192 BurnResultDto Burn credits for a given Payment Plan DID. This method is only can be called by the owner of the Payment Plan. Args: plan_did (str): The DID of the plan. amount (str): The amount of credits to burn. Returns: BurnResultDto : The result of the burning operation. Raises: HTTPError : If the API call fails. Example: response = your_instance.burn_credits(plan_did=\"did:nv:e405a91e3152be1430c5d0607ebdf9236c19f34bfba0320798d81ba5f5e3e3a5\", amount=\"12\") print(response)","title":"method burn_credits"},{"location":"payments/#method-create_credits_plan","text":"create_credits_plan( name: str, description: str, price: int, token_address: str, amount_of_credits: int, tags: Optional[List[str]] = None ) \u2192 CreateAssetResultDto It allows to an AI Builder to create a Payment Plan on Nevermined based on Credits. A Nevermined Credits Plan limits the access by the access/usage of the Plan. With them, AI Builders control the number of requests that can be made to an agent or service. Every time a user accesses any resouce associated to the Payment Plan, the usage consumes from a capped amount of credits. When the user consumes all the credits, the plan automatically expires and the user needs to top up to continue using the service. This method is oriented to AI Builders. https://docs.nevermined.app/docs/tutorials/builders/create-plan Args: name (str): The name of the plan. description (str): The description of the plan. price (int): The price of the plan. token_address (str): The token address. amount_of_credits (int): The amount of credits for the plan. tags (List[str], optional): The tags associated with the plan. Returns: CreateAssetResultDto : The result of the creation operation. Raises: HTTPError : If the API call fails. Example: response = your_instance.create_credits_plan(name=\"Basic Plan\", description=\"100 credits plan\", price=1, token_address=\"0x1234\", amount_of_credits=100, tags=[\"basic\"]) print(response)","title":"method create_credits_plan"},{"location":"payments/#method-create_file","text":"create_file( plan_did: str, asset_type: str, name: str, description: str, files: List[dict], data_schema: Optional[str] = None, sample_code: Optional[str] = None, files_format: Optional[str] = None, usage_example: Optional[str] = None, programming_language: Optional[str] = None, framework: Optional[str] = None, task: Optional[str] = None, training_details: Optional[str] = None, variations: Optional[str] = None, fine_tunable: Optional[bool] = None, amount_of_credits: Optional[int] = None, tags: Optional[List[str]] = None ) \u2192 CreateAssetResultDto It creates a new asset with file associated to it. The file asset must be associated to a Payment Plan. Users that are subscribers of a payment plan can download the files attached to it. Depending on the Payment Plan and the configuration of the file asset, the download will consume credits. When the plan expires (because the time is over or the credits are consumed), the user needs to renew the plan to continue downloading the files. This method is oriented to AI Builders https://docs.nevermined.app/docs/tutorials/builders/register-file-asset Args: plan_did (str): The DID of the plan. asset_type (str): The type of the asset. -> 'algorithm' | 'model' | 'dataset' | 'file' name (str): The name of the file. description (str): The description of the file. files (List[dict]): The files of the file. data_schema (str, optional): The data schema of the file. sample_code (str, optional): The sample code of the file. files_format (str, optional): The files format of the file. usage_example (str, optional): The usage example of the file. programming_language (str, optional): The programming language of the file. framework (str, optional): The framework of the file. task (str, optional): The task of the file. training_details (str, optional): The training details of the file. variations (str, optional): The variations of the file. fine_tunable (bool, optional): The fine tunable of the file. amount_of_credits (int, optional): The amount of credits for the file. tags (List[str], optional): The tags associated with the file. Returns: CreateAssetResultDto : The result of the creation operation. Raises: HTTPError : If the API call fails. Example: response = your_instance.create_file(plan_did=\"did:nv:xyz789\", asset_type=\"dataset\", name=\"Sample Dataset\", description=\"A sample dataset\", files=[{\"name\": \"file1.csv\", \"url\": \"https://example.com/file1.csv\"}]) print(response)","title":"method create_file"},{"location":"payments/#method-create_service","text":"create_service( plan_did: str, service_type: str, name: str, description: str, service_charge_type: str, auth_type: str, amount_of_credits: int = 1, min_credits_to_charge: Optional[int] = 1, max_credits_to_charge: Optional[int] = 1, username: Optional[str] = None, password: Optional[str] = None, token: Optional[str] = None, endpoints: Optional[List[dict]] = None, open_endpoints: Optional[List[str]] = [], open_api_url: Optional[str] = None, integration: Optional[str] = None, sample_link: Optional[str] = None, api_description: Optional[str] = None, tags: Optional[List[str]] = None, is_nevermined_hosted: Optional[bool] = None, implements_query_protocol: Optional[bool] = None, query_protocol_version: Optional[str] = None, service_host: Optional[str] = None ) \u2192 CreateAssetResultDto It creates a new AI Agent or Service on Nevermined. The agent/service must be associated to a Payment Plan. Users that are subscribers of a payment plan can access the agent/service. Depending on the Payment Plan and the configuration of the agent/service, the usage of the agent/service will consume credits. When the plan expires (because the time is over or the credits are consumed), the user needs to renew the plan to continue using the agent/service. This method is oriented to AI Builders https://docs.nevermined.app/docs/tutorials/builders/register-agent Args: plan_did (str): The DID of the plan. service_type (str): The type of the service. Options: 'service', 'agent', 'assistant' name (str): The name of the service. description (str): The description of the service. service_charge_type (str): The charge type of the service. Options: 'fixed', 'dynamic' auth_type (str): The authentication type of the service. Options: 'none', 'basic', 'oauth' amount_of_credits (int): The amount of credits for the service. min_credits_to_charge (int, optional): The minimum credits to charge for the service. Only required for dynamic services. max_credits_to_charge (int, optional): The maximum credits to charge for the service. Only required for dynamic services. username (str, optional): The username for authentication. password (str, optional): The password for authentication. token (str, optional): The token for authentication. endpoints (List[Dict[str, str]], optional): The endpoints of the service. open_endpoints (List[str], optional): The open endpoints of the service. open_api_url (str, optional): The OpenAPI URL of the service. integration (str, optional): The integration type of the service. sample_link (str, optional): The sample link of the service. api_description (str, optional): The API description of the service. tags (List[str], optional): The tags associated with the service. is_nevermined_hosted (bool, optional): Indicates if the service is hosted by Nevermined. implements_query_protocol (bool, optional): Indicates if the service implements the query protocol. query_protocol_version (str, optional): The version of the query protocol implemented by the service. service_host (str, optional): The host of the service. Returns: CreateAssetResultDto : The result of the creation operation. Raises: HTTPError : If the API call fails. Example: response = your_instance.create_service(plan_did=\"did:nv:abc123\", service_type=\"service\", name=\"My Service\", description=\"A sample service\", service_charge_type=\"fixed\", auth_type=\"none\") print(response)","title":"method create_service"},{"location":"payments/#method-create_time_plan","text":"create_time_plan( name: str, description: str, price: int, token_address: str, duration: Optional[int] = 0, tags: Optional[List[str]] = None ) \u2192 CreateAssetResultDto It allows to an AI Builder to create a Payment Plan on Nevermined based on Time. A Nevermined Time Plan limits the access by the a specific amount of time. With them, AI Builders can specify the duration of the Payment Plan (1 month, 1 year, etc.). When the time period is over, the plan automatically expires and the user needs to renew it. This method is oriented to AI Builders https://docs.nevermined.app/docs/tutorials/builders/create-plan Args: name (str): The name of the plan. description (str): The description of the plan. price (int): The price of the plan. token_address (str): The token address. duration (int, optional): The duration of the plan in days. If not provided, the plan will be valid forever. tags (List[str], optional): The tags associated with the plan. Returns: CreateAssetResultDto : The result of the creation operation. Raises: HTTPError : If the API call fails. Example: response = your_instance.create_time_plan(name=\"Yearly Plan\", description=\"Annual plan\", price=1200, token_address=\"0x5678\", duration=365, tags=[\"yearly\", \"premium\"]) print(response)","title":"method create_time_plan"},{"location":"payments/#method-download_file","text":"download_file( file_did: str, destination: str, agreement_id: Optional[str] = None ) \u2192 DownloadFileResultDto Downloads the file. Args: file_did (str): The DID of the file. agreement_id (str, optional): The agreement ID. destination str : The destination of the file. Returns: Response : The url of the file. Returns: DownloadFileResultDto : The result of the download operation. Raises: HTTPError : If the API call fails. Example: response = your_instance.download_file(file_did=\"did:nv:7e38d39405445ab3e5435d8c1c6653a00ddc425ba629789f58fbefccaa5e5a5d\", destination=\"/tmp\") print(response)","title":"method download_file"},{"location":"payments/#method-get_asset_ddo","text":"get_asset_ddo(did: str) Get the Metadata (aka Decentralized Document or DDO) for a given asset identifier (DID). https://docs.nevermined.io/docs/architecture/specs/Spec-DID https://docs.nevermined.io/docs/architecture/specs/Spec-METADATA Args: did (str): The unique identifier (aka DID) of the asset (payment plan, agent, file, etc). Returns: Response : The response from the API call.","title":"method get_asset_ddo"},{"location":"payments/#method-get_checkout_plan","text":"get_checkout_plan(plan_did: str) Gets the checkout plan. Args: plan_did (str): The DID of the plan. Returns: Response : The url of the checkout plan.","title":"method get_checkout_plan"},{"location":"payments/#method-get_file_details_url","text":"get_file_details_url(file_did: str) Gets the file details. Args: file_did (str): The DID of the file. Returns: Response : The url of the file details.","title":"method get_file_details_url"},{"location":"payments/#method-get_plan_associated_files","text":"get_plan_associated_files(plan_did: str) Get array of files DIDs associated with a payment plan. Args: plan_did (str): The DID of the plan. Returns: Response : List of DIDs of the associated files.","title":"method get_plan_associated_files"},{"location":"payments/#method-get_plan_associated_services","text":"get_plan_associated_services(plan_did: str) Get array of services/agent DIDs associated with a payment plan. Args: plan_did (str): The DID of the plan. Returns: Response : List of DIDs of the associated services.","title":"method get_plan_associated_services"},{"location":"payments/#method-get_plan_balance","text":"get_plan_balance(plan_did: str, account_address: str) \u2192 BalanceResultDto Get the balance of an account for a Payment Plan. Args: plan_did (str): The DID of the plan. account_address (str): The account address. Returns: BalanceResultDto : The response from the API call formatted as a BalanceResultDto. Raises: HTTPError : If the API call fails. Example: response = your_instance.get_plan_balance(plan_did=\"did:example:123456\", account_address=\"0xABC123\") response.raise_for_status() balance = BalanceResultDto.model_validate(response.json()) print(balance) Expected Response: { \"planType\": \"credits\", \"isOwner\": True, \"isSubscriptor\": True, \"balance\": 10000000 }","title":"method get_plan_balance"},{"location":"payments/#method-get_plan_details_url","text":"get_plan_details_url(plan_did: str) Gets the plan details. Args: plan_did (str): The DID of the plan. Returns: Response : The url of the plan details.","title":"method get_plan_details_url"},{"location":"payments/#method-get_service_details_url","text":"get_service_details_url(service_did: str) Gets the service details. Args: service_did (str): The DID of the service. Returns: Response : The url of the service details.","title":"method get_service_details_url"},{"location":"payments/#method-get_service_token","text":"get_service_token(service_did: str) \u2192 ServiceTokenResultDto Get the required configuration for accessing a remote service agent. This configuration includes: - The JWT access token - The Proxy url that can be used to query the agent/service. Args: service_did (str): The DID of the service. Returns: ServiceTokenResultDto : The result of the creation operation. Raises: HTTPError : If the API call fails. Example: response = your_instance.get_service_token(service_did=\"did:nv:xyz789\") print(response)","title":"method get_service_token"},{"location":"payments/#method-mint_credits","text":"mint_credits(plan_did: str, amount: str, receiver: str) \u2192 MintResultDto Mints the credits associated with a plan and sends them to the receiver. Args: plan_did (str): The DID of the plan. amount (str): The amount of credits to mint. receiver (str): The receiver address of the credits. Returns: MintResultDto : The result of the minting operation. Raises: HTTPError : If the API call fails. Example: response = your_instance.mint_credits(plan_did=\"did:nv:e405a91e3152be1430c5d0607ebdf9236c19f34bfba0320798d81ba5f5e3e3a5\", amount=\"12\", receiver=\"0x4fe3e7d42fA83be4E8cF03451Ac3F25980a73fF6\") print(response)","title":"method mint_credits"},{"location":"payments/#method-order_plan","text":"order_plan( plan_did: str, agreementId: Optional[str] = None ) \u2192 OrderPlanResultDto Orders a Payment Plan. The user needs to have enough balance in the token selected by the owner of the Payment Plan. The payment is done using Crypto. Payments using Fiat can be done via the Nevermined App. Args: plan_did (str): The DID of the plan. agreementId (str, optional): The agreement ID. Returns: OrderPlanResultDto : The result of the order operation, containing the agreement ID and success status. Raises: HTTPError : If the API call fails. Example: response = your_instance.order_plan(plan_did=\"did:nv:a0079b517e580d430916924f1940b764e17c31e368c509483426f8c2ac2e7116\") print(response) This file was automatically generated via lazydocs .","title":"method order_plan"},{"location":"utils/","text":"module utils function snake_to_camel snake_to_camel(name) Convert snake_case to camelCase. :param name: str :return: str This file was automatically generated via lazydocs .","title":"Utils"},{"location":"utils/#module-utils","text":"","title":"module utils"},{"location":"utils/#function-snake_to_camel","text":"snake_to_camel(name) Convert snake_case to camelCase. :param name: str :return: str This file was automatically generated via lazydocs .","title":"function snake_to_camel"}]}
\ No newline at end of file
+{"config":{"indexing":"full","lang":["en"],"min_search_length":3,"prebuild_index":false,"separator":"[\\s\\-]+"},"docs":[{"location":"","text":"API Overview Modules ai_query_api data_models environments nvm_backend payments utils Classes ai_query_api.AIQueryApi : Represents the AI Query API. data_models.AgentExecutionStatus : An enumeration. data_models.Artifact : Represents an artifact with a unique identifier and a URL reference. data_models.BalanceResultDto data_models.BurnResultDto data_models.CreateAssetResultDto data_models.DownloadFileResultDto data_models.ExecutionInput : Represents the input for a task, such as a query and additional parameters or artifacts. data_models.ExecutionOptions : Represents options for executing a task or step, such as input, status, and output. data_models.ExecutionOutput : Represents the output of a task or step execution. data_models.MintResultDto data_models.OrderPlanResultDto data_models.PlanType : An enumeration. data_models.ServiceTokenResultDto data_models.Step : Represents a step in the execution of a task. data_models.Task : Represents a task that an agent should execute, composed of multiple steps. environments.Environment : Enum class to define the different environments nvm_backend.BackendApiOptions : Represents the backend API options. nvm_backend.NVMBackendApi payments.Payments : A class representing a payment system. Functions utils.snake_to_camel : Convert snake_case to camelCase. This file was automatically generated via lazydocs .","title":"Overview"},{"location":"#api-overview","text":"","title":"API Overview"},{"location":"#modules","text":"ai_query_api data_models environments nvm_backend payments utils","title":"Modules"},{"location":"#classes","text":"ai_query_api.AIQueryApi : Represents the AI Query API. data_models.AgentExecutionStatus : An enumeration. data_models.Artifact : Represents an artifact with a unique identifier and a URL reference. data_models.BalanceResultDto data_models.BurnResultDto data_models.CreateAssetResultDto data_models.DownloadFileResultDto data_models.ExecutionInput : Represents the input for a task, such as a query and additional parameters or artifacts. data_models.ExecutionOptions : Represents options for executing a task or step, such as input, status, and output. data_models.ExecutionOutput : Represents the output of a task or step execution. data_models.MintResultDto data_models.OrderPlanResultDto data_models.PlanType : An enumeration. data_models.ServiceTokenResultDto data_models.Step : Represents a step in the execution of a task. data_models.Task : Represents a task that an agent should execute, composed of multiple steps. environments.Environment : Enum class to define the different environments nvm_backend.BackendApiOptions : Represents the backend API options. nvm_backend.NVMBackendApi payments.Payments : A class representing a payment system.","title":"Classes"},{"location":"#functions","text":"utils.snake_to_camel : Convert snake_case to camelCase. This file was automatically generated via lazydocs .","title":"Functions"},{"location":"ai_query_api/","text":"module ai_query_api Global Variables SEARCH_TASKS_ENDPOINT SEARCH_STEPS_ENDPOINT CREATE_STEPS_ENDPOINT UPDATE_STEP_ENDPOINT GET_AGENTS_ENDPOINT GET_BUILDER_STEPS_ENDPOINT GET_TASK_STEPS_ENDPOINT TASK_ENDPOINT GET_TASK_ENDPOINT class AIQueryApi Represents the AI Query API. Args: opts (BackendApiOptions): The backend API options Methods: - create_task : Creates a task for an agent to execute - create_steps : Creates steps for a task - update_step : Updates a step - search_tasks : Searches for tasks - get_task_with_steps : Gets a task with its steps - get_steps_from_task : Gets the steps from a task - get_steps : Gets the steps - get_tasks_from_agents : Gets the tasks from the agents - search_step : Searches for steps - get_step : Gets the details of a step 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: did (str): The DID of the service. task_id (str): The task ID. steps (Any): The steps to create. method create_task create_task(did: str, task: Any) 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: did (str): The DID of the service. task (Any): The task to create. 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) Get the details of a step. Args: did (str): The DID of the service. task_id (str): The task ID. step_id (str): The step ID. method get_steps get_steps( status: AgentExecutionStatus = , dids: List[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: status (AgentExecutionStatus): The status of the steps. dids (List[str]): The list of DIDs. 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: did (str): The DID of the service. task_id (str): The task ID. status (Optional[str]): The status of the steps. method get_task_with_steps get_task_with_steps(did: str, task_id: str) 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: did (str): The DID of the service. task_id (str): The task ID. 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: search_params (Any): The search parameters. method search_tasks search_tasks(search_params: Any) It searches tasks based on the search parameters associated to the user. Args: search_params (Any): The search parameters. 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: callback (Any): The callback function to be called when a new event is received. join_account_room (bool): If True, it will join the account room. join_agent_rooms (Optional[Union[str, List[str]]]): The agent rooms to join. subscribe_event_types (Optional[List[str]]): The event types to subscribe to. get_pending_events_on_subscribe (bool): If True, it will get the pending events on subscribe. method update_step update_step(did: str, task_id: str, step_id: str, step: Any) 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: did (str): The DID of the service. task_id (str): The task ID. step_id (str): The step ID. step (Any): The step object to update. https://docs.nevermined.io/docs/protocol/query-protocol#steps-attributes This file was automatically generated via lazydocs .","title":"Ai query api"},{"location":"ai_query_api/#module-ai_query_api","text":"","title":"module ai_query_api"},{"location":"ai_query_api/#global-variables","text":"SEARCH_TASKS_ENDPOINT SEARCH_STEPS_ENDPOINT CREATE_STEPS_ENDPOINT UPDATE_STEP_ENDPOINT GET_AGENTS_ENDPOINT GET_BUILDER_STEPS_ENDPOINT GET_TASK_STEPS_ENDPOINT TASK_ENDPOINT GET_TASK_ENDPOINT","title":"Global Variables"},{"location":"ai_query_api/#class-aiqueryapi","text":"Represents the AI Query API. Args: opts (BackendApiOptions): The backend API options Methods: - create_task : Creates a task for an agent to execute - create_steps : Creates steps for a task - update_step : Updates a step - search_tasks : Searches for tasks - get_task_with_steps : Gets a task with its steps - get_steps_from_task : Gets the steps from a task - get_steps : Gets the steps - get_tasks_from_agents : Gets the tasks from the agents - search_step : Searches for steps - get_step : Gets the details of a step","title":"class AIQueryApi"},{"location":"ai_query_api/#method-__init__","text":"__init__(opts: BackendApiOptions)","title":"method __init__"},{"location":"ai_query_api/#method-create_steps","text":"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: did (str): The DID of the service. task_id (str): The task ID. steps (Any): The steps to create.","title":"method create_steps"},{"location":"ai_query_api/#method-create_task","text":"create_task(did: str, task: Any) 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: did (str): The DID of the service. task (Any): The task to create. 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())","title":"method create_task"},{"location":"ai_query_api/#method-get_step","text":"get_step(step_id: str) Get the details of a step. Args: did (str): The DID of the service. task_id (str): The task ID. step_id (str): The step ID.","title":"method get_step"},{"location":"ai_query_api/#method-get_steps","text":"get_steps( status: AgentExecutionStatus = , dids: List[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: status (AgentExecutionStatus): The status of the steps. dids (List[str]): The list of DIDs.","title":"method get_steps"},{"location":"ai_query_api/#method-get_steps_from_task","text":"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: did (str): The DID of the service. task_id (str): The task ID. status (Optional[str]): The status of the steps.","title":"method get_steps_from_task"},{"location":"ai_query_api/#method-get_task_with_steps","text":"get_task_with_steps(did: str, task_id: str) 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: did (str): The DID of the service. task_id (str): The task ID.","title":"method get_task_with_steps"},{"location":"ai_query_api/#method-get_tasks_from_agents","text":"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","title":"method get_tasks_from_agents"},{"location":"ai_query_api/#method-search_step","text":"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: search_params (Any): The search parameters.","title":"method search_step"},{"location":"ai_query_api/#method-search_tasks","text":"search_tasks(search_params: Any) It searches tasks based on the search parameters associated to the user. Args: search_params (Any): The search parameters.","title":"method search_tasks"},{"location":"ai_query_api/#method-subscribe","text":"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: callback (Any): The callback function to be called when a new event is received. join_account_room (bool): If True, it will join the account room. join_agent_rooms (Optional[Union[str, List[str]]]): The agent rooms to join. subscribe_event_types (Optional[List[str]]): The event types to subscribe to. get_pending_events_on_subscribe (bool): If True, it will get the pending events on subscribe.","title":"method subscribe"},{"location":"ai_query_api/#method-update_step","text":"update_step(did: str, task_id: str, step_id: str, step: Any) 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: did (str): The DID of the service. task_id (str): The task ID. step_id (str): The step ID. step (Any): The step object to update. https://docs.nevermined.io/docs/protocol/query-protocol#steps-attributes This file was automatically generated via lazydocs .","title":"method update_step"},{"location":"data_models/","text":"module data_models Global Variables FIRST_STEP_NAME LAST_STEP_NAME class PlanType An enumeration. class BalanceResultDto property model_extra Get extra fields set during validation. Returns: A dictionary of extra fields, or None if config.extra is not set to \"allow\" . property model_fields_set Returns the set of fields that have been explicitly set on this model instance. Returns: A set of strings representing the fields that have been set, i.e. that were not filled from defaults. class MintResultDto property model_extra Get extra fields set during validation. Returns: A dictionary of extra fields, or None if config.extra is not set to \"allow\" . property model_fields_set Returns the set of fields that have been explicitly set on this model instance. Returns: A set of strings representing the fields that have been set, i.e. that were not filled from defaults. class BurnResultDto property model_extra Get extra fields set during validation. Returns: A dictionary of extra fields, or None if config.extra is not set to \"allow\" . property model_fields_set Returns the set of fields that have been explicitly set on this model instance. Returns: A set of strings representing the fields that have been set, i.e. that were not filled from defaults. class CreateAssetResultDto property model_extra Get extra fields set during validation. Returns: A dictionary of extra fields, or None if config.extra is not set to \"allow\" . property model_fields_set Returns the set of fields that have been explicitly set on this model instance. Returns: A set of strings representing the fields that have been set, i.e. that were not filled from defaults. class DownloadFileResultDto property model_extra Get extra fields set during validation. Returns: A dictionary of extra fields, or None if config.extra is not set to \"allow\" . property model_fields_set Returns the set of fields that have been explicitly set on this model instance. Returns: A set of strings representing the fields that have been set, i.e. that were not filled from defaults. class OrderPlanResultDto property model_extra Get extra fields set during validation. Returns: A dictionary of extra fields, or None if config.extra is not set to \"allow\" . property model_fields_set Returns the set of fields that have been explicitly set on this model instance. Returns: A set of strings representing the fields that have been set, i.e. that were not filled from defaults. class ServiceTokenResultDto property model_extra Get extra fields set during validation. Returns: A dictionary of extra fields, or None if config.extra is not set to \"allow\" . property model_fields_set Returns the set of fields that have been explicitly set on this model instance. Returns: A set of strings representing the fields that have been set, i.e. that were not filled from defaults. class AgentExecutionStatus An enumeration. class Artifact Represents an artifact with a unique identifier and a URL reference. class ExecutionInput Represents the input for a task, such as a query and additional parameters or artifacts. class ExecutionOutput Represents the output of a task or step execution. class ExecutionOptions Represents options for executing a task or step, such as input, status, and output. class Step Represents a step in the execution of a task. class Task Represents a task that an agent should execute, composed of multiple steps. This file was automatically generated via lazydocs .","title":"Data models"},{"location":"data_models/#module-data_models","text":"","title":"module data_models"},{"location":"data_models/#global-variables","text":"FIRST_STEP_NAME LAST_STEP_NAME","title":"Global Variables"},{"location":"data_models/#class-plantype","text":"An enumeration.","title":"class PlanType"},{"location":"data_models/#class-balanceresultdto","text":"","title":"class BalanceResultDto"},{"location":"data_models/#property-model_extra","text":"Get extra fields set during validation. Returns: A dictionary of extra fields, or None if config.extra is not set to \"allow\" .","title":"property model_extra"},{"location":"data_models/#property-model_fields_set","text":"Returns the set of fields that have been explicitly set on this model instance. Returns: A set of strings representing the fields that have been set, i.e. that were not filled from defaults.","title":"property model_fields_set"},{"location":"data_models/#class-mintresultdto","text":"","title":"class MintResultDto"},{"location":"data_models/#property-model_extra_1","text":"Get extra fields set during validation. Returns: A dictionary of extra fields, or None if config.extra is not set to \"allow\" .","title":"property model_extra"},{"location":"data_models/#property-model_fields_set_1","text":"Returns the set of fields that have been explicitly set on this model instance. Returns: A set of strings representing the fields that have been set, i.e. that were not filled from defaults.","title":"property model_fields_set"},{"location":"data_models/#class-burnresultdto","text":"","title":"class BurnResultDto"},{"location":"data_models/#property-model_extra_2","text":"Get extra fields set during validation. Returns: A dictionary of extra fields, or None if config.extra is not set to \"allow\" .","title":"property model_extra"},{"location":"data_models/#property-model_fields_set_2","text":"Returns the set of fields that have been explicitly set on this model instance. Returns: A set of strings representing the fields that have been set, i.e. that were not filled from defaults.","title":"property model_fields_set"},{"location":"data_models/#class-createassetresultdto","text":"","title":"class CreateAssetResultDto"},{"location":"data_models/#property-model_extra_3","text":"Get extra fields set during validation. Returns: A dictionary of extra fields, or None if config.extra is not set to \"allow\" .","title":"property model_extra"},{"location":"data_models/#property-model_fields_set_3","text":"Returns the set of fields that have been explicitly set on this model instance. Returns: A set of strings representing the fields that have been set, i.e. that were not filled from defaults.","title":"property model_fields_set"},{"location":"data_models/#class-downloadfileresultdto","text":"","title":"class DownloadFileResultDto"},{"location":"data_models/#property-model_extra_4","text":"Get extra fields set during validation. Returns: A dictionary of extra fields, or None if config.extra is not set to \"allow\" .","title":"property model_extra"},{"location":"data_models/#property-model_fields_set_4","text":"Returns the set of fields that have been explicitly set on this model instance. Returns: A set of strings representing the fields that have been set, i.e. that were not filled from defaults.","title":"property model_fields_set"},{"location":"data_models/#class-orderplanresultdto","text":"","title":"class OrderPlanResultDto"},{"location":"data_models/#property-model_extra_5","text":"Get extra fields set during validation. Returns: A dictionary of extra fields, or None if config.extra is not set to \"allow\" .","title":"property model_extra"},{"location":"data_models/#property-model_fields_set_5","text":"Returns the set of fields that have been explicitly set on this model instance. Returns: A set of strings representing the fields that have been set, i.e. that were not filled from defaults.","title":"property model_fields_set"},{"location":"data_models/#class-servicetokenresultdto","text":"","title":"class ServiceTokenResultDto"},{"location":"data_models/#property-model_extra_6","text":"Get extra fields set during validation. Returns: A dictionary of extra fields, or None if config.extra is not set to \"allow\" .","title":"property model_extra"},{"location":"data_models/#property-model_fields_set_6","text":"Returns the set of fields that have been explicitly set on this model instance. Returns: A set of strings representing the fields that have been set, i.e. that were not filled from defaults.","title":"property model_fields_set"},{"location":"data_models/#class-agentexecutionstatus","text":"An enumeration.","title":"class AgentExecutionStatus"},{"location":"data_models/#class-artifact","text":"Represents an artifact with a unique identifier and a URL reference.","title":"class Artifact"},{"location":"data_models/#class-executioninput","text":"Represents the input for a task, such as a query and additional parameters or artifacts.","title":"class ExecutionInput"},{"location":"data_models/#class-executionoutput","text":"Represents the output of a task or step execution.","title":"class ExecutionOutput"},{"location":"data_models/#class-executionoptions","text":"Represents options for executing a task or step, such as input, status, and output.","title":"class ExecutionOptions"},{"location":"data_models/#class-step","text":"Represents a step in the execution of a task.","title":"class Step"},{"location":"data_models/#class-task","text":"Represents a task that an agent should execute, composed of multiple steps. This file was automatically generated via lazydocs .","title":"class Task"},{"location":"environments/","text":"module environments class Environment Enum class to define the different environments Attributes: local : Local environment staging : Staging environment testing : Testing environment arbitrum : Arbitrum environment appPeaq : Peaq network This file was automatically generated via lazydocs .","title":"Environments"},{"location":"environments/#module-environments","text":"","title":"module environments"},{"location":"environments/#class-environment","text":"Enum class to define the different environments Attributes: local : Local environment staging : Staging environment testing : Testing environment arbitrum : Arbitrum environment appPeaq : Peaq network This file was automatically generated via lazydocs .","title":"class Environment"},{"location":"nvm_backend/","text":"module nvm_backend class BackendApiOptions Represents the backend API options. Args: environment (Environment): The environment. api_key (Optional[str]): The Nevermined API Key. This key identify your user and is required to interact with the Nevermined API. You can get your API key by logging in to the Nevermined App. See https://docs.nevermined.app/docs/tutorials/integration/nvm-api-keys headers (Optional[Dict[str, str]]): Additional headers to send with the requests web_socket_options (Optional[Dict[str, Any]]): Configuration of the websocket connection method __init__ __init__( environment: Environment, api_key: Optional[str] = None, headers: Optional[Dict[str, str]] = None, web_socket_options: Optional[Dict[str, Any]] = None ) class NVMBackendApi method __init__ __init__(opts: BackendApiOptions) method connect_socket connect_socket() method delete delete(url: str, data: Any, headers: Optional[Dict[str, str]] = None) method disconnect disconnect() method disconnect_socket disconnect_socket() method get get(url: str, headers: Optional[Dict[str, str]] = None) method get_service_token get_service_token(service_did: str) \u2192 ServiceTokenResultDto Gets the service token. Args: service_did (str): The DID of the service. Returns: ServiceTokenResultDto : The result of the creation operation. Raises: HTTPError : If the API call fails. Example: response = your_instance.get_service_token(service_did=\"did:nv:xyz789\") print(response) method join_room join_room(join_account_room: bool, room_ids: Optional[str, List[str]] = None) method parse_headers parse_headers(additional_headers: dict[str, str]) \u2192 dict[str, str] method parse_url_to_backend parse_url_to_backend(uri: str) \u2192 str method parse_url_to_proxy parse_url_to_proxy(uri: str) \u2192 str method post post(url: str, data: Any, headers: Optional[Dict[str, str]] = None) method put put(url: str, data: Any, headers: Optional[Dict[str, str]] = None) This file was automatically generated via lazydocs .","title":"Nvm backend"},{"location":"nvm_backend/#module-nvm_backend","text":"","title":"module nvm_backend"},{"location":"nvm_backend/#class-backendapioptions","text":"Represents the backend API options. Args: environment (Environment): The environment. api_key (Optional[str]): The Nevermined API Key. This key identify your user and is required to interact with the Nevermined API. You can get your API key by logging in to the Nevermined App. See https://docs.nevermined.app/docs/tutorials/integration/nvm-api-keys headers (Optional[Dict[str, str]]): Additional headers to send with the requests web_socket_options (Optional[Dict[str, Any]]): Configuration of the websocket connection","title":"class BackendApiOptions"},{"location":"nvm_backend/#method-__init__","text":"__init__( environment: Environment, api_key: Optional[str] = None, headers: Optional[Dict[str, str]] = None, web_socket_options: Optional[Dict[str, Any]] = None )","title":"method __init__"},{"location":"nvm_backend/#class-nvmbackendapi","text":"","title":"class NVMBackendApi"},{"location":"nvm_backend/#method-__init___1","text":"__init__(opts: BackendApiOptions)","title":"method __init__"},{"location":"nvm_backend/#method-connect_socket","text":"connect_socket()","title":"method connect_socket"},{"location":"nvm_backend/#method-delete","text":"delete(url: str, data: Any, headers: Optional[Dict[str, str]] = None)","title":"method delete"},{"location":"nvm_backend/#method-disconnect","text":"disconnect()","title":"method disconnect"},{"location":"nvm_backend/#method-disconnect_socket","text":"disconnect_socket()","title":"method disconnect_socket"},{"location":"nvm_backend/#method-get","text":"get(url: str, headers: Optional[Dict[str, str]] = None)","title":"method get"},{"location":"nvm_backend/#method-get_service_token","text":"get_service_token(service_did: str) \u2192 ServiceTokenResultDto Gets the service token. Args: service_did (str): The DID of the service. Returns: ServiceTokenResultDto : The result of the creation operation. Raises: HTTPError : If the API call fails. Example: response = your_instance.get_service_token(service_did=\"did:nv:xyz789\") print(response)","title":"method get_service_token"},{"location":"nvm_backend/#method-join_room","text":"join_room(join_account_room: bool, room_ids: Optional[str, List[str]] = None)","title":"method join_room"},{"location":"nvm_backend/#method-parse_headers","text":"parse_headers(additional_headers: dict[str, str]) \u2192 dict[str, str]","title":"method parse_headers"},{"location":"nvm_backend/#method-parse_url_to_backend","text":"parse_url_to_backend(uri: str) \u2192 str","title":"method parse_url_to_backend"},{"location":"nvm_backend/#method-parse_url_to_proxy","text":"parse_url_to_proxy(uri: str) \u2192 str","title":"method parse_url_to_proxy"},{"location":"nvm_backend/#method-post","text":"post(url: str, data: Any, headers: Optional[Dict[str, str]] = None)","title":"method post"},{"location":"nvm_backend/#method-put","text":"put(url: str, data: Any, headers: Optional[Dict[str, str]] = None) This file was automatically generated via lazydocs .","title":"method put"},{"location":"payments/","text":"module payments class Payments A class representing a payment system. Attributes: nvm_api_key (str): The nvm api key for authentication. environment (Environment): The environment for the payment system. app_id (str, optional): The application ID. version (str, optional): The version of the payment system. ai_protocol (bool): Indicates if the AI protocol is enabled. headers (dict, optional): The headers for the payment system. web_socket_options (dict, optional): The web socket options for the payment system. Methods: - create_credits_plan : Creates a new credits plan. - create_time_plan : Creates a new time plan. - create_service : Creates a new service. - create_file : Creates a new file. - order_plan : Orders the plan. - get_asset_ddo : Gets the asset DDO. - get_plan_balance : Gets the plan balance. - get_service_token : Gets the service token. - get_plan_associated_services : Gets the plan associated services. - get_plan_associated_files : Gets the plan associated files. - get_plan_details : Gets the plan details. - get_service_details : Gets the service details. - get_file_details : Gets the file details. - get_checkout_plan : Gets the checkout plan. - download_file : Downloads the file. - mint_credits : Mints the credits associated to a plan and send to the receiver. - burn_credits : Burns credits associated to a plan that you own. - ai_protocol : The AI Query API. method __init__ __init__( nvm_api_key: str, environment: Environment, app_id: Optional[str] = None, version: Optional[str] = None, ai_protocol: bool = False, headers: Optional[dict] = None, web_socket_options: Optional[dict] = None ) method burn_credits burn_credits(plan_did: str, amount: str) \u2192 BurnResultDto Burn credits for a given Payment Plan DID. This method is only can be called by the owner of the Payment Plan. Args: plan_did (str): The DID of the plan. amount (str): The amount of credits to burn. Returns: BurnResultDto : The result of the burning operation. Raises: HTTPError : If the API call fails. Example: response = your_instance.burn_credits(plan_did=\"did:nv:e405a91e3152be1430c5d0607ebdf9236c19f34bfba0320798d81ba5f5e3e3a5\", amount=\"12\") print(response) method create_credits_plan create_credits_plan( name: str, description: str, price: int, token_address: str, amount_of_credits: int, tags: Optional[List[str]] = None ) \u2192 CreateAssetResultDto It allows to an AI Builder to create a Payment Plan on Nevermined based on Credits. A Nevermined Credits Plan limits the access by the access/usage of the Plan. With them, AI Builders control the number of requests that can be made to an agent or service. Every time a user accesses any resouce associated to the Payment Plan, the usage consumes from a capped amount of credits. When the user consumes all the credits, the plan automatically expires and the user needs to top up to continue using the service. This method is oriented to AI Builders. https://docs.nevermined.app/docs/tutorials/builders/create-plan Args: name (str): The name of the plan. description (str): The description of the plan. price (int): The price of the plan. token_address (str): The token address. amount_of_credits (int): The amount of credits for the plan. tags (List[str], optional): The tags associated with the plan. Returns: CreateAssetResultDto : The result of the creation operation. Raises: HTTPError : If the API call fails. Example: response = your_instance.create_credits_plan(name=\"Basic Plan\", description=\"100 credits plan\", price=1, token_address=\"0x1234\", amount_of_credits=100, tags=[\"basic\"]) print(response) method create_file create_file( plan_did: str, asset_type: str, name: str, description: str, files: List[dict], data_schema: Optional[str] = None, sample_code: Optional[str] = None, files_format: Optional[str] = None, usage_example: Optional[str] = None, programming_language: Optional[str] = None, framework: Optional[str] = None, task: Optional[str] = None, training_details: Optional[str] = None, variations: Optional[str] = None, fine_tunable: Optional[bool] = None, amount_of_credits: Optional[int] = None, tags: Optional[List[str]] = None ) \u2192 CreateAssetResultDto It creates a new asset with file associated to it. The file asset must be associated to a Payment Plan. Users that are subscribers of a payment plan can download the files attached to it. Depending on the Payment Plan and the configuration of the file asset, the download will consume credits. When the plan expires (because the time is over or the credits are consumed), the user needs to renew the plan to continue downloading the files. This method is oriented to AI Builders https://docs.nevermined.app/docs/tutorials/builders/register-file-asset Args: plan_did (str): The DID of the plan. asset_type (str): The type of the asset. -> 'algorithm' | 'model' | 'dataset' | 'file' name (str): The name of the file. description (str): The description of the file. files (List[dict]): The files of the file. data_schema (str, optional): The data schema of the file. sample_code (str, optional): The sample code of the file. files_format (str, optional): The files format of the file. usage_example (str, optional): The usage example of the file. programming_language (str, optional): The programming language of the file. framework (str, optional): The framework of the file. task (str, optional): The task of the file. training_details (str, optional): The training details of the file. variations (str, optional): The variations of the file. fine_tunable (bool, optional): The fine tunable of the file. amount_of_credits (int, optional): The amount of credits for the file. tags (List[str], optional): The tags associated with the file. Returns: CreateAssetResultDto : The result of the creation operation. Raises: HTTPError : If the API call fails. Example: response = your_instance.create_file(plan_did=\"did:nv:xyz789\", asset_type=\"dataset\", name=\"Sample Dataset\", description=\"A sample dataset\", files=[{\"name\": \"file1.csv\", \"url\": \"https://example.com/file1.csv\"}]) print(response) method create_service create_service( plan_did: str, service_type: str, name: str, description: str, service_charge_type: str, auth_type: str, amount_of_credits: int = 1, min_credits_to_charge: Optional[int] = 1, max_credits_to_charge: Optional[int] = 1, username: Optional[str] = None, password: Optional[str] = None, token: Optional[str] = None, endpoints: Optional[List[dict]] = None, open_endpoints: Optional[List[str]] = [], open_api_url: Optional[str] = None, integration: Optional[str] = None, sample_link: Optional[str] = None, api_description: Optional[str] = None, tags: Optional[List[str]] = None, is_nevermined_hosted: Optional[bool] = None, implements_query_protocol: Optional[bool] = None, query_protocol_version: Optional[str] = None, service_host: Optional[str] = None ) \u2192 CreateAssetResultDto It creates a new AI Agent or Service on Nevermined. The agent/service must be associated to a Payment Plan. Users that are subscribers of a payment plan can access the agent/service. Depending on the Payment Plan and the configuration of the agent/service, the usage of the agent/service will consume credits. When the plan expires (because the time is over or the credits are consumed), the user needs to renew the plan to continue using the agent/service. This method is oriented to AI Builders https://docs.nevermined.app/docs/tutorials/builders/register-agent Args: plan_did (str): The DID of the plan. service_type (str): The type of the service. Options: 'service', 'agent', 'assistant' name (str): The name of the service. description (str): The description of the service. service_charge_type (str): The charge type of the service. Options: 'fixed', 'dynamic' auth_type (str): The authentication type of the service. Options: 'none', 'basic', 'oauth' amount_of_credits (int): The amount of credits for the service. min_credits_to_charge (int, optional): The minimum credits to charge for the service. Only required for dynamic services. max_credits_to_charge (int, optional): The maximum credits to charge for the service. Only required for dynamic services. username (str, optional): The username for authentication. password (str, optional): The password for authentication. token (str, optional): The token for authentication. endpoints (List[Dict[str, str]], optional): The endpoints of the service. open_endpoints (List[str], optional): The open endpoints of the service. open_api_url (str, optional): The OpenAPI URL of the service. integration (str, optional): The integration type of the service. sample_link (str, optional): The sample link of the service. api_description (str, optional): The API description of the service. tags (List[str], optional): The tags associated with the service. is_nevermined_hosted (bool, optional): Indicates if the service is hosted by Nevermined. implements_query_protocol (bool, optional): Indicates if the service implements the query protocol. query_protocol_version (str, optional): The version of the query protocol implemented by the service. service_host (str, optional): The host of the service. Returns: CreateAssetResultDto : The result of the creation operation. Raises: HTTPError : If the API call fails. Example: response = your_instance.create_service(plan_did=\"did:nv:abc123\", service_type=\"service\", name=\"My Service\", description=\"A sample service\", service_charge_type=\"fixed\", auth_type=\"none\") print(response) method create_time_plan create_time_plan( name: str, description: str, price: int, token_address: str, duration: Optional[int] = 0, tags: Optional[List[str]] = None ) \u2192 CreateAssetResultDto It allows to an AI Builder to create a Payment Plan on Nevermined based on Time. A Nevermined Time Plan limits the access by the a specific amount of time. With them, AI Builders can specify the duration of the Payment Plan (1 month, 1 year, etc.). When the time period is over, the plan automatically expires and the user needs to renew it. This method is oriented to AI Builders https://docs.nevermined.app/docs/tutorials/builders/create-plan Args: name (str): The name of the plan. description (str): The description of the plan. price (int): The price of the plan. token_address (str): The token address. duration (int, optional): The duration of the plan in days. If not provided, the plan will be valid forever. tags (List[str], optional): The tags associated with the plan. Returns: CreateAssetResultDto : The result of the creation operation. Raises: HTTPError : If the API call fails. Example: response = your_instance.create_time_plan(name=\"Yearly Plan\", description=\"Annual plan\", price=1200, token_address=\"0x5678\", duration=365, tags=[\"yearly\", \"premium\"]) print(response) method download_file download_file( file_did: str, destination: str, agreement_id: Optional[str] = None ) \u2192 DownloadFileResultDto Downloads the file. Args: file_did (str): The DID of the file. agreement_id (str, optional): The agreement ID. destination str : The destination of the file. Returns: Response : The url of the file. Returns: DownloadFileResultDto : The result of the download operation. Raises: HTTPError : If the API call fails. Example: response = your_instance.download_file(file_did=\"did:nv:7e38d39405445ab3e5435d8c1c6653a00ddc425ba629789f58fbefccaa5e5a5d\", destination=\"/tmp\") print(response) method get_asset_ddo get_asset_ddo(did: str) Get the Metadata (aka Decentralized Document or DDO) for a given asset identifier (DID). https://docs.nevermined.io/docs/architecture/specs/Spec-DID https://docs.nevermined.io/docs/architecture/specs/Spec-METADATA Args: did (str): The unique identifier (aka DID) of the asset (payment plan, agent, file, etc). Returns: Response : The response from the API call. method get_checkout_plan get_checkout_plan(plan_did: str) Gets the checkout plan. Args: plan_did (str): The DID of the plan. Returns: Response : The url of the checkout plan. method get_file_details_url get_file_details_url(file_did: str) Gets the file details. Args: file_did (str): The DID of the file. Returns: Response : The url of the file details. method get_plan_associated_files get_plan_associated_files(plan_did: str) Get array of files DIDs associated with a payment plan. Args: plan_did (str): The DID of the plan. Returns: Response : List of DIDs of the associated files. method get_plan_associated_services get_plan_associated_services(plan_did: str) Get array of services/agent DIDs associated with a payment plan. Args: plan_did (str): The DID of the plan. Returns: Response : List of DIDs of the associated services. method get_plan_balance get_plan_balance(plan_did: str, account_address: str) \u2192 BalanceResultDto Get the balance of an account for a Payment Plan. Args: plan_did (str): The DID of the plan. account_address (str): The account address. Returns: BalanceResultDto : The response from the API call formatted as a BalanceResultDto. Raises: HTTPError : If the API call fails. Example: response = your_instance.get_plan_balance(plan_did=\"did:example:123456\", account_address=\"0xABC123\") response.raise_for_status() balance = BalanceResultDto.model_validate(response.json()) print(balance) Expected Response: { \"planType\": \"credits\", \"isOwner\": True, \"isSubscriptor\": True, \"balance\": 10000000 } method get_plan_details_url get_plan_details_url(plan_did: str) Gets the plan details. Args: plan_did (str): The DID of the plan. Returns: Response : The url of the plan details. method get_service_details_url get_service_details_url(service_did: str) Gets the service details. Args: service_did (str): The DID of the service. Returns: Response : The url of the service details. method get_service_token get_service_token(service_did: str) \u2192 ServiceTokenResultDto Get the required configuration for accessing a remote service agent. This configuration includes: - The JWT access token - The Proxy url that can be used to query the agent/service. Args: service_did (str): The DID of the service. Returns: ServiceTokenResultDto : The result of the creation operation. Raises: HTTPError : If the API call fails. Example: response = your_instance.get_service_token(service_did=\"did:nv:xyz789\") print(response) method mint_credits mint_credits(plan_did: str, amount: str, receiver: str) \u2192 MintResultDto Mints the credits associated with a plan and sends them to the receiver. Args: plan_did (str): The DID of the plan. amount (str): The amount of credits to mint. receiver (str): The receiver address of the credits. Returns: MintResultDto : The result of the minting operation. Raises: HTTPError : If the API call fails. Example: response = your_instance.mint_credits(plan_did=\"did:nv:e405a91e3152be1430c5d0607ebdf9236c19f34bfba0320798d81ba5f5e3e3a5\", amount=\"12\", receiver=\"0x4fe3e7d42fA83be4E8cF03451Ac3F25980a73fF6\") print(response) method order_plan order_plan( plan_did: str, agreementId: Optional[str] = None ) \u2192 OrderPlanResultDto Orders a Payment Plan. The user needs to have enough balance in the token selected by the owner of the Payment Plan. The payment is done using Crypto. Payments using Fiat can be done via the Nevermined App. Args: plan_did (str): The DID of the plan. agreementId (str, optional): The agreement ID. Returns: OrderPlanResultDto : The result of the order operation, containing the agreement ID and success status. Raises: HTTPError : If the API call fails. Example: response = your_instance.order_plan(plan_did=\"did:nv:a0079b517e580d430916924f1940b764e17c31e368c509483426f8c2ac2e7116\") print(response) This file was automatically generated via lazydocs .","title":"Payments"},{"location":"payments/#module-payments","text":"","title":"module payments"},{"location":"payments/#class-payments","text":"A class representing a payment system. Attributes: nvm_api_key (str): The nvm api key for authentication. environment (Environment): The environment for the payment system. app_id (str, optional): The application ID. version (str, optional): The version of the payment system. ai_protocol (bool): Indicates if the AI protocol is enabled. headers (dict, optional): The headers for the payment system. web_socket_options (dict, optional): The web socket options for the payment system. Methods: - create_credits_plan : Creates a new credits plan. - create_time_plan : Creates a new time plan. - create_service : Creates a new service. - create_file : Creates a new file. - order_plan : Orders the plan. - get_asset_ddo : Gets the asset DDO. - get_plan_balance : Gets the plan balance. - get_service_token : Gets the service token. - get_plan_associated_services : Gets the plan associated services. - get_plan_associated_files : Gets the plan associated files. - get_plan_details : Gets the plan details. - get_service_details : Gets the service details. - get_file_details : Gets the file details. - get_checkout_plan : Gets the checkout plan. - download_file : Downloads the file. - mint_credits : Mints the credits associated to a plan and send to the receiver. - burn_credits : Burns credits associated to a plan that you own. - ai_protocol : The AI Query API.","title":"class Payments"},{"location":"payments/#method-__init__","text":"__init__( nvm_api_key: str, environment: Environment, app_id: Optional[str] = None, version: Optional[str] = None, ai_protocol: bool = False, headers: Optional[dict] = None, web_socket_options: Optional[dict] = None )","title":"method __init__"},{"location":"payments/#method-burn_credits","text":"burn_credits(plan_did: str, amount: str) \u2192 BurnResultDto Burn credits for a given Payment Plan DID. This method is only can be called by the owner of the Payment Plan. Args: plan_did (str): The DID of the plan. amount (str): The amount of credits to burn. Returns: BurnResultDto : The result of the burning operation. Raises: HTTPError : If the API call fails. Example: response = your_instance.burn_credits(plan_did=\"did:nv:e405a91e3152be1430c5d0607ebdf9236c19f34bfba0320798d81ba5f5e3e3a5\", amount=\"12\") print(response)","title":"method burn_credits"},{"location":"payments/#method-create_credits_plan","text":"create_credits_plan( name: str, description: str, price: int, token_address: str, amount_of_credits: int, tags: Optional[List[str]] = None ) \u2192 CreateAssetResultDto It allows to an AI Builder to create a Payment Plan on Nevermined based on Credits. A Nevermined Credits Plan limits the access by the access/usage of the Plan. With them, AI Builders control the number of requests that can be made to an agent or service. Every time a user accesses any resouce associated to the Payment Plan, the usage consumes from a capped amount of credits. When the user consumes all the credits, the plan automatically expires and the user needs to top up to continue using the service. This method is oriented to AI Builders. https://docs.nevermined.app/docs/tutorials/builders/create-plan Args: name (str): The name of the plan. description (str): The description of the plan. price (int): The price of the plan. token_address (str): The token address. amount_of_credits (int): The amount of credits for the plan. tags (List[str], optional): The tags associated with the plan. Returns: CreateAssetResultDto : The result of the creation operation. Raises: HTTPError : If the API call fails. Example: response = your_instance.create_credits_plan(name=\"Basic Plan\", description=\"100 credits plan\", price=1, token_address=\"0x1234\", amount_of_credits=100, tags=[\"basic\"]) print(response)","title":"method create_credits_plan"},{"location":"payments/#method-create_file","text":"create_file( plan_did: str, asset_type: str, name: str, description: str, files: List[dict], data_schema: Optional[str] = None, sample_code: Optional[str] = None, files_format: Optional[str] = None, usage_example: Optional[str] = None, programming_language: Optional[str] = None, framework: Optional[str] = None, task: Optional[str] = None, training_details: Optional[str] = None, variations: Optional[str] = None, fine_tunable: Optional[bool] = None, amount_of_credits: Optional[int] = None, tags: Optional[List[str]] = None ) \u2192 CreateAssetResultDto It creates a new asset with file associated to it. The file asset must be associated to a Payment Plan. Users that are subscribers of a payment plan can download the files attached to it. Depending on the Payment Plan and the configuration of the file asset, the download will consume credits. When the plan expires (because the time is over or the credits are consumed), the user needs to renew the plan to continue downloading the files. This method is oriented to AI Builders https://docs.nevermined.app/docs/tutorials/builders/register-file-asset Args: plan_did (str): The DID of the plan. asset_type (str): The type of the asset. -> 'algorithm' | 'model' | 'dataset' | 'file' name (str): The name of the file. description (str): The description of the file. files (List[dict]): The files of the file. data_schema (str, optional): The data schema of the file. sample_code (str, optional): The sample code of the file. files_format (str, optional): The files format of the file. usage_example (str, optional): The usage example of the file. programming_language (str, optional): The programming language of the file. framework (str, optional): The framework of the file. task (str, optional): The task of the file. training_details (str, optional): The training details of the file. variations (str, optional): The variations of the file. fine_tunable (bool, optional): The fine tunable of the file. amount_of_credits (int, optional): The amount of credits for the file. tags (List[str], optional): The tags associated with the file. Returns: CreateAssetResultDto : The result of the creation operation. Raises: HTTPError : If the API call fails. Example: response = your_instance.create_file(plan_did=\"did:nv:xyz789\", asset_type=\"dataset\", name=\"Sample Dataset\", description=\"A sample dataset\", files=[{\"name\": \"file1.csv\", \"url\": \"https://example.com/file1.csv\"}]) print(response)","title":"method create_file"},{"location":"payments/#method-create_service","text":"create_service( plan_did: str, service_type: str, name: str, description: str, service_charge_type: str, auth_type: str, amount_of_credits: int = 1, min_credits_to_charge: Optional[int] = 1, max_credits_to_charge: Optional[int] = 1, username: Optional[str] = None, password: Optional[str] = None, token: Optional[str] = None, endpoints: Optional[List[dict]] = None, open_endpoints: Optional[List[str]] = [], open_api_url: Optional[str] = None, integration: Optional[str] = None, sample_link: Optional[str] = None, api_description: Optional[str] = None, tags: Optional[List[str]] = None, is_nevermined_hosted: Optional[bool] = None, implements_query_protocol: Optional[bool] = None, query_protocol_version: Optional[str] = None, service_host: Optional[str] = None ) \u2192 CreateAssetResultDto It creates a new AI Agent or Service on Nevermined. The agent/service must be associated to a Payment Plan. Users that are subscribers of a payment plan can access the agent/service. Depending on the Payment Plan and the configuration of the agent/service, the usage of the agent/service will consume credits. When the plan expires (because the time is over or the credits are consumed), the user needs to renew the plan to continue using the agent/service. This method is oriented to AI Builders https://docs.nevermined.app/docs/tutorials/builders/register-agent Args: plan_did (str): The DID of the plan. service_type (str): The type of the service. Options: 'service', 'agent', 'assistant' name (str): The name of the service. description (str): The description of the service. service_charge_type (str): The charge type of the service. Options: 'fixed', 'dynamic' auth_type (str): The authentication type of the service. Options: 'none', 'basic', 'oauth' amount_of_credits (int): The amount of credits for the service. min_credits_to_charge (int, optional): The minimum credits to charge for the service. Only required for dynamic services. max_credits_to_charge (int, optional): The maximum credits to charge for the service. Only required for dynamic services. username (str, optional): The username for authentication. password (str, optional): The password for authentication. token (str, optional): The token for authentication. endpoints (List[Dict[str, str]], optional): The endpoints of the service. open_endpoints (List[str], optional): The open endpoints of the service. open_api_url (str, optional): The OpenAPI URL of the service. integration (str, optional): The integration type of the service. sample_link (str, optional): The sample link of the service. api_description (str, optional): The API description of the service. tags (List[str], optional): The tags associated with the service. is_nevermined_hosted (bool, optional): Indicates if the service is hosted by Nevermined. implements_query_protocol (bool, optional): Indicates if the service implements the query protocol. query_protocol_version (str, optional): The version of the query protocol implemented by the service. service_host (str, optional): The host of the service. Returns: CreateAssetResultDto : The result of the creation operation. Raises: HTTPError : If the API call fails. Example: response = your_instance.create_service(plan_did=\"did:nv:abc123\", service_type=\"service\", name=\"My Service\", description=\"A sample service\", service_charge_type=\"fixed\", auth_type=\"none\") print(response)","title":"method create_service"},{"location":"payments/#method-create_time_plan","text":"create_time_plan( name: str, description: str, price: int, token_address: str, duration: Optional[int] = 0, tags: Optional[List[str]] = None ) \u2192 CreateAssetResultDto It allows to an AI Builder to create a Payment Plan on Nevermined based on Time. A Nevermined Time Plan limits the access by the a specific amount of time. With them, AI Builders can specify the duration of the Payment Plan (1 month, 1 year, etc.). When the time period is over, the plan automatically expires and the user needs to renew it. This method is oriented to AI Builders https://docs.nevermined.app/docs/tutorials/builders/create-plan Args: name (str): The name of the plan. description (str): The description of the plan. price (int): The price of the plan. token_address (str): The token address. duration (int, optional): The duration of the plan in days. If not provided, the plan will be valid forever. tags (List[str], optional): The tags associated with the plan. Returns: CreateAssetResultDto : The result of the creation operation. Raises: HTTPError : If the API call fails. Example: response = your_instance.create_time_plan(name=\"Yearly Plan\", description=\"Annual plan\", price=1200, token_address=\"0x5678\", duration=365, tags=[\"yearly\", \"premium\"]) print(response)","title":"method create_time_plan"},{"location":"payments/#method-download_file","text":"download_file( file_did: str, destination: str, agreement_id: Optional[str] = None ) \u2192 DownloadFileResultDto Downloads the file. Args: file_did (str): The DID of the file. agreement_id (str, optional): The agreement ID. destination str : The destination of the file. Returns: Response : The url of the file. Returns: DownloadFileResultDto : The result of the download operation. Raises: HTTPError : If the API call fails. Example: response = your_instance.download_file(file_did=\"did:nv:7e38d39405445ab3e5435d8c1c6653a00ddc425ba629789f58fbefccaa5e5a5d\", destination=\"/tmp\") print(response)","title":"method download_file"},{"location":"payments/#method-get_asset_ddo","text":"get_asset_ddo(did: str) Get the Metadata (aka Decentralized Document or DDO) for a given asset identifier (DID). https://docs.nevermined.io/docs/architecture/specs/Spec-DID https://docs.nevermined.io/docs/architecture/specs/Spec-METADATA Args: did (str): The unique identifier (aka DID) of the asset (payment plan, agent, file, etc). Returns: Response : The response from the API call.","title":"method get_asset_ddo"},{"location":"payments/#method-get_checkout_plan","text":"get_checkout_plan(plan_did: str) Gets the checkout plan. Args: plan_did (str): The DID of the plan. Returns: Response : The url of the checkout plan.","title":"method get_checkout_plan"},{"location":"payments/#method-get_file_details_url","text":"get_file_details_url(file_did: str) Gets the file details. Args: file_did (str): The DID of the file. Returns: Response : The url of the file details.","title":"method get_file_details_url"},{"location":"payments/#method-get_plan_associated_files","text":"get_plan_associated_files(plan_did: str) Get array of files DIDs associated with a payment plan. Args: plan_did (str): The DID of the plan. Returns: Response : List of DIDs of the associated files.","title":"method get_plan_associated_files"},{"location":"payments/#method-get_plan_associated_services","text":"get_plan_associated_services(plan_did: str) Get array of services/agent DIDs associated with a payment plan. Args: plan_did (str): The DID of the plan. Returns: Response : List of DIDs of the associated services.","title":"method get_plan_associated_services"},{"location":"payments/#method-get_plan_balance","text":"get_plan_balance(plan_did: str, account_address: str) \u2192 BalanceResultDto Get the balance of an account for a Payment Plan. Args: plan_did (str): The DID of the plan. account_address (str): The account address. Returns: BalanceResultDto : The response from the API call formatted as a BalanceResultDto. Raises: HTTPError : If the API call fails. Example: response = your_instance.get_plan_balance(plan_did=\"did:example:123456\", account_address=\"0xABC123\") response.raise_for_status() balance = BalanceResultDto.model_validate(response.json()) print(balance) Expected Response: { \"planType\": \"credits\", \"isOwner\": True, \"isSubscriptor\": True, \"balance\": 10000000 }","title":"method get_plan_balance"},{"location":"payments/#method-get_plan_details_url","text":"get_plan_details_url(plan_did: str) Gets the plan details. Args: plan_did (str): The DID of the plan. Returns: Response : The url of the plan details.","title":"method get_plan_details_url"},{"location":"payments/#method-get_service_details_url","text":"get_service_details_url(service_did: str) Gets the service details. Args: service_did (str): The DID of the service. Returns: Response : The url of the service details.","title":"method get_service_details_url"},{"location":"payments/#method-get_service_token","text":"get_service_token(service_did: str) \u2192 ServiceTokenResultDto Get the required configuration for accessing a remote service agent. This configuration includes: - The JWT access token - The Proxy url that can be used to query the agent/service. Args: service_did (str): The DID of the service. Returns: ServiceTokenResultDto : The result of the creation operation. Raises: HTTPError : If the API call fails. Example: response = your_instance.get_service_token(service_did=\"did:nv:xyz789\") print(response)","title":"method get_service_token"},{"location":"payments/#method-mint_credits","text":"mint_credits(plan_did: str, amount: str, receiver: str) \u2192 MintResultDto Mints the credits associated with a plan and sends them to the receiver. Args: plan_did (str): The DID of the plan. amount (str): The amount of credits to mint. receiver (str): The receiver address of the credits. Returns: MintResultDto : The result of the minting operation. Raises: HTTPError : If the API call fails. Example: response = your_instance.mint_credits(plan_did=\"did:nv:e405a91e3152be1430c5d0607ebdf9236c19f34bfba0320798d81ba5f5e3e3a5\", amount=\"12\", receiver=\"0x4fe3e7d42fA83be4E8cF03451Ac3F25980a73fF6\") print(response)","title":"method mint_credits"},{"location":"payments/#method-order_plan","text":"order_plan( plan_did: str, agreementId: Optional[str] = None ) \u2192 OrderPlanResultDto Orders a Payment Plan. The user needs to have enough balance in the token selected by the owner of the Payment Plan. The payment is done using Crypto. Payments using Fiat can be done via the Nevermined App. Args: plan_did (str): The DID of the plan. agreementId (str, optional): The agreement ID. Returns: OrderPlanResultDto : The result of the order operation, containing the agreement ID and success status. Raises: HTTPError : If the API call fails. Example: response = your_instance.order_plan(plan_did=\"did:nv:a0079b517e580d430916924f1940b764e17c31e368c509483426f8c2ac2e7116\") print(response) This file was automatically generated via lazydocs .","title":"method order_plan"},{"location":"utils/","text":"module utils function snake_to_camel snake_to_camel(name) Convert snake_case to camelCase. :param name: str :return: str This file was automatically generated via lazydocs .","title":"Utils"},{"location":"utils/#module-utils","text":"","title":"module utils"},{"location":"utils/#function-snake_to_camel","text":"snake_to_camel(name) Convert snake_case to camelCase. :param name: str :return: str This file was automatically generated via lazydocs .","title":"function snake_to_camel"}]}
\ No newline at end of file
diff --git a/tests/payments_test.py b/tests/payments_test.py
index c677635..7659a12 100644
--- a/tests/payments_test.py
+++ b/tests/payments_test.py
@@ -13,11 +13,11 @@
@pytest.fixture
def payment():
- return Payments(nvm_api_key=nvm_api_key, environment=Environment.appStaging, app_id="your_app_id", version="1.0.0", ai_protocol=False)
+ return Payments(nvm_api_key=nvm_api_key, environment=Environment.staging, app_id="your_app_id", version="1.0.0", ai_protocol=False)
def test_payment_creation(payment):
- assert payment.environment == Environment.appStaging
+ assert payment.environment == Environment.staging
assert payment.app_id == "your_app_id"
assert payment.version == "1.0.0"
assert payment.nvm_api_key == nvm_api_key
diff --git a/tests/protocol_test.py b/tests/protocol_test.py
index 4a85a2f..5894a04 100644
--- a/tests/protocol_test.py
+++ b/tests/protocol_test.py
@@ -17,25 +17,25 @@
@pytest.fixture
def ai_query_api_build_fixture():
- return Payments(nvm_api_key=nvm_api_key, environment=Environment.appStaging, app_id="your_app_id", version="1.0.0", ai_protocol=True, web_socket_options={'bearer_token': nvm_api_key})
+ return Payments(nvm_api_key=nvm_api_key, environment=Environment.staging, app_id="your_app_id", version="1.0.0", ai_protocol=True, web_socket_options={'bearer_token': nvm_api_key})
@pytest.fixture
def ai_query_api_subscriber_fixture():
- return Payments(nvm_api_key=nvm_api_key2, environment=Environment.appStaging, app_id="your_app_id", version="1.0.0", ai_protocol=True, web_socket_options={'bearer_token': nvm_api_key2})
+ return Payments(nvm_api_key=nvm_api_key2, environment=Environment.staging, app_id="your_app_id", version="1.0.0", ai_protocol=True, web_socket_options={'bearer_token': nvm_api_key2})
def test_AIQueryApi_creation(ai_query_api_build_fixture):
ai_query_api = ai_query_api_build_fixture
- assert ai_query_api.opts.backend_host == Environment.appStaging.value['backend']
+ assert ai_query_api.opts.backend_host == Environment.staging.value['backend']
assert ai_query_api.opts.api_key == nvm_api_key
- assert ai_query_api.opts.proxy_host == Environment.appStaging.value['proxy']
- assert ai_query_api.opts.web_socket_host == Environment.appStaging.value['websocket']
+ assert ai_query_api.opts.proxy_host == Environment.staging.value['proxy']
+ assert ai_query_api.opts.web_socket_host == Environment.staging.value['websocket']
assert ai_query_api.opts.web_socket_options['bearer_token'] == nvm_api_key
assert ai_query_api.socket_client
assert ai_query_api.user_room_id
async def eventsReceived(data):
- payments_builder = Payments(nvm_api_key=nvm_api_key, environment=Environment.appStaging, app_id="your_app_id", version="1.0.0", ai_protocol=True, web_socket_options={'bearer_token': nvm_api_key})
+ payments_builder = Payments(nvm_api_key=nvm_api_key, environment=Environment.staging, app_id="your_app_id", version="1.0.0", ai_protocol=True, web_socket_options={'bearer_token': nvm_api_key})
global response_data
print('eventsReceived::', len(data))
if isinstance(data, list):
From c780badd2d95b23539b984e1575d1ba86aebe3d7 Mon Sep 17 00:00:00 2001
From: enrique
Date: Mon, 21 Oct 2024 09:21:32 +0200
Subject: [PATCH 4/4] feat: add method to pick env
---
payments_py/environments.py | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/payments_py/environments.py b/payments_py/environments.py
index 0a94ee9..0415d43 100644
--- a/payments_py/environments.py
+++ b/payments_py/environments.py
@@ -17,4 +17,18 @@ class Environment(Enum):
arbitrum = {"frontend": "https://nevermined.app", "backend": "https://one-backend.arbitrum.nevermined.app", "websocket": "wss://one-backend.arbitrum.nevermined.app", "proxy": "https://proxy.arbitrum.nevermined.app"}
appPeaq = {"frontend": "https://peaq.nevermined.app", "backend": "https://one-backend.peaq.nevermined.app"}
- # Define more environments as needed...
\ No newline at end of file
+ @classmethod
+ def get_environment(cls, name):
+ """
+ Get the environment by name
+
+ Args:
+ name (str): The name of the environment
+
+ Example:
+ env = Environment.get_environment('local')
+ """
+ try:
+ return cls[name].value
+ except KeyError:
+ raise ValueError(f"Environment '{name}' is not defined.")