prediction-market-agent-tooling 0.64.6.dev618__py3-none-any.whl → 0.64.6.dev623__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.
@@ -56,7 +56,8 @@ def db_cache(
56
56
  ignore_args: Sequence[str] | None = None,
57
57
  ignore_arg_types: Sequence[type] | None = None,
58
58
  log_error_on_unsavable_data: bool = True,
59
- ) -> Callable[[FunctionT], FunctionT]: ...
59
+ ) -> Callable[[FunctionT], FunctionT]:
60
+ ...
60
61
 
61
62
 
62
63
  @overload
@@ -69,7 +70,8 @@ def db_cache(
69
70
  ignore_args: Sequence[str] | None = None,
70
71
  ignore_arg_types: Sequence[type] | None = None,
71
72
  log_error_on_unsavable_data: bool = True,
72
- ) -> FunctionT: ...
73
+ ) -> FunctionT:
74
+ ...
73
75
 
74
76
 
75
77
  def db_cache(
@@ -23,25 +23,27 @@ def generate_image(
23
23
  raise ImportError(
24
24
  "openai not installed, please install extras `openai` to use this function."
25
25
  )
26
- response = (
27
- OpenAI(
28
- api_key=APIKeys().openai_api_key.get_secret_value(),
29
- )
30
- .images.generate(
31
- model=model,
32
- prompt=prompt,
33
- size=size,
34
- quality=quality,
35
- response_format="b64_json",
36
- n=1,
37
- )
38
- .data[0]
26
+ response = OpenAI(
27
+ api_key=APIKeys().openai_api_key.get_secret_value(),
28
+ ).images.generate(
29
+ model=model,
30
+ prompt=prompt,
31
+ size=size,
32
+ quality=quality,
33
+ response_format="b64_json",
34
+ n=1,
39
35
  )
36
+
37
+ if response.data is None or len(response.data) == 0:
38
+ raise ValueError("No image data returned from the API.")
39
+
40
+ image_data = response.data[0]
41
+
40
42
  image = Image.open(
41
43
  io.BytesIO(
42
44
  base64.b64decode(
43
45
  check_not_none(
44
- response.b64_json, "Can't be none if response_format is b64_json."
46
+ image_data.b64_json, "Can't be none if response_format is b64_json."
45
47
  )
46
48
  )
47
49
  )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: prediction-market-agent-tooling
3
- Version: 0.64.6.dev618
3
+ Version: 0.64.6.dev623
4
4
  Summary: Tools to benchmark, deploy and monitor prediction market agents.
5
5
  Author: Gnosis
6
6
  Requires-Python: >=3.10,<3.13
@@ -86,7 +86,7 @@ prediction_market_agent_tooling/tools/betting_strategies/market_moving.py,sha256
86
86
  prediction_market_agent_tooling/tools/betting_strategies/minimum_bet_to_win.py,sha256=-FUSuQQgjcWSSnoFxnlAyTeilY6raJABJVM2QKkFqAY,438
87
87
  prediction_market_agent_tooling/tools/betting_strategies/stretch_bet_between.py,sha256=THMXwFlskvzbjnX_OiYtDSzI8XVFyULWfP2525_9UGc,429
88
88
  prediction_market_agent_tooling/tools/betting_strategies/utils.py,sha256=68zFWUj43GUaSpOPowVrbI-t6qbCE29RsVHNzCVuJ9U,175
89
- prediction_market_agent_tooling/tools/caches/db_cache.py,sha256=dkjBvRUakWXCkUM1nXxXk62ZPpaESyFMtwRovj4HGRI,12119
89
+ prediction_market_agent_tooling/tools/caches/db_cache.py,sha256=rZIGhgijquwwPtp_qncSAPR1SDF2XxIVZL1ir0fgzWw,12127
90
90
  prediction_market_agent_tooling/tools/caches/inmemory_cache.py,sha256=ZW5iI5rmjqeAebu5T7ftRnlkxiL02IC-MxCfDB80x7w,1506
91
91
  prediction_market_agent_tooling/tools/caches/serializers.py,sha256=vFDx4fsPxclXp2q0sv27j4al_M_Tj9aR2JJP-xNHQXA,2151
92
92
  prediction_market_agent_tooling/tools/contract.py,sha256=Yex8MVYvdBTMZLESLqKpwEyT8EGAfkJRri5kCaPqrBM,21235
@@ -98,7 +98,7 @@ prediction_market_agent_tooling/tools/db/db_manager.py,sha256=GtzHH1NLl8HwqC8Z7s
98
98
  prediction_market_agent_tooling/tools/google_utils.py,sha256=D-6FB2HRtmxaKZJ_Za-qj6VZCp5XU18rF4wLMMrqEUg,2557
99
99
  prediction_market_agent_tooling/tools/hexbytes_custom.py,sha256=ytwr4N8t-9UF1F4wXsln3IV1HBKgaYirsErc3NsKL-M,2119
100
100
  prediction_market_agent_tooling/tools/httpx_cached_client.py,sha256=RxD-hwtZCMctnMwfzy8t51W9Z9gxFGtDYxBIMChazpc,406
101
- prediction_market_agent_tooling/tools/image_gen/image_gen.py,sha256=HzRwBx62hOXBOmrtpkXaP9Qq1Ku03uUGdREocyjLQ_k,1266
101
+ prediction_market_agent_tooling/tools/image_gen/image_gen.py,sha256=i7ole0NMprELk-I3qJQLqFNZjiqM1w6s11IqM4Ctaqw,1349
102
102
  prediction_market_agent_tooling/tools/image_gen/market_thumbnail_gen.py,sha256=jgOow4zw6g8dIJrog6Tp-3NQs4wjUJ3VgVKyMQv-0QM,1286
103
103
  prediction_market_agent_tooling/tools/ipfs/ipfs_handler.py,sha256=CTTMfTvs_8PH4kAtlQby2aeEKwgpmxtuGbd4oYIdJ2A,1201
104
104
  prediction_market_agent_tooling/tools/is_invalid.py,sha256=TAHQXiiusAU45xJ11ZyEP7PnEfcjfzVG7qHRbsHiAd0,5335
@@ -124,8 +124,8 @@ prediction_market_agent_tooling/tools/tokens/usd.py,sha256=yuW8iPPtcpP4eLH2nORMD
124
124
  prediction_market_agent_tooling/tools/transaction_cache.py,sha256=K5YKNL2_tR10Iw2TD9fuP-CTGpBbZtNdgbd0B_R7pjg,1814
125
125
  prediction_market_agent_tooling/tools/utils.py,sha256=AC2a68jwASMWuQi-w8twl8b_M52YwrEJ81abmuEaqMY,6661
126
126
  prediction_market_agent_tooling/tools/web3_utils.py,sha256=zRq-eeBGWt8uUGN9G_WfjmJ0eVvO8aWE9S0Pz_Y6AOA,12342
127
- prediction_market_agent_tooling-0.64.6.dev618.dist-info/LICENSE,sha256=6or154nLLU6bELzjh0mCreFjt0m2v72zLi3yHE0QbeE,7650
128
- prediction_market_agent_tooling-0.64.6.dev618.dist-info/METADATA,sha256=M_UHw2KLlPUDnPIoCe-R5aDQoqd-W3F9oVgO-SzA318,8748
129
- prediction_market_agent_tooling-0.64.6.dev618.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
130
- prediction_market_agent_tooling-0.64.6.dev618.dist-info/entry_points.txt,sha256=m8PukHbeH5g0IAAmOf_1Ahm-sGAMdhSSRQmwtpmi2s8,81
131
- prediction_market_agent_tooling-0.64.6.dev618.dist-info/RECORD,,
127
+ prediction_market_agent_tooling-0.64.6.dev623.dist-info/LICENSE,sha256=6or154nLLU6bELzjh0mCreFjt0m2v72zLi3yHE0QbeE,7650
128
+ prediction_market_agent_tooling-0.64.6.dev623.dist-info/METADATA,sha256=0tM52C23KyjbsDBTdHqh2ccLs2RxTcg7r_SVRq_kwFI,8748
129
+ prediction_market_agent_tooling-0.64.6.dev623.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
130
+ prediction_market_agent_tooling-0.64.6.dev623.dist-info/entry_points.txt,sha256=m8PukHbeH5g0IAAmOf_1Ahm-sGAMdhSSRQmwtpmi2s8,81
131
+ prediction_market_agent_tooling-0.64.6.dev623.dist-info/RECORD,,