mech-client 0.2.21__tar.gz → 0.4.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 (54) hide show
  1. {mech_client-0.2.21 → mech_client-0.4.0}/PKG-INFO +48 -5
  2. {mech_client-0.2.21 → mech_client-0.4.0}/README.md +47 -3
  3. mech_client-0.4.0/mech_client/__init__.py +3 -0
  4. mech_client-0.4.0/mech_client/abis/BalanceTrackerFixedPriceNative.json +503 -0
  5. mech_client-0.4.0/mech_client/abis/BalanceTrackerFixedPriceToken.json +502 -0
  6. mech_client-0.4.0/mech_client/abis/BalanceTrackerNvmSubscriptionNative.json +672 -0
  7. mech_client-0.4.0/mech_client/abis/BalanceTrackerNvmSubscriptionToken.json +660 -0
  8. mech_client-0.4.0/mech_client/abis/IERC1155.json +295 -0
  9. mech_client-0.4.0/mech_client/abis/IMech.json +165 -0
  10. mech_client-0.4.0/mech_client/abis/IToken.json +880 -0
  11. mech_client-0.4.0/mech_client/abis/MechMarketplace.json +1281 -0
  12. {mech_client-0.2.21 → mech_client-0.4.0}/mech_client/cli.py +74 -19
  13. {mech_client-0.2.21 → mech_client-0.4.0}/mech_client/configs/mechs.json +18 -6
  14. mech_client-0.4.0/mech_client/fetch_ipfs_hash.py +88 -0
  15. {mech_client-0.2.21 → mech_client-0.4.0}/mech_client/helpers/__init__.py +13 -3
  16. {mech_client-0.2.21 → mech_client-0.4.0}/mech_client/interact.py +24 -2
  17. mech_client-0.4.0/mech_client/marketplace_interact.py +883 -0
  18. {mech_client-0.2.21 → mech_client-0.4.0}/mech_client/wss.py +89 -0
  19. {mech_client-0.2.21 → mech_client-0.4.0}/pyproject.toml +1 -2
  20. mech_client-0.2.21/mech_client/__init__.py +0 -3
  21. {mech_client-0.2.21 → mech_client-0.4.0}/LICENSE +0 -0
  22. {mech_client-0.2.21 → mech_client-0.4.0}/mech_client/acn.py +0 -0
  23. {mech_client-0.2.21 → mech_client-0.4.0}/mech_client/helpers/acn/README.md +0 -0
  24. {mech_client-0.2.21 → mech_client-0.4.0}/mech_client/helpers/acn/__init__.py +0 -0
  25. {mech_client-0.2.21 → mech_client-0.4.0}/mech_client/helpers/acn/acn.proto +0 -0
  26. {mech_client-0.2.21 → mech_client-0.4.0}/mech_client/helpers/acn/acn_pb2.py +0 -0
  27. {mech_client-0.2.21 → mech_client-0.4.0}/mech_client/helpers/acn/custom_types.py +0 -0
  28. {mech_client-0.2.21 → mech_client-0.4.0}/mech_client/helpers/acn/dialogues.py +0 -0
  29. {mech_client-0.2.21 → mech_client-0.4.0}/mech_client/helpers/acn/message.py +0 -0
  30. {mech_client-0.2.21 → mech_client-0.4.0}/mech_client/helpers/acn/protocol.yaml +0 -0
  31. {mech_client-0.2.21 → mech_client-0.4.0}/mech_client/helpers/acn/serialization.py +0 -0
  32. {mech_client-0.2.21 → mech_client-0.4.0}/mech_client/helpers/acn/tests/__init__.py +0 -0
  33. {mech_client-0.2.21 → mech_client-0.4.0}/mech_client/helpers/acn/tests/test_acn.py +0 -0
  34. {mech_client-0.2.21 → mech_client-0.4.0}/mech_client/helpers/acn/tests/test_acn_dialogues.py +0 -0
  35. {mech_client-0.2.21 → mech_client-0.4.0}/mech_client/helpers/acn/tests/test_acn_messages.py +0 -0
  36. {mech_client-0.2.21 → mech_client-0.4.0}/mech_client/helpers/acn_data_share/README.md +0 -0
  37. {mech_client-0.2.21 → mech_client-0.4.0}/mech_client/helpers/acn_data_share/__init__.py +0 -0
  38. {mech_client-0.2.21 → mech_client-0.4.0}/mech_client/helpers/acn_data_share/acn_data_share.proto +0 -0
  39. {mech_client-0.2.21 → mech_client-0.4.0}/mech_client/helpers/acn_data_share/acn_data_share_pb2.py +0 -0
  40. {mech_client-0.2.21 → mech_client-0.4.0}/mech_client/helpers/acn_data_share/dialogues.py +0 -0
  41. {mech_client-0.2.21 → mech_client-0.4.0}/mech_client/helpers/acn_data_share/message.py +0 -0
  42. {mech_client-0.2.21 → mech_client-0.4.0}/mech_client/helpers/acn_data_share/protocol.yaml +0 -0
  43. {mech_client-0.2.21 → mech_client-0.4.0}/mech_client/helpers/acn_data_share/serialization.py +0 -0
  44. {mech_client-0.2.21 → mech_client-0.4.0}/mech_client/helpers/acn_data_share/tests/test_acn_data_share_dialogues.py +0 -0
  45. {mech_client-0.2.21 → mech_client-0.4.0}/mech_client/helpers/acn_data_share/tests/test_acn_data_share_messages.py +0 -0
  46. {mech_client-0.2.21 → mech_client-0.4.0}/mech_client/helpers/p2p_libp2p_client/README.md +0 -0
  47. {mech_client-0.2.21 → mech_client-0.4.0}/mech_client/helpers/p2p_libp2p_client/__init__.py +0 -0
  48. {mech_client-0.2.21 → mech_client-0.4.0}/mech_client/helpers/p2p_libp2p_client/connection.py +0 -0
  49. {mech_client-0.2.21 → mech_client-0.4.0}/mech_client/helpers/p2p_libp2p_client/connection.yaml +0 -0
  50. {mech_client-0.2.21 → mech_client-0.4.0}/mech_client/mech_tool_management.py +0 -0
  51. {mech_client-0.2.21 → mech_client-0.4.0}/mech_client/prompt_to_ipfs.py +0 -0
  52. {mech_client-0.2.21 → mech_client-0.4.0}/mech_client/push_to_ipfs.py +0 -0
  53. {mech_client-0.2.21 → mech_client-0.4.0}/mech_client/subgraph.py +0 -0
  54. {mech_client-0.2.21 → mech_client-0.4.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.2.21
3
+ Version: 0.4.0
4
4
  Summary: Basic client to interact with a mech
5
5
  License: Apache-2.0
6
6
  Author: David Minarsch
@@ -16,7 +16,6 @@ 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 (>=75.8.0,<76.0.0)
20
19
  Requires-Dist: tabulate (>=0.9.0,<0.10.0)
21
20
  Requires-Dist: websocket-client (>=0.32.0,<1)
22
21
  Description-Content-Type: text/markdown
@@ -118,14 +117,33 @@ The EOA you use must have enough funds to pay for the Mech requests, or alternat
118
117
 
119
118
  ### Select the mech you are going to send requests to
120
119
 
121
- Mechs are deployed to several networks. Find the list of supported networks and corresponging mech addresses [here](https://github.com/valory-xyz/mech?tab=readme-ov-file#examples-of-deployed-mechs).
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
+ ### API Keys
125
+
126
+ 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:
127
+
128
+ 1. Sign up or log in
129
+ 2. Go to API Dashboard on the left menu
130
+ 3. Add a new API key
131
+ 4. Once generated copy your API key
132
+
133
+ Once you have your API key, you'll need to configure it in your environment. Use the following command to set it for your environment.
134
+
135
+ ```bash
136
+ export MECHX_API_KEY=<your api key>
137
+ ```
122
138
 
123
139
  ### Generate Mech requests
124
140
 
141
+ #### Legacy Mechs
142
+
125
143
  The basic usage of the Mech Client is as follows:
126
144
 
127
145
  ```bash
128
- mechx interact <prompt> <agent_id>
146
+ mechx interact <prompt> --agent_id <agent_id>
129
147
  ```
130
148
 
131
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).
@@ -164,7 +182,7 @@ Some useful options:
164
182
  Example of a request specifying a key file and tool:
165
183
 
166
184
  ```bash
167
- mechx interact "write a short poem" 6 --key ~/ethereum_private_key.txt --tool openai-gpt-3.5-turbo --chain-config gnosis --confirm on-chain
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
168
186
  ```
169
187
 
170
188
  You will see an output like this:
@@ -179,6 +197,24 @@ Data arrived: https://gateway.autonolas.tech/ipfs/f01701220a462120d5bb03f406fa5e
179
197
  Data from agent: {'requestId': 100407405856633966395081711430940962809568685031934329025999216833965518452765, 'result': "In a world of chaos and strife,\nThere's beauty in the simplest of life.\nA gentle breeze whispers through the trees,\nAnd birds sing melodies with ease.\n\nThe sun sets in a fiery hue,\nPainting the sky in shades of blue.\nStars twinkle in the darkness above,\nGuiding us with their light and love.\n\nSo take a moment to pause and see,\nThe wonders of this world so free.\nEmbrace the joy that each day brings,\nAnd let your heart soar on gentle wings.", 'prompt': 'write a short poem', 'cost_dict': {}, 'metadata': {'model': None, 'tool': 'openai-gpt-3.5-turbo'}}
180
198
  ```
181
199
 
200
+ #### With the Mech Marketplace
201
+
202
+ With the Mech Marketplace, the basic usage of the Mech Client is as follows.
203
+
204
+ ```bash
205
+ mechx interact <prompt> --tool openai-gpt-3.5-turbo --chain-config <chain_config>
206
+ ```
207
+
208
+ To use a custom mech to send requests to, use the `priority-mech` flag while sending the requests
209
+
210
+ ```bash
211
+ mechx interact <prompt> --priority-mech <priority mech address> --tool openai-gpt-3.5-turbo --chain-config <chain_config>
212
+ ```
213
+
214
+ Additionally to other options which are the same as for legacy Mechs, this usage has the following option:
215
+
216
+ `--use-prepaid <bool>`: use the prepaid method to send requests to a Mech via the Mech Marketplace. Defaults to False.
217
+ `--use-offchain <bool>`: use the off-chain method to send requests to a Mech via the Mech Marketplace. Defaults to False.
182
218
 
183
219
  ### List tools available for agents
184
220
 
@@ -290,6 +326,8 @@ Output Schema:
290
326
 
291
327
  ### Chain configuration
292
328
 
329
+ #### For legacy Mechs
330
+
293
331
  Default configurations for different chains are stored in the file [configs/mechs.json](./mech_client/configs/mechs.json). If `--chain-config` parameter is not specified, the Mech Client will choose the first configuration on the JSON.
294
332
 
295
333
  Additionally, you can override any configuration parameter by exporting any of the following environment variables:
@@ -382,6 +420,11 @@ This script will:
382
420
  - Retrieve and display the description of a specific tool using its unique identifier.
383
421
  - Retrieve and display the input and output schema of a specific tool using its unique identifier.
384
422
 
423
+ #### For Mechs receiving requests via the Mech Marketplace
424
+
425
+ In this case, the script is the same, except for the function result. When this function has no argument agent_id,
426
+ the request is sent to the Mech Marketplace. The target Mech to which the request is relayed should be in the chain_config file (key `priority_mech_address`).
427
+
385
428
  ## Developer installation
386
429
 
387
430
  To setup the development environment for this project, clone the repository and run the following commands:
@@ -95,14 +95,33 @@ The EOA you use must have enough funds to pay for the Mech requests, or alternat
95
95
 
96
96
  ### Select the mech you are going to send requests to
97
97
 
98
- Mechs are deployed to several networks. Find the list of supported networks and corresponging mech addresses [here](https://github.com/valory-xyz/mech?tab=readme-ov-file#examples-of-deployed-mechs).
98
+ 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_.
99
+ 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).
100
+
101
+
102
+ ### API Keys
103
+
104
+ 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:
105
+
106
+ 1. Sign up or log in
107
+ 2. Go to API Dashboard on the left menu
108
+ 3. Add a new API key
109
+ 4. Once generated copy your API key
110
+
111
+ Once you have your API key, you'll need to configure it in your environment. Use the following command to set it for your environment.
112
+
113
+ ```bash
114
+ export MECHX_API_KEY=<your api key>
115
+ ```
99
116
 
100
117
  ### Generate Mech requests
101
118
 
119
+ #### Legacy Mechs
120
+
102
121
  The basic usage of the Mech Client is as follows:
103
122
 
104
123
  ```bash
105
- mechx interact <prompt> <agent_id>
124
+ mechx interact <prompt> --agent_id <agent_id>
106
125
  ```
107
126
 
108
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).
@@ -141,7 +160,7 @@ Some useful options:
141
160
  Example of a request specifying a key file and tool:
142
161
 
143
162
  ```bash
144
- mechx interact "write a short poem" 6 --key ~/ethereum_private_key.txt --tool openai-gpt-3.5-turbo --chain-config gnosis --confirm on-chain
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
145
164
  ```
146
165
 
147
166
  You will see an output like this:
@@ -156,6 +175,24 @@ Data arrived: https://gateway.autonolas.tech/ipfs/f01701220a462120d5bb03f406fa5e
156
175
  Data from agent: {'requestId': 100407405856633966395081711430940962809568685031934329025999216833965518452765, 'result': "In a world of chaos and strife,\nThere's beauty in the simplest of life.\nA gentle breeze whispers through the trees,\nAnd birds sing melodies with ease.\n\nThe sun sets in a fiery hue,\nPainting the sky in shades of blue.\nStars twinkle in the darkness above,\nGuiding us with their light and love.\n\nSo take a moment to pause and see,\nThe wonders of this world so free.\nEmbrace the joy that each day brings,\nAnd let your heart soar on gentle wings.", 'prompt': 'write a short poem', 'cost_dict': {}, 'metadata': {'model': None, 'tool': 'openai-gpt-3.5-turbo'}}
157
176
  ```
158
177
 
178
+ #### With the Mech Marketplace
179
+
180
+ With the Mech Marketplace, the basic usage of the Mech Client is as follows.
181
+
182
+ ```bash
183
+ mechx interact <prompt> --tool openai-gpt-3.5-turbo --chain-config <chain_config>
184
+ ```
185
+
186
+ To use a custom mech to send requests to, use the `priority-mech` flag while sending the requests
187
+
188
+ ```bash
189
+ mechx interact <prompt> --priority-mech <priority mech address> --tool openai-gpt-3.5-turbo --chain-config <chain_config>
190
+ ```
191
+
192
+ Additionally to other options which are the same as for legacy Mechs, this usage has the following option:
193
+
194
+ `--use-prepaid <bool>`: use the prepaid method to send requests to a Mech via the Mech Marketplace. Defaults to False.
195
+ `--use-offchain <bool>`: use the off-chain method to send requests to a Mech via the Mech Marketplace. Defaults to False.
159
196
 
160
197
  ### List tools available for agents
161
198
 
@@ -267,6 +304,8 @@ Output Schema:
267
304
 
268
305
  ### Chain configuration
269
306
 
307
+ #### For legacy Mechs
308
+
270
309
  Default configurations for different chains are stored in the file [configs/mechs.json](./mech_client/configs/mechs.json). If `--chain-config` parameter is not specified, the Mech Client will choose the first configuration on the JSON.
271
310
 
272
311
  Additionally, you can override any configuration parameter by exporting any of the following environment variables:
@@ -359,6 +398,11 @@ This script will:
359
398
  - Retrieve and display the description of a specific tool using its unique identifier.
360
399
  - Retrieve and display the input and output schema of a specific tool using its unique identifier.
361
400
 
401
+ #### For Mechs receiving requests via the Mech Marketplace
402
+
403
+ In this case, the script is the same, except for the function result. When this function has no argument agent_id,
404
+ the request is sent to the Mech Marketplace. The target Mech to which the request is relayed should be in the chain_config file (key `priority_mech_address`).
405
+
362
406
  ## Developer installation
363
407
 
364
408
  To setup the development environment for this project, clone the repository and run the following commands:
@@ -0,0 +1,3 @@
1
+ """Mech client."""
2
+
3
+ __version__ = "0.4.0"