prediction-market-agent-tooling 0.50.0__py3-none-any.whl → 0.50.1__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.
@@ -45,6 +45,7 @@ class APIKeys(BaseSettings):
45
45
  LANGFUSE_HOST: t.Optional[str] = None
46
46
  LANGFUSE_DEPLOYMENT_VERSION: t.Optional[str] = None
47
47
 
48
+ ENABLE_IPFS_UPLOAD: bool = False
48
49
  PINATA_API_KEY: t.Optional[SecretStr] = None
49
50
  PINATA_API_SECRET: t.Optional[SecretStr] = None
50
51
 
@@ -151,6 +152,12 @@ class APIKeys(BaseSettings):
151
152
  and self.LANGFUSE_HOST is not None
152
153
  )
153
154
 
155
+ @property
156
+ def enable_ipfs_upload(self) -> bool:
157
+ return check_not_none(
158
+ self.ENABLE_IPFS_UPLOAD, "ENABLE_IPFS_UPLOAD missing in the environment."
159
+ )
160
+
154
161
  @property
155
162
  def pinata_api_key(self) -> SecretStr:
156
163
  return check_not_none(
@@ -11,6 +11,7 @@ from functools import cached_property
11
11
  from pydantic import BaseModel, BeforeValidator, computed_field
12
12
  from typing_extensions import Annotated
13
13
  from web3 import Web3
14
+ from web3.constants import HASH_ZERO
14
15
 
15
16
  from prediction_market_agent_tooling.config import APIKeys
16
17
  from prediction_market_agent_tooling.deploy.betting_strategy import (
@@ -302,7 +303,6 @@ class DeployableTraderAgent(DeployableAgent):
302
303
  ) -> None:
303
304
  super().__init__(enable_langfuse=enable_langfuse)
304
305
  self.place_bet = place_bet
305
- self.ipfs_handler = IPFSHandler(APIKeys())
306
306
 
307
307
  def get_betting_strategy(self, market: AgentMarket) -> BettingStrategy:
308
308
  user_id = market.get_user_id(api_keys=APIKeys())
@@ -522,16 +522,21 @@ class DeployableTraderAgent(DeployableAgent):
522
522
  if processed_market.answer.reasoning
523
523
  else ""
524
524
  )
525
- ipfs_hash = self.ipfs_handler.store_agent_result(
526
- IPFSAgentResult(reasoning=reasoning)
527
- )
525
+
526
+ ipfs_hash_decoded = HexBytes(HASH_ZERO)
527
+ if keys.enable_ipfs_upload:
528
+ logger.info("Storing prediction on IPFS.")
529
+ ipfs_hash = IPFSHandler(keys).store_agent_result(
530
+ IPFSAgentResult(reasoning=reasoning)
531
+ )
532
+ ipfs_hash_decoded = ipfscidv0_to_byte32(ipfs_hash)
528
533
 
529
534
  tx_hashes = [
530
535
  HexBytes(HexStr(i.id)) for i in processed_market.trades if i.id is not None
531
536
  ]
532
537
  prediction = ContractPrediction(
533
538
  publisher=keys.public_key,
534
- ipfs_hash=ipfscidv0_to_byte32(ipfs_hash),
539
+ ipfs_hash=ipfs_hash_decoded,
535
540
  tx_hashes=tx_hashes,
536
541
  estimated_probability_bps=int(processed_market.answer.p_yes * 10000),
537
542
  )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: prediction-market-agent-tooling
3
- Version: 0.50.0
3
+ Version: 0.50.1
4
4
  Summary: Tools to benchmark, deploy and monitor prediction market agents.
5
5
  Author: Gnosis
6
6
  Requires-Python: >=3.10,<3.12
@@ -16,8 +16,8 @@ prediction_market_agent_tooling/benchmark/__init__.py,sha256=47DEQpj8HBSa-_TImW-
16
16
  prediction_market_agent_tooling/benchmark/agents.py,sha256=B1-uWdyeN4GGKMWGK_-CcAFJg1m9Y_XuaeIHPB29QR8,3971
17
17
  prediction_market_agent_tooling/benchmark/benchmark.py,sha256=MqTiaaJ3cYiOLUVR7OyImLWxcEya3Rl5JyFYW-K0lwM,17097
18
18
  prediction_market_agent_tooling/benchmark/utils.py,sha256=D0MfUkVZllmvcU0VOurk9tcKT7JTtwwOp-63zuCBVuc,2880
19
- prediction_market_agent_tooling/config.py,sha256=LAOG22P7yi8zDBqMuhBD6FaoCG-w4_tE8rF14hqDffk,6519
20
- prediction_market_agent_tooling/deploy/agent.py,sha256=xCIisNL-WW96hlndI_Cfftv__Eb6X7-LghzNmovCbno,21817
19
+ prediction_market_agent_tooling/config.py,sha256=WC30Nr16RGueTafA9i67OIB-6KDHZRryhiLPzebg9_I,6740
20
+ prediction_market_agent_tooling/deploy/agent.py,sha256=c9ovjd5UUk1Qw64Si7q0OO7SvM6I6Wne1fySpu0oWco,22005
21
21
  prediction_market_agent_tooling/deploy/agent_example.py,sha256=dIIdZashExWk9tOdyDjw87AuUcGyM7jYxNChYrVK2dM,1001
22
22
  prediction_market_agent_tooling/deploy/betting_strategy.py,sha256=cOPznMX0jd380qHw06A-l1XUyoicV54AXBghirtPw0Q,12127
23
23
  prediction_market_agent_tooling/deploy/constants.py,sha256=M5ty8URipYMGe_G-RzxRydK3AFL6CyvmqCraJUrLBnE,82
@@ -90,8 +90,8 @@ prediction_market_agent_tooling/tools/tavily_storage/tavily_models.py,sha256=99S
90
90
  prediction_market_agent_tooling/tools/tavily_storage/tavily_storage.py,sha256=xrtQH9v5pXycBRyc5j45pWqkSffkoc9efNIU1_G633Q,3706
91
91
  prediction_market_agent_tooling/tools/utils.py,sha256=JZj_xM4VbsDSiDlbn2lZFZPEOBSYhqqxd1Y2NpCqnJ4,7117
92
92
  prediction_market_agent_tooling/tools/web3_utils.py,sha256=dkcjG-LtuaWRh7WEMzRGmZ5B5rsxZTlliFOI6fj-EJ8,11842
93
- prediction_market_agent_tooling-0.50.0.dist-info/LICENSE,sha256=6or154nLLU6bELzjh0mCreFjt0m2v72zLi3yHE0QbeE,7650
94
- prediction_market_agent_tooling-0.50.0.dist-info/METADATA,sha256=WJM6adz0OH9KsvN-ZcCPV46AnEIEPNGio8ZXZFFeqbA,8056
95
- prediction_market_agent_tooling-0.50.0.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
96
- prediction_market_agent_tooling-0.50.0.dist-info/entry_points.txt,sha256=m8PukHbeH5g0IAAmOf_1Ahm-sGAMdhSSRQmwtpmi2s8,81
97
- prediction_market_agent_tooling-0.50.0.dist-info/RECORD,,
93
+ prediction_market_agent_tooling-0.50.1.dist-info/LICENSE,sha256=6or154nLLU6bELzjh0mCreFjt0m2v72zLi3yHE0QbeE,7650
94
+ prediction_market_agent_tooling-0.50.1.dist-info/METADATA,sha256=tiAuIY-BbHl1P8PJ3O3jJopESjOzMrHAszZRQ2dVDC0,8056
95
+ prediction_market_agent_tooling-0.50.1.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
96
+ prediction_market_agent_tooling-0.50.1.dist-info/entry_points.txt,sha256=m8PukHbeH5g0IAAmOf_1Ahm-sGAMdhSSRQmwtpmi2s8,81
97
+ prediction_market_agent_tooling-0.50.1.dist-info/RECORD,,