Support OPENAI_BASE_URL routing and JSON parsing#453
Open
bpulluta wants to merge 6 commits into
Open
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #453 +/- ##
==========================================
+ Coverage 56.11% 61.18% +5.07%
==========================================
Files 63 77 +14
Lines 6080 6846 +766
Branches 591 675 +84
==========================================
+ Hits 3412 4189 +777
+ Misses 2598 2542 -56
- Partials 70 115 +45
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds OpenAI environment-based client configuration and makes LLM JSON response parsing more tolerant of prose-wrapped JSON, supporting routed OpenAI-compatible endpoints.
Changes:
- Maps
OPENAI_API_KEYandOPENAI_BASE_URLinto OpenAI client kwargs while preserving explicit kwargs precedence. - Adds fallback parsing for embedded JSON payloads after strict JSON decoding fails.
- Adds unit tests for OpenAI config env handling and prose-before-JSON parsing.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
compass/llm/config.py |
Adds OpenAI env var mapping for client initialization. |
compass/utilities/parsing.py |
Adds fallback recovery for embedded JSON objects or arrays. |
tests/python/unit/llm/test_config.py |
Adds tests for OpenAI and Azure client kwargs env handling. |
tests/python/unit/utilities/test_utilities_parsing.py |
Adds coverage for prose-prefixed JSON parsing. |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Validation