Skip to content

Commit fe0b611

Browse files
authored
Merge pull request #73 from valory-xyz/updates/readme
Updates/readme
2 parents 91b857a + 549de53 commit fe0b611

File tree

2 files changed

+29
-17
lines changed

2 files changed

+29
-17
lines changed

README.md

+26-3
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,22 @@ The EOA you use must have enough funds to pay for the Mech requests, or alternat
9898
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_.
9999
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).
100100

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+
```
116+
101117
### Generate Mech requests
102118
103119
#### Legacy Mechs
@@ -164,12 +180,19 @@ Data from agent: {'requestId': 1004074058566339663950817114309409628095686850319
164180
With the Mech Marketplace, the basic usage of the Mech Client is as follows.
165181
166182
```bash
167-
mechx interact <prompt> --chain-config <chain_config>
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>
168190
```
169191
170-
The Mech agent which corresponds to the `priority_mech_address` in `<chain_config>` will process `<prompt>` with the default options. Additionally to other options which are the same as for legacy Mechs, this usage has the following option:
192+
Additionally to other options which are the same as for legacy Mechs, this usage has the following option:
171193
172-
`--use-offchain <bool>`: use the off-chain method to send requests to a Mech via the Mech Marketplace. Set to False in order to use the on-chain method.
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.
173196
174197
### List tools available for agents
175198

mech_client/marketplace_interact.py

+3-14
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@
4848
calculate_topic_id,
4949
get_contract,
5050
get_mech_config,
51-
verify_or_retrieve_tool,
5251
)
5352
from mech_client.prompt_to_ipfs import push_metadata_to_ipfs
5453
from mech_client.wss import (
@@ -621,7 +620,7 @@ def marketplace_interact( # pylint: disable=too-many-arguments, too-many-locals
621620
priority_mech: str,
622621
use_prepaid: bool = False,
623622
use_offchain: bool = False,
624-
tool: Optional[str] = None,
623+
tool: str = "",
625624
extra_attributes: Optional[Dict[str, Any]] = None,
626625
private_key_path: Optional[str] = None,
627626
confirmation_type: ConfirmationType = ConfirmationType.WAIT_FOR_BOTH,
@@ -642,7 +641,7 @@ def marketplace_interact( # pylint: disable=too-many-arguments, too-many-locals
642641
:param use_offchain: Whether to use offchain model or not.
643642
:type use_offchain: bool
644643
:param tool: The tool to interact with (optional).
645-
:type tool: Optional[str]
644+
:type tool: str
646645
:param extra_attributes: Extra attributes to be included in the request metadata (optional).
647646
:type extra_attributes: Optional[Dict[str, Any]]
648647
:param private_key_path: The path to the private key file (optional).
@@ -715,7 +714,7 @@ def marketplace_interact( # pylint: disable=too-many-arguments, too-many-locals
715714
)
716715
(
717716
payment_type,
718-
service_id,
717+
_,
719718
max_delivery_rate,
720719
mech_payment_balance_tracker,
721720
mech_contract,
@@ -727,16 +726,6 @@ def marketplace_interact( # pylint: disable=too-many-arguments, too-many-locals
727726
mech_marketplace_request_config.delivery_rate = max_delivery_rate
728727
mech_marketplace_request_config.payment_type = payment_type
729728

730-
# Expected parameters: agent id and agent registry contract address
731-
# Note: passing service id and service registry contract address as internal function calls are same
732-
tool = verify_or_retrieve_tool(
733-
agent_id=cast(int, service_id),
734-
ledger_api=ledger_api,
735-
tool=tool,
736-
agent_registry_contract=mech_config.service_registry_contract,
737-
contract_abi_url=mech_config.contract_abi_url,
738-
)
739-
740729
(
741730
marketplace_request_event_signature,
742731
marketplace_deliver_event_signature,

0 commit comments

Comments
 (0)