Repository navigation
Conversation
- Precompute strip_text to consolidate duplicate returns (7->6) - Fixes lint-src CI failure for google#414
|
Your branch is 1 commits behind git fetch origin main
git merge origin/main
git pushNote: Enable "Allow edits by maintainers" to allow automatic updates. |
|
Your branch is 9 commits behind git fetch origin main
git merge origin/main
git pushNote: Enable "Allow edits by maintainers" to allow automatic updates. |
|
Your branch is 15 commits behind git fetch origin main
git merge origin/main
git pushNote: Enable "Allow edits by maintainers" to allow automatic updates. |
|
Your branch is 16 commits behind git fetch origin main
git merge origin/main
git pushNote: Enable "Allow edits by maintainers" to allow automatic updates. |
|
Your branch is 18 commits behind git fetch origin main
git merge origin/main
git pushNote: Enable "Allow edits by maintainers" to allow automatic updates. |
|
Your branch is 23 commits behind git fetch origin main
git merge origin/main
git pushNote: Enable "Allow edits by maintainers" to allow automatic updates. |
5 similar comments
|
Your branch is 23 commits behind git fetch origin main
git merge origin/main
git pushNote: Enable "Allow edits by maintainers" to allow automatic updates. |
|
Your branch is 23 commits behind git fetch origin main
git merge origin/main
git pushNote: Enable "Allow edits by maintainers" to allow automatic updates. |
|
Your branch is 23 commits behind git fetch origin main
git merge origin/main
git pushNote: Enable "Allow edits by maintainers" to allow automatic updates. |
|
Your branch is 23 commits behind git fetch origin main
git merge origin/main
git pushNote: Enable "Allow edits by maintainers" to allow automatic updates. |
|
Your branch is 23 commits behind git fetch origin main
git merge origin/main
git pushNote: Enable "Allow edits by maintainers" to allow automatic updates. |
|
Your branch is 26 commits behind git fetch origin main
git merge origin/main
git pushNote: Enable "Allow edits by maintainers" to allow automatic updates. |
2 similar comments
|
Your branch is 26 commits behind git fetch origin main
git merge origin/main
git pushNote: Enable "Allow edits by maintainers" to allow automatic updates. |
|
Your branch is 26 commits behind git fetch origin main
git merge origin/main
git pushNote: Enable "Allow edits by maintainers" to allow automatic updates. |
|
Your branch is 33 commits behind git fetch origin main
git merge origin/main
git pushNote: Enable "Allow edits by maintainers" to allow automatic updates. |
1 similar comment
|
Your branch is 33 commits behind git fetch origin main
git merge origin/main
git pushNote: Enable "Allow edits by maintainers" to allow automatic updates. |
|
Your branch is 34 commits behind git fetch origin main
git merge origin/main
git pushNote: Enable "Allow edits by maintainers" to allow automatic updates. |
|
Your branch is 35 commits behind git fetch origin main
git merge origin/main
git pushNote: Enable "Allow edits by maintainers" to allow automatic updates. |
2 similar comments
|
Your branch is 35 commits behind git fetch origin main
git merge origin/main
git pushNote: Enable "Allow edits by maintainers" to allow automatic updates. |
|
Your branch is 35 commits behind git fetch origin main
git merge origin/main
git pushNote: Enable "Allow edits by maintainers" to allow automatic updates. |
|
Your branch is 39 commits behind git fetch origin main
git merge origin/main
git pushNote: Enable "Allow edits by maintainers" to allow automatic updates. |
|
Your branch is 41 commits behind git fetch origin main
git merge origin/main
git pushNote: Enable "Allow edits by maintainers" to allow automatic updates. |
|
Your branch is 42 commits behind git fetch origin main
git merge origin/main
git pushNote: Enable "Allow edits by maintainers" to allow automatic updates. |
|
Your branch is 43 commits behind git fetch origin main
git merge origin/main
git pushNote: Enable "Allow edits by maintainers" to allow automatic updates. |
|
Your branch is 51 commits behind git fetch origin main
git merge origin/main
git pushNote: Enable "Allow edits by maintainers" to allow automatic updates. |
BichengWang
left a comment
There was a problem hiding this comment.
Reviewed head ace8d09840b4a282923fa86ac1a6d5292caa7861.
[P2] Preserve backticks inside valid raw JSON before attempting fence recovery (new raw-mode branch). _FENCE_RE.finditer(text) also matches backticks inside JSON string values. With the default strict_fences=False, the single-match fallback discards the surrounding valid JSON and tries to parse only that match's body:
import json
from langextract.core.format_handler import FormatHandler
handler = FormatHandler(use_fences=False)
payload = {"extractions": [{"snippet": "```hello```"}]}
assert handler.parse_output(json.dumps(payload)) == payload["extractions"]This succeeds at the PR's merge base 8c86bf6fa3d2c0b1196409e36218a2de1b84f860 but raises FormatParseError: Failed to parse JSON content: Expecting value: line 1 column 1 (char 0) at this head. A raw example produced by format_extraction_example() with the same extraction text also fails to parse back. Please preserve already valid raw JSON, for example by attempting raw parsing before fence recovery or limiting recovery to an outer fence, and add regression coverage for backticks within extraction values alongside the outer-fence test.
Validation at this exact head: Python 3.11.17; python -m pytest tests -m "not live_api and not requires_pip and not integration" -q completed with 443 passed, 1 deselected, 29 subtests passed. Two additional probes (raw JSON above and formatter round trip) failed; the outer fenced JSON case passed. Dependencies came from the local cache; dotenv loading was disabled and provider credential variables removed for the suite. Pyink and all three import contracts passed. Full isort reported ordering in plugins.py and providers/__init__.py; source Pylint reported R0911 in _extract_content, and test Pylint reported argument mismatches in test_gemini_batch_api.py. No live services, other Python versions, or merge with current main were tested.
|
Your branch is 56 commits behind git fetch origin main
git merge origin/main
git pushNote: Enable "Allow edits by maintainers" to allow automatic updates. |
|
Your branch is 56 commits behind git fetch origin main
git merge origin/main
git pushNote: Enable "Allow edits by maintainers" to allow automatic updates. |
|
Your branch is 62 commits behind git fetch origin main
git merge origin/main
git pushNote: Enable "Allow edits by maintainers" to allow automatic updates. |
|
Your branch is 69 commits behind git fetch origin main
git merge origin/main
git pushNote: Enable "Allow edits by maintainers" to allow automatic updates. |
1 similar comment
|
Your branch is 69 commits behind git fetch origin main
git merge origin/main
git pushNote: Enable "Allow edits by maintainers" to allow automatic updates. |
|
Your branch is 77 commits behind git fetch origin main
git merge origin/main
git pushNote: Enable "Allow edits by maintainers" to allow automatic updates. |
|
Your branch is 88 commits behind git fetch origin main
git merge origin/main
git pushNote: Enable "Allow edits by maintainers" to allow automatic updates. |
Description
Fixes issue #414 where vLLM/lmdeploy OpenAI-compatible backends may return fenced JSON output even when LangExtract is configured for raw JSON mode. This updates
langextract/core/format_handler.pysoFormatHandler._extract_content()detects and strips a single fenced JSON block whenuse_fences=False, and adds a regression test for fenced JSON output in raw JSON mode.Fixes #414
Bug fix
How Has This Been Tested?
tests/format_handler_test.pypython3 -m py_compileabsldependencyChecklist:
pylintover the affected code.