mech-client 0.4.0__py3-none-any.whl → 0.7.0__py3-none-any.whl

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 (34) hide show
  1. mech_client/__init__.py +1 -1
  2. mech_client/abis/AgentMech.json +718 -0
  3. mech_client/abis/AgentRegistry.json +1037 -0
  4. mech_client/abis/AgreementStoreManager.base.json +766 -0
  5. mech_client/abis/AgreementStoreManager.gnosis.json +766 -0
  6. mech_client/abis/DIDRegistry.base.json +2476 -0
  7. mech_client/abis/DIDRegistry.gnosis.json +2476 -0
  8. mech_client/abis/EscrowPaymentCondition.base.json +717 -0
  9. mech_client/abis/EscrowPaymentCondition.gnosis.json +717 -0
  10. mech_client/abis/LockPaymentCondition.base.json +874 -0
  11. mech_client/abis/LockPaymentCondition.gnosis.json +874 -0
  12. mech_client/abis/NFTSalesTemplate.base.json +698 -0
  13. mech_client/abis/NFTSalesTemplate.gnosis.json +698 -0
  14. mech_client/abis/NeverminedConfig.base.json +587 -0
  15. mech_client/abis/NeverminedConfig.gnosis.json +587 -0
  16. mech_client/abis/SubscriptionNFT.base.json +300 -0
  17. mech_client/abis/SubscriptionNFT.gnosis.json +300 -0
  18. mech_client/abis/SubscriptionProvider.base.json +294 -0
  19. mech_client/abis/SubscriptionProvider.gnosis.json +294 -0
  20. mech_client/abis/SubscriptionToken.base.json +1393 -0
  21. mech_client/abis/TransferNFTCondition.base.json +1062 -0
  22. mech_client/abis/TransferNFTCondition.gnosis.json +1062 -0
  23. mech_client/cli.py +99 -10
  24. mech_client/configs/mechs.json +1 -7
  25. mech_client/interact.py +14 -39
  26. mech_client/marketplace_interact.py +130 -90
  27. mech_client/mech_tool_management.py +11 -5
  28. mech_client/subgraph.py +21 -35
  29. mech_client/wss.py +7 -6
  30. {mech_client-0.4.0.dist-info → mech_client-0.7.0.dist-info}/METADATA +53 -19
  31. {mech_client-0.4.0.dist-info → mech_client-0.7.0.dist-info}/RECORD +34 -13
  32. {mech_client-0.4.0.dist-info → mech_client-0.7.0.dist-info}/LICENSE +0 -0
  33. {mech_client-0.4.0.dist-info → mech_client-0.7.0.dist-info}/WHEEL +0 -0
  34. {mech_client-0.4.0.dist-info → mech_client-0.7.0.dist-info}/entry_points.txt +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.7.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
@@ -115,12 +116,6 @@ The EOA you use must have enough funds to pay for the Mech requests, or alternat
115
116
  > echo ethereum_private_key.txt >> .gitignore
116
117
  > ```
117
118
 
118
- ### Select the mech you are going to send requests to
119
-
120
- Mechs can receive requests via the [Mech Marketplace](https://github.com/valory-xyz/ai-registry-mech/) or directly. We call the last ones _Legacy Mechs_.
121
- Mechs are deployed on several networks. Find the list of supported networks and corresponding mech addresses [here](https://github.com/valory-xyz/mech?tab=readme-ov-file#examples-of-deployed-mechs). Additionally, on Gnosis you can find more available Mechs [here](https://mech.olas.network/) (click on the tab "Legacy Mech" in order to see Legacy Mech and "Mech Marketplace" for the ones which receive requests via the Mech Marketplace).
122
-
123
-
124
119
  ### API Keys
125
120
 
126
121
  In order to fetch on-chain data for Gnosis and Base, mech client requires an API key from a blockchain data provider. You can find them here for [GnosisScan](https://gnosisscan.io/) and [BaseScan](https://basescan.org/). Follow these steps to generate your API key if you are planning to use mech client for gnosis and base:
@@ -138,20 +133,27 @@ export MECHX_API_KEY=<your api key>
138
133
 
139
134
  ### Generate Mech requests
140
135
 
136
+ #### Select the mech you are going to send requests to
137
+
138
+ Mechs can receive requests via the [Mech Marketplace](https://github.com/valory-xyz/ai-registry-mech/) or directly. We call the last ones _Legacy Mechs_.
139
+ Mechs are deployed on several networks. Find the list of supported networks and corresponding mech addresses [here](https://github.com/valory-xyz/mech?tab=readme-ov-file#examples-of-deployed-mechs). Additionally, you can find more available Mechs [here](https://mech.olas.network/) (click on the tab "Legacy Mech" in order to see Legacy Mech (available only on Gnosis) and "Mech Marketplace" for the ones which receive requests via the Mech Marketplace).
140
+
141
141
  #### Legacy Mechs
142
142
 
143
143
  The basic usage of the Mech Client is as follows:
144
144
 
145
145
  ```bash
146
- mechx interact <prompt> --agent_id <agent_id>
146
+ mechx interact --prompts <prompt> --tools <tool> --agent_id <agent_id>
147
147
  ```
148
148
 
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).
149
+ 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).
150
+
151
+ ⚠️ Batch requests and tools are not supported for legacy mechs
150
152
 
151
153
  Some useful options:
152
154
 
153
155
  - `--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:
156
+ - `--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
157
 
156
158
  ```text
157
159
  Select prompting tool
@@ -177,12 +179,12 @@ Some useful options:
177
179
  - `on-chain`: Wait for the result using the Subgraph and the Websocket subscription (whichever arrives first).
178
180
  - `wait-for-both` (Default): Wait for the result using both `off-chain` and `on-chain` (whichever arrives first).
179
181
 
180
- ### Example
182
+ ##### Example
181
183
 
182
184
  Example of a request specifying a key file and tool:
183
185
 
184
186
  ```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
187
+ 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
188
  ```
187
189
 
188
190
  You will see an output like this:
@@ -199,23 +201,56 @@ Data from agent: {'requestId': 1004074058566339663950817114309409628095686850319
199
201
 
200
202
  #### With the Mech Marketplace
201
203
 
202
- With the Mech Marketplace, the basic usage of the Mech Client is as follows.
204
+ 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
205
+ payment model of the Mech. For a fixed price Mech receiving payments in native token, use the following:
206
+
207
+ ```bash
208
+ mechx deposit-native --chain-config <chain_config> <amount>
209
+ ```
210
+
211
+ For a fixed price Mech receiving payments in OLAS, use the following (the amount is in ether):
212
+
213
+ ```bash
214
+ mechx deposit-token --chain-config <chain_config> <amount>
215
+ ```
216
+
217
+ 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:
218
+
219
+ ```bash
220
+ mechx purchase-nvm-subscription --chain-config <chain_config>
221
+ ```
203
222
 
223
+ ⚠️ To ensure optimal performance and reliability when using `purchase-nvm-subscription`, it is advisable to use a custom RPC provider as public RPC endpoints may be rate-limited or unreliable under high usage. You can configure your custom RPC URL in your environment variables using
204
224
  ```bash
205
- mechx interact <prompt> --tool openai-gpt-3.5-turbo --chain-config <chain_config>
225
+ export MECHX_CHAIN_RPC=
206
226
  ```
207
227
 
208
- To use a custom mech to send requests to, use the `priority-mech` flag while sending the requests
228
+ You can use the option `--key <private_key_file_path>` in order to customize the path to the private key file.
229
+
230
+ The basic usage of the Mech Client is then as follows.
209
231
 
210
232
  ```bash
211
- mechx interact <prompt> --priority-mech <priority mech address> --tool openai-gpt-3.5-turbo --chain-config <chain_config>
233
+ mechx interact --prompts <prompt> --priority-mech <priority mech address> --tools openai-gpt-3.5-turbo --chain-config <chain_config>
212
234
  ```
213
235
 
214
236
  Additionally to other options which are the same as for legacy Mechs, this usage has the following option:
215
237
 
216
- `--use-prepaid <bool>`: use the prepaid method to send requests to a Mech via the Mech Marketplace. Defaults to False.
238
+ `--use-prepaid <bool>`: use the prepaid method to send requests to a Mech via the Mech Marketplace. Defaults to False. <br>
217
239
  `--use-offchain <bool>`: use the off-chain method to send requests to a Mech via the Mech Marketplace. Defaults to False.
218
240
 
241
+ The Mech Client can also be used to send batch requests. There are couple of different ways to achieve this:
242
+
243
+ ```bash
244
+ mechx interact --prompts={<prompt-1>,<prompt-2>} --priority-mech <priority mech address> --tools={<tool-1>,<tool-2>} --chain-config <chain_config>
245
+ ```
246
+
247
+ or <br>
248
+
249
+ ```bash
250
+ mechx interact --prompts <prompt-1> --prompts <prompt-2> --priority-mech <priority mech address> --tools <tool-1> --tools <tool-2> --chain-config <chain_config>
251
+ ```
252
+
253
+
219
254
  ### List tools available for agents
220
255
 
221
256
  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 +371,6 @@ Additionally, you can override any configuration parameter by exporting any of t
336
371
  MECHX_CHAIN_RPC
337
372
  MECHX_WSS_ENDPOINT
338
373
  MECHX_GAS_LIMIT
339
- MECHX_CONTRACT_ABI_URL
340
374
  MECHX_TRANSACTION_URL
341
375
  MECHX_SUBGRAPH_URL
342
376
 
@@ -476,7 +510,7 @@ You can find the agent IDs for each chain on the [Mech Hub](https://aimechs.auto
476
510
  Use the `--chain-config <name>` parameter together with a valid `<agent_id>`, for example:
477
511
 
478
512
  ```bash
479
- mechx interact "write a short poem" 2 --key ./ethereum_private_key.txt --tool openai-gpt-4 --chain-config celo --confirm on-chain
513
+ 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
514
  ```
481
515
 
482
516
  </details>
@@ -1,15 +1,36 @@
1
- mech_client/__init__.py,sha256=ExTYjuMb_wq7aijLqhyCVLuGh4EGP2CZmtb4c3vobpg,42
1
+ mech_client/__init__.py,sha256=7c_NFqLmrsat-J6najbiOFl9n9GrUj48mOdcK8_KUKs,42
2
+ mech_client/abis/AgentMech.json,sha256=IEbs_xBGunBu5h-uT5DvIty8Zw412QoPI46S_DUMYNw,18082
3
+ mech_client/abis/AgentRegistry.json,sha256=2qmXeFINZWz9pyOma6Bq67kMDSUI1lD7WvgHLwuETD8,24723
4
+ mech_client/abis/AgreementStoreManager.base.json,sha256=_ljdIZcfFGmFzBHUTfhA4X0382ZHHpkdr_CziTwUETo,34360
5
+ mech_client/abis/AgreementStoreManager.gnosis.json,sha256=JxftbiQDFF0bHm3Gtlaxvccmmx5-zHdzsKBFUn0rITY,34360
2
6
  mech_client/abis/BalanceTrackerFixedPriceNative.json,sha256=MF5jDqSMoZztvMV4oc5ij-Qn1DAZ1Nyz9EOFRb9wSQ0,12478
3
7
  mech_client/abis/BalanceTrackerFixedPriceToken.json,sha256=kaXgResUkAb6u9bVTS3T_SNRPRP76hi-jTAhMiYwq4U,12408
4
8
  mech_client/abis/BalanceTrackerNvmSubscriptionNative.json,sha256=D23ibyhDsn4vjozFvzcKw-7wJpGM-R5GiqlcmyBIpcY,16536
5
9
  mech_client/abis/BalanceTrackerNvmSubscriptionToken.json,sha256=4Bra0DdEi_pQUSD4hGdELOvjNL013GaJc-dANr--5D8,16204
10
+ mech_client/abis/DIDRegistry.base.json,sha256=l6UZe4SU9nMh0PvmTS5gfwd6bBM7_BT5mRyASOFyGxw,92562
11
+ mech_client/abis/DIDRegistry.gnosis.json,sha256=piDWd8nipLcI3NkMu0o2RsQkTS9m7gjDp-yLtPpcjEc,92562
12
+ mech_client/abis/EscrowPaymentCondition.base.json,sha256=Z0zr_E2Cxjfg_aHF-VLPeOQ9kAy51_aRcw-OuIPQ7zY,34475
13
+ mech_client/abis/EscrowPaymentCondition.gnosis.json,sha256=YkretgP3DKVpBZdeRqHu49oELQntuQk4-h852e4IIHQ,34475
6
14
  mech_client/abis/IERC1155.json,sha256=2xOx44MrKRk5oDEZ8PhCUgW7A4puK-GQizPKff-Fn1E,7459
7
15
  mech_client/abis/IMech.json,sha256=km0NMRyqBYh3jBQwPJCispsRfPwqNJ67kkZwYjuJci4,3989
8
16
  mech_client/abis/IToken.json,sha256=VrzR6Rr1DmrUzy5DygN1rKm6df4ir2KGdWsunZnuRKo,19637
17
+ mech_client/abis/LockPaymentCondition.base.json,sha256=mGOi_xYyH7gCzLyWu7nk_Ta46tpLNxoPAgbjQvKNQtA,43424
18
+ mech_client/abis/LockPaymentCondition.gnosis.json,sha256=ofYQo6JYSE_7Q4LPHxoOZI2qFMddSWcfVoCW-6k9KnY,43424
9
19
  mech_client/abis/MechMarketplace.json,sha256=auKTxPTi07yD98Gz2RuwH1Gq5qRCyy8-C7QBNj3uto8,32104
20
+ mech_client/abis/NFTSalesTemplate.base.json,sha256=blheE2NNxCt3ttklcsAF9WrIcnsvywAZ8jICjGVl4lQ,37995
21
+ mech_client/abis/NFTSalesTemplate.gnosis.json,sha256=6fKoxvTSQWOGQq_Yik09R8JTMRxXIPgoOC_HSAf5A7Q,37995
22
+ mech_client/abis/NeverminedConfig.base.json,sha256=0p_GV87fsBvlN6VNDm_T1ykjzD4yZKlR9-jDpo1_RRU,21221
23
+ mech_client/abis/NeverminedConfig.gnosis.json,sha256=3MT2dgUz5jAKvwItfHwz95VPvPwKxF3CG2rH8kE5eug,21221
24
+ mech_client/abis/SubscriptionNFT.base.json,sha256=oYqkgejXaNQ2Pfc1OyWRJ7GlOl77B0UC16ziS6-Y76U,8811
25
+ mech_client/abis/SubscriptionNFT.gnosis.json,sha256=vHW7ownS8qDcDLbLZMGthtLc8YdtyxaAvymfeizD-7o,8811
26
+ mech_client/abis/SubscriptionProvider.base.json,sha256=KPtu23YQTpf2-EWtqIvFGtGQGOAdoQqV871IHiE4K1o,9367
27
+ mech_client/abis/SubscriptionProvider.gnosis.json,sha256=K4VRk8wuviMqQ6P30qg5A1NZOTLJz7oC7PwCYybdios,9367
28
+ mech_client/abis/SubscriptionToken.base.json,sha256=5StPEyfRvDMTqtQPO-KakXXZqobXZRuE6OCAeTM7bQc,39812
29
+ mech_client/abis/TransferNFTCondition.base.json,sha256=71O_3itHBz9qPtoTLev8_a7KxlcQfIZSfxK2562lkqw,42540
30
+ mech_client/abis/TransferNFTCondition.gnosis.json,sha256=-huhxV54eoNY8mR9WtQdmSgQDgaKiUi0PULJ4HEshWw,42540
10
31
  mech_client/acn.py,sha256=Rj_jLPvJ5loDQfGbu3a_O24cJC4SwIErLceSz_zVYS8,5356
11
- mech_client/cli.py,sha256=PWkUBwirP8DMxNG-lYmh-QAJhNPX_k6yCtfjTh7iXs8,11322
12
- mech_client/configs/mechs.json,sha256=Xa91cNO4Ak2TInewUlvup6M440eyFCaYiXv8SHpY3yE,5699
32
+ mech_client/cli.py,sha256=8cZ7kQvXRk3GZHj_wtGw8cQXYctkY1eLuACMBSdnZb4,14049
33
+ mech_client/configs/mechs.json,sha256=Sh-W0ZqkktSD8HokU5InoFIlqvKoq7nDlIY0fB8P6Y8,4887
13
34
  mech_client/fetch_ipfs_hash.py,sha256=tg_hYVf4deXl89x3SOBrGFUthaSeN_Vg_OHDtfjdbp4,2752
14
35
  mech_client/helpers/__init__.py,sha256=nmQig1EqBQ9EMOpgdykP3a6_2NWcoVH3-lnyHP5n0ws,1196
15
36
  mech_client/helpers/acn/README.md,sha256=WMXR2Lk0IpWjr3vpZ8cxcTHk4gwsx4wC06UPkwj9dbQ,1641
@@ -39,16 +60,16 @@ mech_client/helpers/p2p_libp2p_client/README.md,sha256=6x9s6P7TdKkcvAS1wMFHXRz4a
39
60
  mech_client/helpers/p2p_libp2p_client/__init__.py,sha256=-GOP3D_JnmXTDomrMLCbnRk7vRQmihIqTYvyIPzx-q4,879
40
61
  mech_client/helpers/p2p_libp2p_client/connection.py,sha256=b5jfcUeSoNrUw8DOSTCbK4DTi-N8bf2_pdogUOz0ep0,28606
41
62
  mech_client/helpers/p2p_libp2p_client/connection.yaml,sha256=nMiHnU_dv9EFjVNqZ-0SAnoATfadJSad-JsbDvk97Mk,1790
42
- mech_client/interact.py,sha256=zQ7UhlnZOfM4hnZBaRQ5efkfw6Rl-s7Kh6lciyoZL70,22028
43
- mech_client/marketplace_interact.py,sha256=aMymGceGXbXYYbB5alICq5Vp-9szD3IPlfWaCoBEZlU,31631
44
- mech_client/mech_tool_management.py,sha256=XWQDcFStTK66-3ZzOwKtMo5c66KDjvbeDsIXHIP4SuU,7810
63
+ mech_client/interact.py,sha256=h3li0N79M1MaVXggONFzs_rNEr6WcG8fof_UtykSZyQ,21243
64
+ mech_client/marketplace_interact.py,sha256=rRIHYLzuaXYW7vh4fvNh9KBbUY4tgoavmMxFaPg0Rkw,33045
65
+ mech_client/mech_tool_management.py,sha256=NQFmVzzGZsIkeHokDPWXGHwa8u-pyQIMPR1Q5H81bKw,7806
45
66
  mech_client/prompt_to_ipfs.py,sha256=XqSIBko15MEkpWOQNT97fRI6jNxMF5EDBDEPOJFdhyk,2533
46
67
  mech_client/push_to_ipfs.py,sha256=IfvgaPU79N_ZmCPF9d7sPCYz2uduZH0KjT_HQ2LHXoQ,2059
47
- mech_client/subgraph.py,sha256=6hkF8l0qxWRJ0UcdxfML6JnjYBu5BuBA6EHsHJ2nHVI,5149
68
+ mech_client/subgraph.py,sha256=MiyWiLPkqtXS9qayT75xYM6tz2pxd2Q6iE92yZxDugw,4700
48
69
  mech_client/to_png.py,sha256=pjUcFJ63MJj_r73eqnfqCWMtlpsrj6H4ZmgvIEmRcFw,2581
49
- mech_client/wss.py,sha256=toD_9-gNsQAoK13Zh5mQCKbmkT2Gcqz5XaNiUGyb5Js,9801
50
- mech_client-0.4.0.dist-info/LICENSE,sha256=mdBDB-mWKV5Cz4ejBzBiKqan6Z8zVLAh9xwM64O2FW4,11339
51
- mech_client-0.4.0.dist-info/METADATA,sha256=kZzxaub9P9awiENKOJKbxtGfACwnPiyUU2L91RhpZgg,19911
52
- mech_client-0.4.0.dist-info/WHEEL,sha256=7Z8_27uaHI_UZAc4Uox4PpBhQ9Y5_modZXWMxtUi4NU,88
53
- mech_client-0.4.0.dist-info/entry_points.txt,sha256=SbRMRsayzD8XfNXhgwPuXEqQsdZ5Bw9XDPnUuaDExyY,45
54
- mech_client-0.4.0.dist-info/RECORD,,
70
+ mech_client/wss.py,sha256=N38eprKqwHyQpqGa6XZ9ZUwJ_YO50wlBJqJ5D1QCIj4,9888
71
+ mech_client-0.7.0.dist-info/LICENSE,sha256=mdBDB-mWKV5Cz4ejBzBiKqan6Z8zVLAh9xwM64O2FW4,11339
72
+ mech_client-0.7.0.dist-info/METADATA,sha256=_PyR4Yy_qFuQLa5jQzuFPWvNyiFbcwezmwHlptK2qdA,21494
73
+ mech_client-0.7.0.dist-info/WHEEL,sha256=7Z8_27uaHI_UZAc4Uox4PpBhQ9Y5_modZXWMxtUi4NU,88
74
+ mech_client-0.7.0.dist-info/entry_points.txt,sha256=SbRMRsayzD8XfNXhgwPuXEqQsdZ5Bw9XDPnUuaDExyY,45
75
+ mech_client-0.7.0.dist-info/RECORD,,