prediction-market-agent-tooling 0.64.6.dev622__py3-none-any.whl → 0.64.7__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.
- prediction_market_agent_tooling/loggers.py +10 -1
- prediction_market_agent_tooling/tools/image_gen/image_gen.py +16 -14
- {prediction_market_agent_tooling-0.64.6.dev622.dist-info → prediction_market_agent_tooling-0.64.7.dist-info}/METADATA +1 -1
- {prediction_market_agent_tooling-0.64.6.dev622.dist-info → prediction_market_agent_tooling-0.64.7.dist-info}/RECORD +7 -7
- {prediction_market_agent_tooling-0.64.6.dev622.dist-info → prediction_market_agent_tooling-0.64.7.dist-info}/LICENSE +0 -0
- {prediction_market_agent_tooling-0.64.6.dev622.dist-info → prediction_market_agent_tooling-0.64.7.dist-info}/WHEEL +0 -0
- {prediction_market_agent_tooling-0.64.6.dev622.dist-info → prediction_market_agent_tooling-0.64.7.dist-info}/entry_points.txt +0 -0
@@ -8,6 +8,7 @@ import typer.main
|
|
8
8
|
from loguru import logger
|
9
9
|
from pydantic_settings import BaseSettings, SettingsConfigDict
|
10
10
|
from pythonjsonlogger import jsonlogger
|
11
|
+
from tenacity import RetryError
|
11
12
|
|
12
13
|
|
13
14
|
class LogFormat(str, Enum):
|
@@ -68,7 +69,15 @@ def _handle_exception(
|
|
68
69
|
sys.__excepthook__(exc_type, exc_value, exc_traceback)
|
69
70
|
return
|
70
71
|
|
71
|
-
|
72
|
+
info: BaseException | None = exc_value
|
73
|
+
if isinstance(exc_value, RetryError):
|
74
|
+
# In case of RetryError from tenacity, add last attempt's exp to the log, otherwise we won't see the exception's message in the logs.
|
75
|
+
info = exc_value.last_attempt.exception()
|
76
|
+
|
77
|
+
logger.error(
|
78
|
+
f"Uncaught exception: {info}",
|
79
|
+
exc_info=(exc_type, exc_value, exc_traceback),
|
80
|
+
)
|
72
81
|
|
73
82
|
|
74
83
|
def patch_logger(force_patch: bool = False) -> None:
|
@@ -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
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
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
|
-
|
46
|
+
image_data.b64_json, "Can't be none if response_format is b64_json."
|
45
47
|
)
|
46
48
|
)
|
47
49
|
)
|
@@ -35,7 +35,7 @@ prediction_market_agent_tooling/gtypes.py,sha256=bUIZfZIGvIi3aiZNu5rVE9kRevw8sfM
|
|
35
35
|
prediction_market_agent_tooling/jobs/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
36
36
|
prediction_market_agent_tooling/jobs/jobs_models.py,sha256=8vYafsK1cqMWQtjBoq9rruroF84xAVD00vBTMWH6QMg,2166
|
37
37
|
prediction_market_agent_tooling/jobs/omen/omen_jobs.py,sha256=Pf6QxPXGyie-2l_wZUjaGPTjZTlpv50_JhP40mULBaU,5048
|
38
|
-
prediction_market_agent_tooling/loggers.py,sha256=
|
38
|
+
prediction_market_agent_tooling/loggers.py,sha256=_4ccdpSU3Kxmf4wYDZR5fPHXKhPxpUAjj_AISWKFJLM,4915
|
39
39
|
prediction_market_agent_tooling/markets/agent_market.py,sha256=1NomilM0GCXcRq_1N_cr2AbSK5ONTowFeRbrhc7V5zE,14929
|
40
40
|
prediction_market_agent_tooling/markets/base_subgraph_handler.py,sha256=7RaYO_4qAmQ6ZGM8oPK2-CkiJfKmV9MxM-rJlduaecU,1971
|
41
41
|
prediction_market_agent_tooling/markets/blockchain_utils.py,sha256=qm21scopQ6dfewkoqQF6lWLDGg2BblsKUdC9aG93Hmc,2249
|
@@ -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=
|
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.
|
128
|
-
prediction_market_agent_tooling-0.64.
|
129
|
-
prediction_market_agent_tooling-0.64.
|
130
|
-
prediction_market_agent_tooling-0.64.
|
131
|
-
prediction_market_agent_tooling-0.64.
|
127
|
+
prediction_market_agent_tooling-0.64.7.dist-info/LICENSE,sha256=6or154nLLU6bELzjh0mCreFjt0m2v72zLi3yHE0QbeE,7650
|
128
|
+
prediction_market_agent_tooling-0.64.7.dist-info/METADATA,sha256=1iMPY2iyUlk1LofPDU32Lr98VeW9XWkcOHaUtTAoMhc,8741
|
129
|
+
prediction_market_agent_tooling-0.64.7.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
|
130
|
+
prediction_market_agent_tooling-0.64.7.dist-info/entry_points.txt,sha256=m8PukHbeH5g0IAAmOf_1Ahm-sGAMdhSSRQmwtpmi2s8,81
|
131
|
+
prediction_market_agent_tooling-0.64.7.dist-info/RECORD,,
|
File without changes
|
File without changes
|