Conversation
also the first response native codex models are added with OpenAIResponseSchema schema
|
We first I guess need to approve StreamCallbacks PR. svilupp/StreamCallbacks.jl#23 |
|
Thank you for the PR! Sorry but I have a crunch at work -- it will take me until the weekend to reply Btw have you considered opening the PR in OpenAI.jl? Then we would just extend |
svilupp
left a comment
There was a problem hiding this comment.
Thank you for the PR!
I left several structural comments on how to organize things.
In addition, could you look into how we build genuine tests to handle this new functionality? See some patterns how I tested the other ones. It would be great to keep the coverage level.
| include("llm_shared.jl") | ||
| include("llm_openai_schema_defs.jl") | ||
| include("llm_openai.jl") | ||
| include("llm_responses.jl") |
There was a problem hiding this comment.
For consistency, could we perhaps organize things as:
llm_openai_chat.jl and llm_openai_responses.jl and explain it at the top level in the llm_interface.jl
| - `input`: The input string for the API, with replacements | ||
| - `instructions`: Optional instructions for the API, or nothing, with replacements | ||
| """ | ||
| function render_responses end |
There was a problem hiding this comment.
can we stick to unified render function? It already has promptSchema as the first argument, so easy to extend with responsesSchema (see the signature elsewhere) ,eg,
PromptingTools.jl/src/llm_shared.jl
Line 33 in 73d7039
| # Returns | ||
| - String with placeholders replaced with values | ||
| """ | ||
| function replace_placeholders(text::AbstractString, kwargs) |
There was a problem hiding this comment.
Isn't this a bit duplicative with the logic in other files?
| enable_websearch::Bool = false, | ||
| model::AbstractString = MODEL_CHAT, | ||
| verbose::Bool = true, | ||
| api_key::AbstractString = get(ENV, "OPENAI_API_KEY", ""), |
There was a problem hiding this comment.
doesn't this defy the consistency with other function?
I thought you or Marcel did the PR on empty api_key by default and load from ENV var if empty
|
|
||
| See `?airespond` for detailed documentation of arguments and usage. | ||
| """ | ||
| function aigenerate(schema::AbstractResponseSchema, prompt::ALLOWED_PROMPT_TYPE; kwargs...) |
| "gpt5" => "gpt-5", | ||
| "gpt5m" => "gpt-5-mini", | ||
| "gpt5n" => "gpt-5-nano", | ||
| "gpt51" => "gpt-5.1", |
There was a problem hiding this comment.
I'll do a separate PR with the new models not to block it!
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 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
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
Summary
This PR adds support for the OpenAI Responses API, including reasoning traces and streaming, integrated with
AbstractResponseSchema.Key changes
airespond/aigenerateinterface to work with the OpenAI Responses endpoint viaAbstractResponseSchemacreate_responseandrender_responseshelpers specialized for the Responses API"detailed","concise","none")Implementation notes
reasoningsummary to"detailed"so reasoning traces are visible by defaultapi_kwargsare forwarded into the request body (not allkwargs), keeping the API payload cleanAIMessageshape and statistics reportingUsage examples
Testing
Existing tests pass locally. The Responses API integration follows the same patterns as other PromptingTools LLM integrations.