| 1 | package Langertha::Engine::OpenAIResponses; | ||
| 2 | # ABSTRACT: OpenAI Responses API (reasoning models like gpt-5.5-pro) | ||
| 3 | 30 | our $VERSION = '0.505'; | |
| 4 | 30 | ▶ | use Moose; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | |||
| 6 | 30 | extends 'Langertha::Engine::OpenAI'; | |
| 7 | |||
| 8 | 30 | with 'Langertha::Role::ResponsesCompatible', 'Langertha::Role::ServerTools', | |
| 9 | 'Langertha::Role::ToolResultImages', 'Langertha::Role::ToolResultPDF'; | ||
| 10 | |||
| 11 | |||
| 12 | # Protocol variant of OpenAI: shares the vendor's API key. | ||
| 13 | 4 | ▶ | sub api_key_env { 'LANGERTHA_OPENAI_API_KEY' } |
|
Subroutine
api_key_env: called CC=1 SCAR=0.0
Pod
documented
| |||
| 14 | |||
| 15 | # The Responses envelope role can stream (typed SSE), but this engine has never | ||
| 16 | # supported it. Opt out: stream_format => undef, and clear the streaming flag | ||
| 17 | # that Role::Streaming (inherited via Engine::OpenAI) would otherwise advertise | ||
| 18 | # (ADR 0002 escape hatch). Both together keep supports('streaming') honest. | ||
| 19 | 1 | ▶ | sub stream_format { return undef } |
|
Subroutine
stream_format: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 20 | |||
| 21 | # | ||
| 22 | # stream_usage comes along from Engine::OpenAI as well. It names the chat wire's | ||
| 23 | # stream_options.include_usage, which the Responses envelope never sends (its | ||
| 24 | # chat_stream_request is Role::ResponsesCompatible's, and a Responses stream | ||
| 25 | # reports usage in response.completed unasked); without streaming it would | ||
| 26 | # claim a request field this engine has no stream to put on (ADR 0038). | ||
| 27 | 744 | ▶ | around engine_capabilities => sub { |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 28 | 744 | my ( $orig, $self, @rest ) = @_; | |
| 29 | 744 | my $caps = $self->$orig(@rest); | |
| 30 | 744 | delete $caps->{streaming}; | |
| 31 | 744 | delete $caps->{stream_usage}; | |
| 32 | 744 | return $caps; | |
| 33 | 30 | }; | |
| 34 | |||
| 35 | # Tool-result PDFs (karr k361): function_call_output.output takes an | ||
| 36 | # input_file part (API reference, FunctionCallOutput: "string or array of | ||
| 37 | # ResponseInputTextContent or ResponseInputImageContent or | ||
| 38 | # ResponseInputFileContent", developers.openai.com/api/reference/resources/ | ||
| 39 | # responses/methods/create; data: URL + filename per the PDF-files guide, | ||
| 40 | # developers.openai.com/api/docs/guides/pdf-files; fetched 2026-09-30). | ||
| 41 | # Docs-derived, not live-verified. The guide names vision models for PDF | ||
| 42 | # input, so tool_result_pdf needs image_input on this wire | ||
| 43 | # (ToolResult->native_needs_vision, applied by Role::Capabilities). Perplexity | ||
| 44 | # shares the envelope but not this part, so Role::ToolResultPDF is composed | ||
| 45 | # here, not on Role::ResponsesCompatible (ADR 0039). | ||
| 46 | |||
| 47 | 30 | __PACKAGE__->meta->make_immutable; | |
| 48 | |||
| 49 | |||
| 50 | 30 | 1; | |
| 51 | |||
| 52 | __END__ | ||