prediction-market-agent-tooling 0.65.1__py3-none-any.whl → 0.65.3__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.
@@ -31,8 +31,8 @@ Write only the category itself, nothing else.
31
31
  research_evaluation_chain = (
32
32
  prompt
33
33
  | ChatOpenAI(
34
- model=model,
35
- api_key=APIKeys().openai_api_key_secretstr_v1,
34
+ model_name=model,
35
+ openai_api_key=APIKeys().openai_api_key,
36
36
  )
37
37
  | StrOutputParser()
38
38
  )
@@ -122,10 +122,15 @@ class PriceManager:
122
122
  # Inspired by https://github.com/seer-pm/demo/blob/ca682153a6b4d4dd3dcc4ad8bdcbe32202fc8fe7/web/src/hooks/useMarketOdds.ts#L15
123
123
  price_data: dict[HexAddress, CollateralToken] = {}
124
124
 
125
- for wrapped_token in self.seer_market.wrapped_tokens:
125
+ for idx, wrapped_token in enumerate(self.seer_market.wrapped_tokens):
126
126
  price = self.get_price_for_token(
127
127
  token=Web3.to_checksum_address(wrapped_token),
128
128
  )
129
+ # It's okay if invalid (last) outcome has price 0, but not the other outcomes.
130
+ if price is None and idx != len(self.seer_market.wrapped_tokens) - 1:
131
+ raise ValueError(
132
+ f"Couldn't get price for {wrapped_token} for market {self.seer_market.url}."
133
+ )
129
134
  price_data[wrapped_token] = (
130
135
  price if price is not None else CollateralToken.zero()
131
136
  )
@@ -137,10 +142,9 @@ class PriceManager:
137
142
  sum(price_data.values(), start=CollateralToken.zero())
138
143
  == CollateralToken.zero()
139
144
  ):
140
- return {
141
- OutcomeStr(outcome): Probability(0)
142
- for outcome in self.seer_market.outcomes
143
- }
145
+ raise ValueError(
146
+ f"All prices for market {self.seer_market.url} are zero. This shouldn't happen."
147
+ )
144
148
 
145
149
  for outcome_token, price in price_data.items():
146
150
  old_price = price
@@ -9,7 +9,7 @@ from prediction_market_agent_tooling.deploy.constants import (
9
9
  NO_OUTCOME_LOWERCASE_IDENTIFIER,
10
10
  YES_OUTCOME_LOWERCASE_IDENTIFIER,
11
11
  )
12
- from prediction_market_agent_tooling.gtypes import ChecksumAddress
12
+ from prediction_market_agent_tooling.gtypes import ChecksumAddress, Wei
13
13
  from prediction_market_agent_tooling.loggers import logger
14
14
  from prediction_market_agent_tooling.markets.agent_market import FilterBy, SortBy
15
15
  from prediction_market_agent_tooling.markets.base_subgraph_handler import (
@@ -77,6 +77,7 @@ class SeerSubgraphHandler(BaseSubgraphHandler):
77
77
  @staticmethod
78
78
  def _build_where_statements(
79
79
  filter_by: FilterBy,
80
+ outcome_supply_gt_if_open: Wei,
80
81
  include_conditional_markets: bool = False,
81
82
  include_categorical_markets: bool = True,
82
83
  ) -> dict[Any, Any]:
@@ -88,6 +89,7 @@ class SeerSubgraphHandler(BaseSubgraphHandler):
88
89
  case FilterBy.OPEN:
89
90
  and_stms["openingTs_gt"] = now
90
91
  and_stms["hasAnswers"] = False
92
+ and_stms["outcomesSupply_gt"] = outcome_supply_gt_if_open.value
91
93
  case FilterBy.RESOLVED:
92
94
  # We consider RESOLVED == CLOSED (on Seer UI)
93
95
  and_stms["payoutReported"] = True
@@ -154,6 +156,7 @@ class SeerSubgraphHandler(BaseSubgraphHandler):
154
156
  filter_by: FilterBy,
155
157
  sort_by: SortBy = SortBy.NONE,
156
158
  limit: int | None = None,
159
+ outcome_supply_gt_if_open: Wei = Wei(0),
157
160
  include_conditional_markets: bool = True,
158
161
  include_categorical_markets: bool = True,
159
162
  ) -> list[SeerMarket]:
@@ -163,6 +166,7 @@ class SeerSubgraphHandler(BaseSubgraphHandler):
163
166
  # Binary markets on Seer contain 3 outcomes: OutcomeA, outcomeB and an Invalid option.
164
167
  where_stms = self._build_where_statements(
165
168
  filter_by=filter_by,
169
+ outcome_supply_gt_if_open=outcome_supply_gt_if_open,
166
170
  include_conditional_markets=include_conditional_markets,
167
171
  include_categorical_markets=include_categorical_markets,
168
172
  )
@@ -17,9 +17,9 @@ def rewrite_question_into_image_generation_prompt(question: str) -> str:
17
17
  "openai not installed, please install extras `langchain` to use this function."
18
18
  )
19
19
  llm = ChatOpenAI(
20
- model="gpt-4o-2024-08-06",
20
+ model_name="gpt-4o-2024-08-06",
21
21
  temperature=0.0,
22
- api_key=APIKeys().openai_api_key_secretstr_v1,
22
+ openai_api_key=APIKeys().openai_api_key,
23
23
  )
24
24
  rewritten = str(
25
25
  llm.invoke(
@@ -77,10 +77,10 @@ def is_invalid(
77
77
  return True
78
78
 
79
79
  llm = ChatOpenAI(
80
- model=engine,
80
+ model_name=engine,
81
81
  temperature=temperature,
82
82
  seed=seed,
83
- api_key=APIKeys().openai_api_key_secretstr_v1,
83
+ openai_api_key=APIKeys().openai_api_key,
84
84
  )
85
85
 
86
86
  prompt = ChatPromptTemplate.from_template(template=prompt_template)
@@ -98,10 +98,10 @@ def is_predictable_binary(
98
98
  return True
99
99
 
100
100
  llm = ChatOpenAI(
101
- model=engine,
101
+ model_name=engine,
102
102
  temperature=LLM_SUPER_LOW_TEMPERATURE,
103
103
  seed=LLM_SEED,
104
- api_key=APIKeys().openai_api_key_secretstr_v1,
104
+ openai_api_key=APIKeys().openai_api_key,
105
105
  )
106
106
 
107
107
  prompt = ChatPromptTemplate.from_template(template=prompt_template)
@@ -138,10 +138,10 @@ def is_predictable_without_description(
138
138
  return True
139
139
 
140
140
  llm = ChatOpenAI(
141
- model=engine,
141
+ model_name=engine,
142
142
  temperature=LLM_SUPER_LOW_TEMPERATURE,
143
143
  seed=LLM_SEED,
144
- api_key=APIKeys().openai_api_key_secretstr_v1,
144
+ openai_api_key=APIKeys().openai_api_key,
145
145
  )
146
146
 
147
147
  prompt = ChatPromptTemplate.from_template(template=prompt_template)
@@ -70,8 +70,8 @@ def analyse_news_relevance(
70
70
  )
71
71
  llm = ChatOpenAI(
72
72
  temperature=temperature,
73
- model=model,
74
- api_key=APIKeys().openai_api_key_secretstr_v1,
73
+ model_name=model,
74
+ openai_api_key=APIKeys().openai_api_key,
75
75
  )
76
76
  chain = prompt | llm | parser
77
77
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: prediction-market-agent-tooling
3
- Version: 0.65.1
3
+ Version: 0.65.3
4
4
  Summary: Tools to benchmark, deploy and monitor prediction market agents.
5
5
  Author: Gnosis
6
6
  Requires-Python: >=3.10,<3.13
@@ -27,9 +27,9 @@ Requires-Dist: google-cloud-secret-manager (>=2.18.2,<3.0.0)
27
27
  Requires-Dist: hishel (>=0.0.31,<0.0.32)
28
28
  Requires-Dist: httpx (>=0.25.2,<1.0.0)
29
29
  Requires-Dist: isort (>=5.13.2,<6.0.0)
30
- Requires-Dist: langchain (>=0.2.6,<0.3.0) ; extra == "langchain"
30
+ Requires-Dist: langchain (>=0.3.0,<0.4.0) ; extra == "langchain"
31
31
  Requires-Dist: langchain-community (>=0.0.19)
32
- Requires-Dist: langchain-openai (>=0.1.0,<0.2.0) ; extra == "langchain"
32
+ Requires-Dist: langchain-openai (>=0.3.0,<0.4.0) ; extra == "langchain"
33
33
  Requires-Dist: langfuse (>=2.42.0,<3.0.0)
34
34
  Requires-Dist: loguru (>=0.7.2,<0.8.0)
35
35
  Requires-Dist: loky (>=3.4.1,<4.0.0)
@@ -41,7 +41,7 @@ prediction_market_agent_tooling/logprobs_parser.py,sha256=Du1Yc-fAVSixQX_Zx6KWpg
41
41
  prediction_market_agent_tooling/markets/agent_market.py,sha256=smKuMaP1zyTtw31Robbj3ospF03xptWX0EDKPJbHH9I,19070
42
42
  prediction_market_agent_tooling/markets/base_subgraph_handler.py,sha256=7RaYO_4qAmQ6ZGM8oPK2-CkiJfKmV9MxM-rJlduaecU,1971
43
43
  prediction_market_agent_tooling/markets/blockchain_utils.py,sha256=gZMwCTO-1d2ALXeY7-LP6U4kCpotJ6GMPZwN11kFOfE,2604
44
- prediction_market_agent_tooling/markets/categorize.py,sha256=jsoHWvZk9pU6n17oWSCcCxNNYVwlb_NXsZxKRI7vmsk,1301
44
+ prediction_market_agent_tooling/markets/categorize.py,sha256=orLZlPaHgeREU66m1amxfWikeV77idV4sZDPB8NgSD0,1300
45
45
  prediction_market_agent_tooling/markets/data_models.py,sha256=vFlX1iNWJcYZlImPkTOQCp2C0veIO7HuAxe0Wf_S8yg,6952
46
46
  prediction_market_agent_tooling/markets/manifold/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
47
47
  prediction_market_agent_tooling/markets/manifold/api.py,sha256=tWnjuqvU8pcCuja2B_ynHeds1iiEFc6QWHjeSO_GSxY,7676
@@ -67,10 +67,10 @@ prediction_market_agent_tooling/markets/polymarket/data_models_web.py,sha256=wCw
67
67
  prediction_market_agent_tooling/markets/polymarket/polymarket.py,sha256=meAhQ5_gwVDvlSxhGGVAvRB7B47zKLnRvZ-_13tKtwY,3433
68
68
  prediction_market_agent_tooling/markets/polymarket/utils.py,sha256=8kTeVjXPcXC6DkDvWYsZQLY7x8DS6CEp_yznSEazsNU,2037
69
69
  prediction_market_agent_tooling/markets/seer/data_models.py,sha256=G0i-fnVaK16KWDYVI6w3lvyte6Op7ca_iIC8IfrXmlM,4702
70
- prediction_market_agent_tooling/markets/seer/price_manager.py,sha256=ciplVu2BnI9D9REq9x9cVlBLlzhzZSMmNWTulfO2YRg,5787
70
+ prediction_market_agent_tooling/markets/seer/price_manager.py,sha256=4hSSDyxSj9po9-tRrdtNvJ2d9v0xXT08Ezgbk1JDE3c,6122
71
71
  prediction_market_agent_tooling/markets/seer/seer.py,sha256=5uSKUhyM_3PTguYi9yiD3-E5Famb6M_fayBX1NqebAE,20273
72
72
  prediction_market_agent_tooling/markets/seer/seer_contracts.py,sha256=kH9nPXsx6UM5er42g2f3fLvy36sY5JM2f_beXeuNgUc,3790
73
- prediction_market_agent_tooling/markets/seer/seer_subgraph_handler.py,sha256=v7gOlRRsbj1xpQiz3D3TE6gbO8_Itg2xhPeTqU9DBsc,9701
73
+ prediction_market_agent_tooling/markets/seer/seer_subgraph_handler.py,sha256=pJxch9_u0EdiIatQP1-UFClt8UEfMZAXBlk5wDO_ovk,9940
74
74
  prediction_market_agent_tooling/markets/seer/subgraph_data_models.py,sha256=0izxS8Mtzonfdl9UqvFVXrdj0hVzieroekXhogfZKCw,1817
75
75
  prediction_market_agent_tooling/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
76
76
  prediction_market_agent_tooling/tools/_generic_value.py,sha256=pD_PI13lpPp1gFoljHwa_Lzlp-u2pu0m-Z7LcxwDM2U,10618
@@ -91,17 +91,17 @@ prediction_market_agent_tooling/tools/google_utils.py,sha256=D-6FB2HRtmxaKZJ_Za-
91
91
  prediction_market_agent_tooling/tools/hexbytes_custom.py,sha256=ytwr4N8t-9UF1F4wXsln3IV1HBKgaYirsErc3NsKL-M,2119
92
92
  prediction_market_agent_tooling/tools/httpx_cached_client.py,sha256=RxD-hwtZCMctnMwfzy8t51W9Z9gxFGtDYxBIMChazpc,406
93
93
  prediction_market_agent_tooling/tools/image_gen/image_gen.py,sha256=i7ole0NMprELk-I3qJQLqFNZjiqM1w6s11IqM4Ctaqw,1349
94
- prediction_market_agent_tooling/tools/image_gen/market_thumbnail_gen.py,sha256=jgOow4zw6g8dIJrog6Tp-3NQs4wjUJ3VgVKyMQv-0QM,1286
94
+ prediction_market_agent_tooling/tools/image_gen/market_thumbnail_gen.py,sha256=ihH_ARBuHUIL7DSLYUe2osRrC_iVlzHezfspASOUu0g,1285
95
95
  prediction_market_agent_tooling/tools/ipfs/ipfs_handler.py,sha256=CTTMfTvs_8PH4kAtlQby2aeEKwgpmxtuGbd4oYIdJ2A,1201
96
- prediction_market_agent_tooling/tools/is_invalid.py,sha256=TAHQXiiusAU45xJ11ZyEP7PnEfcjfzVG7qHRbsHiAd0,5335
97
- prediction_market_agent_tooling/tools/is_predictable.py,sha256=gAis7mrHeK5RwMERYR9QJb2rF7lHvCxL6hlOrswSqSo,6911
96
+ prediction_market_agent_tooling/tools/is_invalid.py,sha256=ArYgPqZApRwIPXwBmTdz7d-7ynP856GLaeCcIl9tV08,5334
97
+ prediction_market_agent_tooling/tools/is_predictable.py,sha256=RNwVH31qpHtg2UWdeMZoFOpMsKgE-aKmcc3Uj6_dK-A,6909
98
98
  prediction_market_agent_tooling/tools/langfuse_.py,sha256=jI_4ROxqo41CCnWGS1vN_AeDVhRzLMaQLxH3kxDu3L8,1153
99
99
  prediction_market_agent_tooling/tools/langfuse_client_utils.py,sha256=6IvsqqNNfBtwonAqcdhkDi-GN0pMS8dID3vFGUZoEoM,6626
100
100
  prediction_market_agent_tooling/tools/omen/reality_accuracy.py,sha256=M1SF7iSW1gVlQSTskdVFTn09uPLST23YeipVIWj54io,2236
101
101
  prediction_market_agent_tooling/tools/omen/sell_positions.py,sha256=Q4oI7_QI3AkyxlH10VvxDahYVrphQa1Wnox2Ce_cf_k,2452
102
102
  prediction_market_agent_tooling/tools/parallelism.py,sha256=6Gou0hbjtMZrYvxjTDFUDZuxmE2nqZVbb6hkg1hF82A,1022
103
103
  prediction_market_agent_tooling/tools/relevant_news_analysis/data_models.py,sha256=95l84aztFaxcRLLcRQ46yKJbIlOEuDAbIGLouyliDzA,1316
104
- prediction_market_agent_tooling/tools/relevant_news_analysis/relevant_news_analysis.py,sha256=CddJem7tk15NAudJDwmuL8znTycbR-YI8kTNtd3LzG8,5474
104
+ prediction_market_agent_tooling/tools/relevant_news_analysis/relevant_news_analysis.py,sha256=r4MdP5uEMlaCwoa2XQZzGq3oZEqnoo9S4dg8uzXfSOY,5473
105
105
  prediction_market_agent_tooling/tools/relevant_news_analysis/relevant_news_cache.py,sha256=kNWq92T11Knb9mYBZlMiZUzOpKgCd-5adanylQUMRJA,3085
106
106
  prediction_market_agent_tooling/tools/safe.py,sha256=o477HGPQv7X_eDoOeYoELCHryiq1_102y_JVhGEPDXw,5165
107
107
  prediction_market_agent_tooling/tools/singleton.py,sha256=CiIELUiI-OeS7U7eeHEt0rnVhtQGzwoUdAgn_7u_GBM,729
@@ -116,8 +116,8 @@ prediction_market_agent_tooling/tools/tokens/usd.py,sha256=yuW8iPPtcpP4eLH2nORMD
116
116
  prediction_market_agent_tooling/tools/transaction_cache.py,sha256=K5YKNL2_tR10Iw2TD9fuP-CTGpBbZtNdgbd0B_R7pjg,1814
117
117
  prediction_market_agent_tooling/tools/utils.py,sha256=Jzpck3_QwShhejhgbAhmNxPSOPQJssBQep0eVemVjZ4,7064
118
118
  prediction_market_agent_tooling/tools/web3_utils.py,sha256=zRq-eeBGWt8uUGN9G_WfjmJ0eVvO8aWE9S0Pz_Y6AOA,12342
119
- prediction_market_agent_tooling-0.65.1.dist-info/LICENSE,sha256=6or154nLLU6bELzjh0mCreFjt0m2v72zLi3yHE0QbeE,7650
120
- prediction_market_agent_tooling-0.65.1.dist-info/METADATA,sha256=kpSC3I15pU7pCOkvGEv_nl5WiXDyDzk9JegAlbWdkRg,8734
121
- prediction_market_agent_tooling-0.65.1.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
122
- prediction_market_agent_tooling-0.65.1.dist-info/entry_points.txt,sha256=m8PukHbeH5g0IAAmOf_1Ahm-sGAMdhSSRQmwtpmi2s8,81
123
- prediction_market_agent_tooling-0.65.1.dist-info/RECORD,,
119
+ prediction_market_agent_tooling-0.65.3.dist-info/LICENSE,sha256=6or154nLLU6bELzjh0mCreFjt0m2v72zLi3yHE0QbeE,7650
120
+ prediction_market_agent_tooling-0.65.3.dist-info/METADATA,sha256=zbzefnNMEYlCkahCqbOoiEvbI3kM9gi5oGIxafKb600,8734
121
+ prediction_market_agent_tooling-0.65.3.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
122
+ prediction_market_agent_tooling-0.65.3.dist-info/entry_points.txt,sha256=m8PukHbeH5g0IAAmOf_1Ahm-sGAMdhSSRQmwtpmi2s8,81
123
+ prediction_market_agent_tooling-0.65.3.dist-info/RECORD,,