gemx 0.2.2__tar.gz → 0.2.3__tar.gz
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.
- {gemx-0.2.2 → gemx-0.2.3}/PKG-INFO +1 -1
- {gemx-0.2.2 → gemx-0.2.3}/pyproject.toml +1 -1
- {gemx-0.2.2 → gemx-0.2.3}/src/gemx/__init__.py +1 -1
- {gemx-0.2.2 → gemx-0.2.3}/src/gemx/client.py +27 -6
- {gemx-0.2.2 → gemx-0.2.3}/.gitignore +0 -0
- {gemx-0.2.2 → gemx-0.2.3}/LICENSE +0 -0
- {gemx-0.2.2 → gemx-0.2.3}/README.md +0 -0
- {gemx-0.2.2 → gemx-0.2.3}/src/gemx/cli.py +0 -0
- {gemx-0.2.2 → gemx-0.2.3}/src/gemx/errors.py +0 -0
- {gemx-0.2.2 → gemx-0.2.3}/src/gemx/formats.py +0 -0
- {gemx-0.2.2 → gemx-0.2.3}/src/gemx/py.typed +0 -0
- {gemx-0.2.2 → gemx-0.2.3}/tests/__init__.py +0 -0
- {gemx-0.2.2 → gemx-0.2.3}/tests/scripts/TEST_GEMINI.md +0 -0
- {gemx-0.2.2 → gemx-0.2.3}/tests/scripts/gemini_console.js +0 -0
- {gemx-0.2.2 → gemx-0.2.3}/tests/scripts/gemini_console_prompt.js +0 -0
- {gemx-0.2.2 → gemx-0.2.3}/tests/test_cli.py +0 -0
- {gemx-0.2.2 → gemx-0.2.3}/tests/test_client.py +0 -0
- {gemx-0.2.2 → gemx-0.2.3}/tests/test_formats.py +0 -0
|
@@ -95,6 +95,7 @@ CANNED_REPLIES = (
|
|
|
95
95
|
"i'm having a hard time fulfilling your request",
|
|
96
96
|
"i seem to be encountering an error",
|
|
97
97
|
"i encountered an error doing what you asked",
|
|
98
|
+
"something went wrong. please try your request again",
|
|
98
99
|
)
|
|
99
100
|
|
|
100
101
|
|
|
@@ -180,6 +181,20 @@ _LONGEST_RESPONSE_JS = """(args) => {
|
|
|
180
181
|
return { text: best, selector, length: best.length };
|
|
181
182
|
}"""
|
|
182
183
|
|
|
184
|
+
_LIVE_RESPONSES_JS = """(args) => {
|
|
185
|
+
const [selectors, initialCounts] = args;
|
|
186
|
+
const texts = [];
|
|
187
|
+
selectors.forEach(sel => {
|
|
188
|
+
const els = Array.from(document.querySelectorAll(sel));
|
|
189
|
+
const initial = initialCounts[sel] || 0;
|
|
190
|
+
els.slice(initial).forEach(el => {
|
|
191
|
+
const t = el.innerText || el.textContent || '';
|
|
192
|
+
if (t) texts.push(t);
|
|
193
|
+
});
|
|
194
|
+
});
|
|
195
|
+
return texts;
|
|
196
|
+
}"""
|
|
197
|
+
|
|
183
198
|
_PAGE_ELEMENTS_JS = """() => {
|
|
184
199
|
return {
|
|
185
200
|
hasTextarea: document.querySelector('textarea') !== null,
|
|
@@ -573,14 +588,20 @@ class Gemx:
|
|
|
573
588
|
current_length,
|
|
574
589
|
len(best),
|
|
575
590
|
)
|
|
576
|
-
if (
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
and is_canned_reply(best)
|
|
591
|
+
if stable >= cfg.stable_ticks and expected_format in (
|
|
592
|
+
OutputFormat.JSON,
|
|
593
|
+
OutputFormat.XML,
|
|
580
594
|
):
|
|
581
|
-
|
|
582
|
-
|
|
595
|
+
live = await page.evaluate(
|
|
596
|
+
_LIVE_RESPONSES_JS, [list(RESPONSE_SELECTORS), initial_counts]
|
|
597
|
+
)
|
|
598
|
+
canned = next(
|
|
599
|
+
(t for t in [best, *live] if is_canned_reply(t)), None
|
|
583
600
|
)
|
|
601
|
+
if canned is not None:
|
|
602
|
+
raise ResponseTimeoutError(
|
|
603
|
+
f"Gemini returned a canned reply: {canned[:200]!r}"
|
|
604
|
+
)
|
|
584
605
|
if stable >= cfg.stable_ticks and len(best) > cfg.min_response_chars:
|
|
585
606
|
if expected_format in (OutputFormat.JSON, OutputFormat.XML):
|
|
586
607
|
try:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|