mech-client 0.4.0__tar.gz → 0.6.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. {mech_client-0.4.0 → mech_client-0.6.0}/PKG-INFO +45 -13
  2. {mech_client-0.4.0 → mech_client-0.6.0}/README.md +43 -12
  3. mech_client-0.6.0/mech_client/__init__.py +3 -0
  4. mech_client-0.6.0/mech_client/abis/AgentMech.json +718 -0
  5. mech_client-0.6.0/mech_client/abis/AgentRegistry.json +1037 -0
  6. mech_client-0.6.0/mech_client/abis/AgreementStoreManager.base.json +766 -0
  7. mech_client-0.6.0/mech_client/abis/AgreementStoreManager.gnosis.json +766 -0
  8. mech_client-0.6.0/mech_client/abis/DIDRegistry.base.json +2476 -0
  9. mech_client-0.6.0/mech_client/abis/DIDRegistry.gnosis.json +2476 -0
  10. mech_client-0.6.0/mech_client/abis/EscrowPaymentCondition.base.json +717 -0
  11. mech_client-0.6.0/mech_client/abis/EscrowPaymentCondition.gnosis.json +717 -0
  12. mech_client-0.6.0/mech_client/abis/LockPaymentCondition.base.json +874 -0
  13. mech_client-0.6.0/mech_client/abis/LockPaymentCondition.gnosis.json +874 -0
  14. mech_client-0.6.0/mech_client/abis/NFTSalesTemplate.base.json +698 -0
  15. mech_client-0.6.0/mech_client/abis/NFTSalesTemplate.gnosis.json +698 -0
  16. mech_client-0.6.0/mech_client/abis/NeverminedConfig.base.json +587 -0
  17. mech_client-0.6.0/mech_client/abis/NeverminedConfig.gnosis.json +587 -0
  18. mech_client-0.6.0/mech_client/abis/SubscriptionNFT.base.json +300 -0
  19. mech_client-0.6.0/mech_client/abis/SubscriptionNFT.gnosis.json +300 -0
  20. mech_client-0.6.0/mech_client/abis/SubscriptionToken.base.json +1393 -0
  21. mech_client-0.6.0/mech_client/abis/TransferNFTCondition.base.json +1062 -0
  22. mech_client-0.6.0/mech_client/abis/TransferNFTCondition.gnosis.json +1062 -0
  23. {mech_client-0.4.0 → mech_client-0.6.0}/mech_client/cli.py +99 -10
  24. {mech_client-0.4.0 → mech_client-0.6.0}/mech_client/configs/mechs.json +1 -7
  25. {mech_client-0.4.0 → mech_client-0.6.0}/mech_client/interact.py +14 -39
  26. {mech_client-0.4.0 → mech_client-0.6.0}/mech_client/marketplace_interact.py +130 -90
  27. {mech_client-0.4.0 → mech_client-0.6.0}/mech_client/mech_tool_management.py +11 -5
  28. {mech_client-0.4.0 → mech_client-0.6.0}/mech_client/subgraph.py +21 -35
  29. {mech_client-0.4.0 → mech_client-0.6.0}/mech_client/wss.py +7 -6
  30. {mech_client-0.4.0 → mech_client-0.6.0}/pyproject.toml +2 -1
  31. mech_client-0.4.0/mech_client/__init__.py +0 -3
  32. {mech_client-0.4.0 → mech_client-0.6.0}/LICENSE +0 -0
  33. {mech_client-0.4.0 → mech_client-0.6.0}/mech_client/abis/BalanceTrackerFixedPriceNative.json +0 -0
  34. {mech_client-0.4.0 → mech_client-0.6.0}/mech_client/abis/BalanceTrackerFixedPriceToken.json +0 -0
  35. {mech_client-0.4.0 → mech_client-0.6.0}/mech_client/abis/BalanceTrackerNvmSubscriptionNative.json +0 -0
  36. {mech_client-0.4.0 → mech_client-0.6.0}/mech_client/abis/BalanceTrackerNvmSubscriptionToken.json +0 -0
  37. {mech_client-0.4.0 → mech_client-0.6.0}/mech_client/abis/IERC1155.json +0 -0
  38. {mech_client-0.4.0 → mech_client-0.6.0}/mech_client/abis/IMech.json +0 -0
  39. {mech_client-0.4.0 → mech_client-0.6.0}/mech_client/abis/IToken.json +0 -0
  40. {mech_client-0.4.0 → mech_client-0.6.0}/mech_client/abis/MechMarketplace.json +0 -0
  41. {mech_client-0.4.0 → mech_client-0.6.0}/mech_client/acn.py +0 -0
  42. {mech_client-0.4.0 → mech_client-0.6.0}/mech_client/fetch_ipfs_hash.py +0 -0
  43. {mech_client-0.4.0 → mech_client-0.6.0}/mech_client/helpers/__init__.py +0 -0
  44. {mech_client-0.4.0 → mech_client-0.6.0}/mech_client/helpers/acn/README.md +0 -0
  45. {mech_client-0.4.0 → mech_client-0.6.0}/mech_client/helpers/acn/__init__.py +0 -0
  46. {mech_client-0.4.0 → mech_client-0.6.0}/mech_client/helpers/acn/acn.proto +0 -0
  47. {mech_client-0.4.0 → mech_client-0.6.0}/mech_client/helpers/acn/acn_pb2.py +0 -0
  48. {mech_client-0.4.0 → mech_client-0.6.0}/mech_client/helpers/acn/custom_types.py +0 -0
  49. {mech_client-0.4.0 → mech_client-0.6.0}/mech_client/helpers/acn/dialogues.py +0 -0
  50. {mech_client-0.4.0 → mech_client-0.6.0}/mech_client/helpers/acn/message.py +0 -0
  51. {mech_client-0.4.0 → mech_client-0.6.0}/mech_client/helpers/acn/protocol.yaml +0 -0
  52. {mech_client-0.4.0 → mech_client-0.6.0}/mech_client/helpers/acn/serialization.py +0 -0
  53. {mech_client-0.4.0 → mech_client-0.6.0}/mech_client/helpers/acn/tests/__init__.py +0 -0
  54. {mech_client-0.4.0 → mech_client-0.6.0}/mech_client/helpers/acn/tests/test_acn.py +0 -0
  55. {mech_client-0.4.0 → mech_client-0.6.0}/mech_client/helpers/acn/tests/test_acn_dialogues.py +0 -0
  56. {mech_client-0.4.0 → mech_client-0.6.0}/mech_client/helpers/acn/tests/test_acn_messages.py +0 -0
  57. {mech_client-0.4.0 → mech_client-0.6.0}/mech_client/helpers/acn_data_share/README.md +0 -0
  58. {mech_client-0.4.0 → mech_client-0.6.0}/mech_client/helpers/acn_data_share/__init__.py +0 -0
  59. {mech_client-0.4.0 → mech_client-0.6.0}/mech_client/helpers/acn_data_share/acn_data_share.proto +0 -0
  60. {mech_client-0.4.0 → mech_client-0.6.0}/mech_client/helpers/acn_data_share/acn_data_share_pb2.py +0 -0
  61. {mech_client-0.4.0 → mech_client-0.6.0}/mech_client/helpers/acn_data_share/dialogues.py +0 -0
  62. {mech_client-0.4.0 → mech_client-0.6.0}/mech_client/helpers/acn_data_share/message.py +0 -0
  63. {mech_client-0.4.0 → mech_client-0.6.0}/mech_client/helpers/acn_data_share/protocol.yaml +0 -0
  64. {mech_client-0.4.0 → mech_client-0.6.0}/mech_client/helpers/acn_data_share/serialization.py +0 -0
  65. {mech_client-0.4.0 → mech_client-0.6.0}/mech_client/helpers/acn_data_share/tests/test_acn_data_share_dialogues.py +0 -0
  66. {mech_client-0.4.0 → mech_client-0.6.0}/mech_client/helpers/acn_data_share/tests/test_acn_data_share_messages.py +0 -0
  67. {mech_client-0.4.0 → mech_client-0.6.0}/mech_client/helpers/p2p_libp2p_client/README.md +0 -0
  68. {mech_client-0.4.0 → mech_client-0.6.0}/mech_client/helpers/p2p_libp2p_client/__init__.py +0 -0
  69. {mech_client-0.4.0 → mech_client-0.6.0}/mech_client/helpers/p2p_libp2p_client/connection.py +0 -0
  70. {mech_client-0.4.0 → mech_client-0.6.0}/mech_client/helpers/p2p_libp2p_client/connection.yaml +0 -0
  71. {mech_client-0.4.0 → mech_client-0.6.0}/mech_client/prompt_to_ipfs.py +0 -0
  72. {mech_client-0.4.0 → mech_client-0.6.0}/mech_client/push_to_ipfs.py +0 -0
  73. {mech_client-0.4.0 → mech_client-0.6.0}/mech_client/to_png.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: mech-client
3
- Version: 0.4.0
3
+ Version: 0.6.0
4
4
  Summary: Basic client to interact with a mech
5
5
  License: Apache-2.0
6
6
  Author: David Minarsch
@@ -16,6 +16,7 @@ Requires-Dist: open-aea-cli-ipfs (>=1.53.0,<2.0.0)
16
16
  Requires-Dist: open-aea-ledger-cosmos (>=1.53.0,<2.0.0)
17
17
  Requires-Dist: open-aea-ledger-ethereum (>=1.53.0,<2.0.0)
18
18
  Requires-Dist: open-aea[cli] (>=1.53.0,<2.0.0)
19
+ Requires-Dist: setuptools (>=77.0.3,<78.0.0)
19
20
  Requires-Dist: tabulate (>=0.9.0,<0.10.0)
20
21
  Requires-Dist: websocket-client (>=0.32.0,<1)
21
22
  Description-Content-Type: text/markdown
@@ -143,15 +144,17 @@ export MECHX_API_KEY=<your api key>
143
144
  The basic usage of the Mech Client is as follows:
144
145
 
145
146
  ```bash
146
- mechx interact <prompt> --agent_id <agent_id>
147
+ mechx interact --prompts <prompt> --tools <tool> --agent_id <agent_id>
147
148
  ```
148
149
 
149
- where agent with `<agent_id>` will process `<prompt>` with the default options. Each chain has its own set of Mech agents. You can find the agent IDs for each chain on the [Mech Hub](https://aimechs.autonolas.network/registry) or on the [Mech repository](https://github.com/valory-xyz/mech?tab=readme-ov-file#examples-of-deployed-mechs).
150
+ where agent with `<agent_id>` will process `<prompt>` with the `<tool>` and default options. Each chain has its own set of Mech agents. You can find the agent IDs for each chain on the [Mech Hub](https://aimechs.autonolas.network/registry) or on the [Mech repository](https://github.com/valory-xyz/mech?tab=readme-ov-file#examples-of-deployed-mechs).
151
+
152
+ ⚠️ Batch requests and tools are not supported for legacy mechs
150
153
 
151
154
  Some useful options:
152
155
 
153
156
  - `--key <private_key_path>`: Specifies the path of the private key. The default value is `./ethereum_private_key.txt`.
154
- - `--tool <name>`: Name of the tool to process the prompt. If you are aware about the tools that are provided by an agent you can directly provide its name using this option. If not provided, it will show a list of available tools for the agent so that you can select which one you want to use:
157
+ - `--tools <name>`: Name of the tool to process the prompt. If you are aware about the tools that are provided by an agent you can directly provide its name using this option. If not provided, it will show a list of available tools for the agent so that you can select which one you want to use:
155
158
 
156
159
  ```text
157
160
  Select prompting tool
@@ -177,12 +180,12 @@ Some useful options:
177
180
  - `on-chain`: Wait for the result using the Subgraph and the Websocket subscription (whichever arrives first).
178
181
  - `wait-for-both` (Default): Wait for the result using both `off-chain` and `on-chain` (whichever arrives first).
179
182
 
180
- ### Example
183
+ ##### Example
181
184
 
182
185
  Example of a request specifying a key file and tool:
183
186
 
184
187
  ```bash
185
- mechx interact "write a short poem" --agent_id 6 --key ~/ethereum_private_key.txt --tool openai-gpt-3.5-turbo --chain-config gnosis --confirm on-chain
188
+ mechx interact --prompts "write a short poem" --agent_id 6 --key ~/ethereum_private_key.txt --tools openai-gpt-3.5-turbo --chain-config gnosis --confirm on-chain
186
189
  ```
187
190
 
188
191
  You will see an output like this:
@@ -199,23 +202,53 @@ Data from agent: {'requestId': 1004074058566339663950817114309409628095686850319
199
202
 
200
203
  #### With the Mech Marketplace
201
204
 
202
- With the Mech Marketplace, the basic usage of the Mech Client is as follows.
205
+ With the Mech Marketplace, in order to pay for the Mech fees, you can make a deposit before sending requests. The deposit depends on the
206
+ payment model of the Mech. For a fixed price Mech receiving payments in native token, use the following:
207
+
208
+ ```bash
209
+ mechx deposit-native --chain-config <chain_config> <amount>
210
+ ```
211
+
212
+ For a fixed price Mech receiving payments in OLAS, use the following (the amount is in ether):
203
213
 
204
214
  ```bash
205
- mechx interact <prompt> --tool openai-gpt-3.5-turbo --chain-config <chain_config>
215
+ mechx deposit-token --chain-config <chain_config> <amount>
206
216
  ```
207
217
 
208
- To use a custom mech to send requests to, use the `priority-mech` flag while sending the requests
218
+ For a Mech using Nevermined subscriptions, to make requests, it is necessary to buy a subscription. To do that you can use the following command:
219
+
220
+ ```bash
221
+ mechx purchase-nvm-subscription --chain-config <chain_config>
222
+ ```
223
+
224
+ :warning: If you face issues with base RPC, please consider updating to a new one [here](https://github.com/valory-xyz/mech-client/blob/feat/nvm_sub_integration/scripts/nvm_subscription/resources/networks.json#L10).
225
+
226
+ You can use the option `--key <private_key_file_path>` in order to customize the path to the private key file.
227
+
228
+ The basic usage of the Mech Client is then as follows.
209
229
 
210
230
  ```bash
211
- mechx interact <prompt> --priority-mech <priority mech address> --tool openai-gpt-3.5-turbo --chain-config <chain_config>
231
+ mechx interact --prompts <prompt> --priority-mech <priority mech address> --tools openai-gpt-3.5-turbo --chain-config <chain_config>
212
232
  ```
213
233
 
214
234
  Additionally to other options which are the same as for legacy Mechs, this usage has the following option:
215
235
 
216
- `--use-prepaid <bool>`: use the prepaid method to send requests to a Mech via the Mech Marketplace. Defaults to False.
236
+ `--use-prepaid <bool>`: use the prepaid method to send requests to a Mech via the Mech Marketplace. Defaults to False. <br>
217
237
  `--use-offchain <bool>`: use the off-chain method to send requests to a Mech via the Mech Marketplace. Defaults to False.
218
238
 
239
+ The Mech Client can also be used to send batch requests. There are couple of different ways to achieve this:
240
+
241
+ ```bash
242
+ mechx interact --prompts={<prompt-1>,<prompt-2>} --priority-mech <priority mech address> --tools={<tool-1>,<tool-2>} --chain-config <chain_config>
243
+ ```
244
+
245
+ or <br>
246
+
247
+ ```bash
248
+ mechx interact --prompts <prompt-1> --prompts <prompt-2> --priority-mech <priority mech address> --tools <tool-1> --tools <tool-2> --chain-config <chain_config>
249
+ ```
250
+
251
+
219
252
  ### List tools available for agents
220
253
 
221
254
  To list the tools available for a specific agent or for all agents, use the `tools-for-agents` command. You can specify an agent ID to get tools for a specific agent, or omit it to list tools for all agents.
@@ -336,7 +369,6 @@ Additionally, you can override any configuration parameter by exporting any of t
336
369
  MECHX_CHAIN_RPC
337
370
  MECHX_WSS_ENDPOINT
338
371
  MECHX_GAS_LIMIT
339
- MECHX_CONTRACT_ABI_URL
340
372
  MECHX_TRANSACTION_URL
341
373
  MECHX_SUBGRAPH_URL
342
374
 
@@ -476,7 +508,7 @@ You can find the agent IDs for each chain on the [Mech Hub](https://aimechs.auto
476
508
  Use the `--chain-config <name>` parameter together with a valid `<agent_id>`, for example:
477
509
 
478
510
  ```bash
479
- mechx interact "write a short poem" 2 --key ./ethereum_private_key.txt --tool openai-gpt-4 --chain-config celo --confirm on-chain
511
+ mechx interact --prompts "write a short poem" --agent_id 2 --key ./ethereum_private_key.txt --tools openai-gpt-4 --chain-config celo --confirm on-chain
480
512
  ```
481
513
 
482
514
  </details>
@@ -121,15 +121,17 @@ export MECHX_API_KEY=<your api key>
121
121
  The basic usage of the Mech Client is as follows:
122
122
 
123
123
  ```bash
124
- mechx interact <prompt> --agent_id <agent_id>
124
+ mechx interact --prompts <prompt> --tools <tool> --agent_id <agent_id>
125
125
  ```
126
126
 
127
- where agent with `<agent_id>` will process `<prompt>` with the default options. Each chain has its own set of Mech agents. You can find the agent IDs for each chain on the [Mech Hub](https://aimechs.autonolas.network/registry) or on the [Mech repository](https://github.com/valory-xyz/mech?tab=readme-ov-file#examples-of-deployed-mechs).
127
+ where agent with `<agent_id>` will process `<prompt>` with the `<tool>` and default options. Each chain has its own set of Mech agents. You can find the agent IDs for each chain on the [Mech Hub](https://aimechs.autonolas.network/registry) or on the [Mech repository](https://github.com/valory-xyz/mech?tab=readme-ov-file#examples-of-deployed-mechs).
128
+
129
+ ⚠️ Batch requests and tools are not supported for legacy mechs
128
130
 
129
131
  Some useful options:
130
132
 
131
133
  - `--key <private_key_path>`: Specifies the path of the private key. The default value is `./ethereum_private_key.txt`.
132
- - `--tool <name>`: Name of the tool to process the prompt. If you are aware about the tools that are provided by an agent you can directly provide its name using this option. If not provided, it will show a list of available tools for the agent so that you can select which one you want to use:
134
+ - `--tools <name>`: Name of the tool to process the prompt. If you are aware about the tools that are provided by an agent you can directly provide its name using this option. If not provided, it will show a list of available tools for the agent so that you can select which one you want to use:
133
135
 
134
136
  ```text
135
137
  Select prompting tool
@@ -155,12 +157,12 @@ Some useful options:
155
157
  - `on-chain`: Wait for the result using the Subgraph and the Websocket subscription (whichever arrives first).
156
158
  - `wait-for-both` (Default): Wait for the result using both `off-chain` and `on-chain` (whichever arrives first).
157
159
 
158
- ### Example
160
+ ##### Example
159
161
 
160
162
  Example of a request specifying a key file and tool:
161
163
 
162
164
  ```bash
163
- mechx interact "write a short poem" --agent_id 6 --key ~/ethereum_private_key.txt --tool openai-gpt-3.5-turbo --chain-config gnosis --confirm on-chain
165
+ mechx interact --prompts "write a short poem" --agent_id 6 --key ~/ethereum_private_key.txt --tools openai-gpt-3.5-turbo --chain-config gnosis --confirm on-chain
164
166
  ```
165
167
 
166
168
  You will see an output like this:
@@ -177,23 +179,53 @@ Data from agent: {'requestId': 1004074058566339663950817114309409628095686850319
177
179
 
178
180
  #### With the Mech Marketplace
179
181
 
180
- With the Mech Marketplace, the basic usage of the Mech Client is as follows.
182
+ With the Mech Marketplace, in order to pay for the Mech fees, you can make a deposit before sending requests. The deposit depends on the
183
+ payment model of the Mech. For a fixed price Mech receiving payments in native token, use the following:
184
+
185
+ ```bash
186
+ mechx deposit-native --chain-config <chain_config> <amount>
187
+ ```
188
+
189
+ For a fixed price Mech receiving payments in OLAS, use the following (the amount is in ether):
181
190
 
182
191
  ```bash
183
- mechx interact <prompt> --tool openai-gpt-3.5-turbo --chain-config <chain_config>
192
+ mechx deposit-token --chain-config <chain_config> <amount>
184
193
  ```
185
194
 
186
- To use a custom mech to send requests to, use the `priority-mech` flag while sending the requests
195
+ For a Mech using Nevermined subscriptions, to make requests, it is necessary to buy a subscription. To do that you can use the following command:
196
+
197
+ ```bash
198
+ mechx purchase-nvm-subscription --chain-config <chain_config>
199
+ ```
200
+
201
+ :warning: If you face issues with base RPC, please consider updating to a new one [here](https://github.com/valory-xyz/mech-client/blob/feat/nvm_sub_integration/scripts/nvm_subscription/resources/networks.json#L10).
202
+
203
+ You can use the option `--key <private_key_file_path>` in order to customize the path to the private key file.
204
+
205
+ The basic usage of the Mech Client is then as follows.
187
206
 
188
207
  ```bash
189
- mechx interact <prompt> --priority-mech <priority mech address> --tool openai-gpt-3.5-turbo --chain-config <chain_config>
208
+ mechx interact --prompts <prompt> --priority-mech <priority mech address> --tools openai-gpt-3.5-turbo --chain-config <chain_config>
190
209
  ```
191
210
 
192
211
  Additionally to other options which are the same as for legacy Mechs, this usage has the following option:
193
212
 
194
- `--use-prepaid <bool>`: use the prepaid method to send requests to a Mech via the Mech Marketplace. Defaults to False.
213
+ `--use-prepaid <bool>`: use the prepaid method to send requests to a Mech via the Mech Marketplace. Defaults to False. <br>
195
214
  `--use-offchain <bool>`: use the off-chain method to send requests to a Mech via the Mech Marketplace. Defaults to False.
196
215
 
216
+ The Mech Client can also be used to send batch requests. There are couple of different ways to achieve this:
217
+
218
+ ```bash
219
+ mechx interact --prompts={<prompt-1>,<prompt-2>} --priority-mech <priority mech address> --tools={<tool-1>,<tool-2>} --chain-config <chain_config>
220
+ ```
221
+
222
+ or <br>
223
+
224
+ ```bash
225
+ mechx interact --prompts <prompt-1> --prompts <prompt-2> --priority-mech <priority mech address> --tools <tool-1> --tools <tool-2> --chain-config <chain_config>
226
+ ```
227
+
228
+
197
229
  ### List tools available for agents
198
230
 
199
231
  To list the tools available for a specific agent or for all agents, use the `tools-for-agents` command. You can specify an agent ID to get tools for a specific agent, or omit it to list tools for all agents.
@@ -314,7 +346,6 @@ Additionally, you can override any configuration parameter by exporting any of t
314
346
  MECHX_CHAIN_RPC
315
347
  MECHX_WSS_ENDPOINT
316
348
  MECHX_GAS_LIMIT
317
- MECHX_CONTRACT_ABI_URL
318
349
  MECHX_TRANSACTION_URL
319
350
  MECHX_SUBGRAPH_URL
320
351
 
@@ -454,7 +485,7 @@ You can find the agent IDs for each chain on the [Mech Hub](https://aimechs.auto
454
485
  Use the `--chain-config <name>` parameter together with a valid `<agent_id>`, for example:
455
486
 
456
487
  ```bash
457
- mechx interact "write a short poem" 2 --key ./ethereum_private_key.txt --tool openai-gpt-4 --chain-config celo --confirm on-chain
488
+ mechx interact --prompts "write a short poem" --agent_id 2 --key ./ethereum_private_key.txt --tools openai-gpt-4 --chain-config celo --confirm on-chain
458
489
  ```
459
490
 
460
491
  </details>
@@ -0,0 +1,3 @@
1
+ """Mech client."""
2
+
3
+ __version__ = "0.6.0"