-
Notifications
You must be signed in to change notification settings - Fork 24
OpenAI responses endpoint #320
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
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
This PR adds support for OpenAI's Responses API (/responses endpoint) used by models like gpt-5.1-codex, addressing review feedback from PR #316: File organization: - Renamed llm_openai.jl to llm_openai_chat.jl for clarity - Created llm_openai_responses.jl for Responses API implementation - Added documentation in llm_interface.jl explaining OpenAI file structure API consistency: - Replaced render_responses with unified render(schema::AbstractResponseSchema, ...) - Removed duplicative replace_placeholders function (uses render(NoSchema, ...) instead) - Fixed API key handling to use empty string default with ENV fallback Testing: - Added TestEchoOpenAIResponseSchema for testing - Created comprehensive test suite in test/llm_openai_responses.jl - All tests pass with 1856 passed, 0 failed Note: Uses OpenAIStream for streaming until ResponseStream is available in StreamCallbacks.jl
This PR adds support for OpenAI's Responses API (/responses endpoint) used by reasoning models (o1, o3) and code models (gpt-5.1-codex). File organization: - Renamed llm_openai.jl to llm_openai_chat.jl for clarity - Created llm_openai_responses.jl for Responses API implementation - Added documentation in llm_interface.jl explaining OpenAI file structure Key features: - aigenerate with OpenAIResponseSchema for basic generation - aiextract for structured extraction (reuses tool_call_signature and parse_tool) - Multi-turn conversations via previous_response_id (no need to re-send history) - Reasoning control via api_kwargs (effort: low/medium/high, summary: concise/detailed) - Reasoning traces accessible via response.extras[:reasoning_content] - Web search integration via enable_websearch=true API consistency: - Unified render(schema::AbstractResponseSchema, ...) function - API key handling with empty string default and ENV fallback - No reasoning added by default (only when specified) Testing: - Added TestEchoOpenAIResponseSchema for testing - Comprehensive test suite including aiextract and reasoning extraction - All tests pass (1868 passed, 7 pre-existing broken) Added examples/working_with_responses_api.jl demonstrating all features.
…jl into openai-responses
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #320 +/- ##
==========================================
+ Coverage 92.05% 92.08% +0.03%
==========================================
Files 38 38
Lines 3346 3384 +38
==========================================
+ Hits 3080 3116 +36
- Misses 266 268 +2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
This PR supersedes #316
Added support for OpenAI's Responses API (
/responsesendpoint) viaOpenAIResponseSchema. Supports reasoning traces, multi-turn conversations withprevious_response_id, and structured extraction withaiextract. Useaigenerate(OpenAIResponseSchema(), prompt; model="o4-mini")for reasoning models (access viaresult.extras[:reasoning_content]).Note: Many features are not supported yet, eg, streaming, built-in tools, etc.
Thanks to @Sixzero for the first draft!