prediction-market-agent-tooling 0.56.0.dev1857__py3-none-any.whl → 0.56.0.dev1859__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,6 +31,7 @@ class FunctionCache(SQLModel, table=True):
31
31
  __tablename__ = "function_cache"
32
32
  id: int | None = Field(default=None, primary_key=True)
33
33
  function_name: str = Field(index=True)
34
+ full_function_name: str = Field(index=True)
34
35
  # Args are stored to see what was the function called with.
35
36
  args: Any = Field(sa_column=Column(JSONB, nullable=False))
36
37
  # Args hash is stored as a fast look-up option when looking for cache hits.
@@ -148,8 +149,10 @@ def db_cache(
148
149
  arg_string = json.dumps(args_dict, sort_keys=True, default=str)
149
150
  args_hash = hashlib.md5(arg_string.encode()).hexdigest()
150
151
 
151
- # Get the function name as concat of module and qualname, to not accidentally clash
152
- function_name = func.__module__ + "." + func.__qualname__
152
+ # Get the full function name as concat of module and qualname, to not accidentally clash
153
+ full_function_name = func.__module__ + "." + func.__qualname__
154
+ # But also get the standard function name to easily search for it in database
155
+ function_name = func.__name__
153
156
 
154
157
  # Determine if the function returns or contains Pydantic BaseModel(s)
155
158
  return_type = func.__annotations__.get("return", None)
@@ -166,6 +169,7 @@ def db_cache(
166
169
  select(FunctionCache)
167
170
  .where(
168
171
  FunctionCache.function_name == function_name,
172
+ FunctionCache.full_function_name == full_function_name,
169
173
  FunctionCache.args_hash == args_hash,
170
174
  )
171
175
  .order_by(desc(FunctionCache.created_at))
@@ -179,7 +183,7 @@ def db_cache(
179
183
 
180
184
  if cached_result:
181
185
  logger.info(
182
- f"Cache hit for {function_name} with args {args_dict} and output {cached_result.result}"
186
+ f"Cache hit for {full_function_name} with args {args_dict} and output {cached_result.result}"
183
187
  )
184
188
  if is_pydantic_model:
185
189
  try:
@@ -196,7 +200,7 @@ def db_cache(
196
200
  # On cache miss, compute the result
197
201
  computed_result = func(*args, **kwargs)
198
202
  logger.info(
199
- f"Cache miss for {function_name} with args {args_dict}, computed the output {computed_result}"
203
+ f"Cache miss for {full_function_name} with args {args_dict}, computed the output {computed_result}"
200
204
  )
201
205
 
202
206
  # If postgres access was specified, save it to dB.
@@ -209,6 +213,7 @@ def db_cache(
209
213
  )
210
214
  cache_entry = FunctionCache(
211
215
  function_name=function_name,
216
+ full_function_name=full_function_name,
212
217
  args_hash=args_hash,
213
218
  args=args_dict,
214
219
  result=result_data,
@@ -34,9 +34,10 @@ QUESTION_IS_INVALID_PROMPT = """Main signs about an invalid question (sometimes
34
34
  - Which could give an incentive only to specific participants to commit an immoral violent action, but are in practice unlikely.
35
35
  - Valid: Will the US be engaged in a military conflict with a UN member state in 2021? (It’s unlikely for the US to declare war in order to win a bet on this market).
36
36
  - Valid: Will Derek Chauvin go to jail for the murder of George Flyod? (It’s unlikely that the jurors would collude to make a wrong verdict in order to win this market).
37
- - Questions with relative dates will resolve as invalid. Dates must be stated in absolute terms, not relative depending on the current time.
37
+ - Questions with relative dates will resolve as invalid. Dates must be stated in absolute terms, not relative depending on the current time. But they can be relative to the even specified in the question itself.
38
38
  - Invalid: Who will be the president of the United States in 6 months? ("in 6 months depends on the current time").
39
39
  - Invalid: In the next 14 days, will Gnosis Chain gain another 1M users? ("in the next 14 days depends on the current time").
40
+ - Valid: Will GNO price go up 10 days after Gnosis Pay cashback program is annouced? ("10 days after" is relative to the event in the question, so we can determine absolute value).
40
41
  - Questions about moral values and not facts will be resolved as invalid.
41
42
  - Invalid: "Is it ethical to eat meat?".
42
43
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: prediction-market-agent-tooling
3
- Version: 0.56.0.dev1857
3
+ Version: 0.56.0.dev1859
4
4
  Summary: Tools to benchmark, deploy and monitor prediction market agents.
5
5
  Author: Gnosis
6
6
  Requires-Python: >=3.10,<3.12
@@ -69,7 +69,7 @@ prediction_market_agent_tooling/tools/betting_strategies/market_moving.py,sha256
69
69
  prediction_market_agent_tooling/tools/betting_strategies/minimum_bet_to_win.py,sha256=-FUSuQQgjcWSSnoFxnlAyTeilY6raJABJVM2QKkFqAY,438
70
70
  prediction_market_agent_tooling/tools/betting_strategies/stretch_bet_between.py,sha256=THMXwFlskvzbjnX_OiYtDSzI8XVFyULWfP2525_9UGc,429
71
71
  prediction_market_agent_tooling/tools/betting_strategies/utils.py,sha256=kpIb-ci67Vc1Yqqaa-_S4OUkbhWSIYog4_Iwp69HU_k,97
72
- prediction_market_agent_tooling/tools/caches/db_cache.py,sha256=xJ9zIXCUm0SaHbzWJOk61pGJaZZxCnIVSzpjIx1TxWY,11869
72
+ prediction_market_agent_tooling/tools/caches/db_cache.py,sha256=2a1bIDQk1KmVcp6cR8nSDKyT7rWnBQ7oqmqLjw49sps,12196
73
73
  prediction_market_agent_tooling/tools/caches/inmemory_cache.py,sha256=tGHHd9HCiE_hCCtPtloHZQdDfBuiow9YsqJNYi2Tx_0,499
74
74
  prediction_market_agent_tooling/tools/contract.py,sha256=s3yo8IbXTcvAJcPfLM0_NbgaEsWwLsPmyVnOgyjq_xI,20919
75
75
  prediction_market_agent_tooling/tools/costs.py,sha256=EaAJ7v9laD4VEV3d8B44M4u3_oEO_H16jRVCdoZ93Uw,954
@@ -81,7 +81,7 @@ prediction_market_agent_tooling/tools/httpx_cached_client.py,sha256=0-N1r0zcGKlY
81
81
  prediction_market_agent_tooling/tools/image_gen/image_gen.py,sha256=HzRwBx62hOXBOmrtpkXaP9Qq1Ku03uUGdREocyjLQ_k,1266
82
82
  prediction_market_agent_tooling/tools/image_gen/market_thumbnail_gen.py,sha256=8A3U2uxsCsOfLjru-6R_PPIAuiKY4qFkWp_GSBPV6-s,1280
83
83
  prediction_market_agent_tooling/tools/ipfs/ipfs_handler.py,sha256=CTTMfTvs_8PH4kAtlQby2aeEKwgpmxtuGbd4oYIdJ2A,1201
84
- prediction_market_agent_tooling/tools/is_invalid.py,sha256=EPZWH642LZZqx40_8ejJgE7Qe4nXLTXQIh4lBf5PDQw,5070
84
+ prediction_market_agent_tooling/tools/is_invalid.py,sha256=Gp8ASGmqXZGdKKQ4U2ZfQj6bx2Wngb4IExIfV54E4j4,5322
85
85
  prediction_market_agent_tooling/tools/is_predictable.py,sha256=VGkxSoJ8CSLknloOLzm5J4-us7XImYxVzvpsAzxbpCc,6730
86
86
  prediction_market_agent_tooling/tools/langfuse_.py,sha256=jI_4ROxqo41CCnWGS1vN_AeDVhRzLMaQLxH3kxDu3L8,1153
87
87
  prediction_market_agent_tooling/tools/langfuse_client_utils.py,sha256=B0PhAQyviFnVbtOCYMxYmcCn66cu9nbqAOIAZcdgiRI,5771
@@ -97,8 +97,8 @@ prediction_market_agent_tooling/tools/tavily/tavily_models.py,sha256=5ldQs1pZe6u
97
97
  prediction_market_agent_tooling/tools/tavily/tavily_search.py,sha256=Kw2mXNkMTYTEe1MBSTqhQmLoeXtgb6CkmHlcAJvhtqE,3809
98
98
  prediction_market_agent_tooling/tools/utils.py,sha256=W-9SqeCKd51BYMRhDjYPQ7lfNO_zE9EvYpmu2r5WXGA,7163
99
99
  prediction_market_agent_tooling/tools/web3_utils.py,sha256=44W8siSLNQxeib98bbwAe7V5C609NHNlUuxwuWIRDiY,11838
100
- prediction_market_agent_tooling-0.56.0.dev1857.dist-info/LICENSE,sha256=6or154nLLU6bELzjh0mCreFjt0m2v72zLi3yHE0QbeE,7650
101
- prediction_market_agent_tooling-0.56.0.dev1857.dist-info/METADATA,sha256=NIqgq3qamRLZkjkxDNi0EJm2RdB3drSCIYgP683-JQY,8114
102
- prediction_market_agent_tooling-0.56.0.dev1857.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
103
- prediction_market_agent_tooling-0.56.0.dev1857.dist-info/entry_points.txt,sha256=m8PukHbeH5g0IAAmOf_1Ahm-sGAMdhSSRQmwtpmi2s8,81
104
- prediction_market_agent_tooling-0.56.0.dev1857.dist-info/RECORD,,
100
+ prediction_market_agent_tooling-0.56.0.dev1859.dist-info/LICENSE,sha256=6or154nLLU6bELzjh0mCreFjt0m2v72zLi3yHE0QbeE,7650
101
+ prediction_market_agent_tooling-0.56.0.dev1859.dist-info/METADATA,sha256=wjkMWBepYIs-EtTIlQLUXsg4Vkg_XNEop7Pz-l789Po,8114
102
+ prediction_market_agent_tooling-0.56.0.dev1859.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
103
+ prediction_market_agent_tooling-0.56.0.dev1859.dist-info/entry_points.txt,sha256=m8PukHbeH5g0IAAmOf_1Ahm-sGAMdhSSRQmwtpmi2s8,81
104
+ prediction_market_agent_tooling-0.56.0.dev1859.dist-info/RECORD,,