mech-client 0.2.14__py3-none-any.whl → 0.2.15__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.
mech_client/__init__.py CHANGED
@@ -1,3 +1,3 @@
1
1
  """Mech client."""
2
2
 
3
- __version__ = "0.2.14"
3
+ __version__ = "0.2.15"
mech_client/interact.py CHANGED
@@ -160,10 +160,18 @@ def get_mech_config(chain_config: Optional[str] = None) -> MechConfig:
160
160
  if chain_config is None:
161
161
  chain_config = next(iter(data))
162
162
 
163
- print(f"Chain configuration: {chain_config}")
163
+ print("Chain configuration:")
164
164
  entry = data[chain_config].copy()
165
165
  ledger_config = LedgerConfig(**entry.pop("ledger_config"))
166
166
  mech_config = MechConfig(**entry, ledger_config=ledger_config)
167
+
168
+ print(f" - Chain ID: {chain_config}")
169
+ print(f" - Gas limit: {mech_config.gas_limit}")
170
+ print(f" - Contract ABI URL: {mech_config.contract_abi_url}")
171
+ print(f" - Transation URL: {mech_config.transaction_url}")
172
+ print(f" - Subgraph URL: {mech_config.subgraph_url}")
173
+ print("")
174
+
167
175
  return mech_config
168
176
 
169
177
 
@@ -371,7 +379,9 @@ def send_request( # pylint: disable=too-many-arguments,too-many-locals
371
379
  v1_file_hash_hex_truncated, v1_file_hash_hex = push_metadata_to_ipfs(
372
380
  prompt, tool, extra_attributes
373
381
  )
374
- print(f"Prompt uploaded: https://gateway.autonolas.tech/ipfs/{v1_file_hash_hex}")
382
+ print(
383
+ f" - Prompt uploaded: https://gateway.autonolas.tech/ipfs/{v1_file_hash_hex}"
384
+ )
375
385
  method_name = "request"
376
386
  methord_args = {"data": v1_file_hash_hex_truncated}
377
387
  tx_args = {
@@ -573,7 +583,7 @@ def interact( # pylint: disable=too-many-arguments,too-many-locals
573
583
  request_signature=request_event_signature,
574
584
  deliver_signature=deliver_event_signature,
575
585
  )
576
- print("Sending request...")
586
+ print("Sending Mech request...")
577
587
  transaction_digest = send_request(
578
588
  crypto=crypto,
579
589
  ledger_api=ledger_api,
@@ -586,19 +596,26 @@ def interact( # pylint: disable=too-many-arguments,too-many-locals
586
596
  timeout=timeout,
587
597
  sleep=sleep,
588
598
  )
599
+
600
+ if not transaction_digest:
601
+ print("Unable to send request")
602
+ return None
603
+
589
604
  transaction_url_formatted = mech_config.transaction_url.format(
590
605
  transaction_digest=transaction_digest
591
606
  )
592
- print(f"Transaction sent: {transaction_url_formatted}")
593
- print("Waiting for transaction receipt...")
607
+ print(f" - Transaction sent: {transaction_url_formatted}")
608
+ print(" - Waiting for transaction receipt...")
594
609
  request_id = watch_for_request_id(
595
610
  wss=wss,
596
611
  mech_contract=mech_contract,
597
612
  ledger_api=ledger_api,
598
613
  request_signature=request_event_signature,
599
614
  )
600
- print(f"Created on-chain request with ID {request_id}")
601
- print("Waiting for Mech response...")
615
+ print(f" - Created on-chain request with ID {request_id}")
616
+ print("")
617
+
618
+ print("Waiting for Mech deliver...")
602
619
  data_url = wait_for_data_url(
603
620
  request_id=request_id,
604
621
  wss=wss,
@@ -610,8 +627,9 @@ def interact( # pylint: disable=too-many-arguments,too-many-locals
610
627
  confirmation_type=confirmation_type,
611
628
  )
612
629
  if data_url:
613
- print(f"Data arrived: {data_url}")
614
- data = requests.get(f"{data_url}/{request_id}").json()
615
- print(f"Data from agent: {data}")
630
+ print(f" - Data arrived: {data_url}")
631
+ data = requests.get(f"{data_url}/{request_id}", timeout=30).json()
632
+ print(" - Data from agent:")
633
+ print(json.dumps(data, indent=2))
616
634
  return data
617
635
  return None
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: mech-client
3
- Version: 0.2.14
3
+ Version: 0.2.15
4
4
  Summary: Basic client to interact with a mech
5
5
  License: Apache-2.0
6
6
  Author: David Minarsch
@@ -1,4 +1,4 @@
1
- mech_client/__init__.py,sha256=UEdYXlGB0zRn_ifncW6eJqmz4ALKRS_Hzb-1QDeDuAg,43
1
+ mech_client/__init__.py,sha256=UkOxX8mmUvRuBasgeg6PqAeekRk5uJEi46_1LyF4TOw,43
2
2
  mech_client/acn.py,sha256=Rj_jLPvJ5loDQfGbu3a_O24cJC4SwIErLceSz_zVYS8,5356
3
3
  mech_client/cli.py,sha256=QnC3Z_vth__ZiU12chRl8q5LYDLjyjzaofB41mWlq8c,4608
4
4
  mech_client/configs/mechs.json,sha256=IABnne1lWi62l84Hzqh3XrP659uPKme2k32yAI0HBrg,4488
@@ -30,14 +30,14 @@ mech_client/helpers/p2p_libp2p_client/README.md,sha256=6x9s6P7TdKkcvAS1wMFHXRz4a
30
30
  mech_client/helpers/p2p_libp2p_client/__init__.py,sha256=-GOP3D_JnmXTDomrMLCbnRk7vRQmihIqTYvyIPzx-q4,879
31
31
  mech_client/helpers/p2p_libp2p_client/connection.py,sha256=pvfHtI-NhgDbay1wLNit6m8InH4c0p00c3hQo0I2jwQ,27887
32
32
  mech_client/helpers/p2p_libp2p_client/connection.yaml,sha256=giYV5FwwugD7ha9IqFHJtvs-Oz1jC5og9rpkstrTqoc,1763
33
- mech_client/interact.py,sha256=E9AW_gRMkz8fRDeQSl9Dd97X_405GodA8Xylv5ZavzQ,20189
33
+ mech_client/interact.py,sha256=AwU7Y6N3E-kPPSrM82xH19sdtCmi0wyBV_0zZhVMAy0,20695
34
34
  mech_client/prompt_to_ipfs.py,sha256=XqSIBko15MEkpWOQNT97fRI6jNxMF5EDBDEPOJFdhyk,2533
35
35
  mech_client/push_to_ipfs.py,sha256=IfvgaPU79N_ZmCPF9d7sPCYz2uduZH0KjT_HQ2LHXoQ,2059
36
36
  mech_client/subgraph.py,sha256=4vY6QFyUVs15gS0SvanJbvAxb3aie07IuxQnfMMnStc,4931
37
37
  mech_client/to_png.py,sha256=pjUcFJ63MJj_r73eqnfqCWMtlpsrj6H4ZmgvIEmRcFw,2581
38
38
  mech_client/wss.py,sha256=hRInQjjsyOrs8dmgBb2VpJvpNt6Tx0aEiY3OhOPQvIs,6600
39
- mech_client-0.2.14.dist-info/LICENSE,sha256=mdBDB-mWKV5Cz4ejBzBiKqan6Z8zVLAh9xwM64O2FW4,11339
40
- mech_client-0.2.14.dist-info/METADATA,sha256=6my3h_RVRKV97PAPvCNxrgsE00zkXfAXfhVw1G2ugdg,10572
41
- mech_client-0.2.14.dist-info/WHEEL,sha256=7Z8_27uaHI_UZAc4Uox4PpBhQ9Y5_modZXWMxtUi4NU,88
42
- mech_client-0.2.14.dist-info/entry_points.txt,sha256=SbRMRsayzD8XfNXhgwPuXEqQsdZ5Bw9XDPnUuaDExyY,45
43
- mech_client-0.2.14.dist-info/RECORD,,
39
+ mech_client-0.2.15.dist-info/LICENSE,sha256=mdBDB-mWKV5Cz4ejBzBiKqan6Z8zVLAh9xwM64O2FW4,11339
40
+ mech_client-0.2.15.dist-info/METADATA,sha256=2usvNHj9vV_zWJhk3MxSA53heifDjTRGDjiQOfcKSgA,10572
41
+ mech_client-0.2.15.dist-info/WHEEL,sha256=7Z8_27uaHI_UZAc4Uox4PpBhQ9Y5_modZXWMxtUi4NU,88
42
+ mech_client-0.2.15.dist-info/entry_points.txt,sha256=SbRMRsayzD8XfNXhgwPuXEqQsdZ5Bw9XDPnUuaDExyY,45
43
+ mech_client-0.2.15.dist-info/RECORD,,