Class: RubyLLM::Protocols::Responses

Inherits:
ChatCompletions show all
Includes:
Responses::Approvals, Responses::Chat, Responses::Media, Responses::Streaming, Responses::Tools
Defined in:
lib/ruby_llm/protocols/responses.rb,
lib/ruby_llm/protocols/responses/chat.rb,
lib/ruby_llm/protocols/responses/media.rb,
lib/ruby_llm/protocols/responses/tools.rb,
lib/ruby_llm/protocols/responses/batches.rb,
lib/ruby_llm/protocols/responses/approvals.rb,
lib/ruby_llm/protocols/responses/streaming.rb,
lib/ruby_llm/protocols/responses/compaction.rb,
lib/ruby_llm/protocols/responses/token_counting.rb

Overview

The OpenAI Responses API. Overrides the chat surface of Chat Completions; embeddings, images, moderation, and transcription are inherited. Runs stateless (store: false) and replays encrypted reasoning so multi-turn tool calls work without server-side state.

Defined Under Namespace

Modules: Approvals, Batches, Chat, Compaction, Media, Streaming, TokenCounting, Tools

Constant Summary collapse

SERVER_TOOL_ALIASES =
{
  web_search: { tool: { type: 'web_search' } },
  file_search: { tool: { type: 'file_search' } },
  code_execution: { tool: { type: 'code_interpreter', container: { type: 'auto' } } },
  code_interpreter: { tool: { type: 'code_interpreter', container: { type: 'auto' } } },
  image_generation: { tool: { type: 'image_generation' } },
  mcp: lambda do |options|
    options = Support::Utils.deep_symbolize_keys(options)
    options[:server_url] = options.delete(:url) if options.key?(:url)
    options[:server_label] = options.delete(:name) if options.key?(:name)
    { tool: { type: 'mcp' }.merge(options) }
  end
}.freeze

Instance Attribute Summary

Attributes inherited from RubyLLM::Protocol

#config, #connection, #model, #provider

Instance Method Summary collapse

Methods inherited from RubyLLM::Protocol

abstract, #animate_later, #apply_compaction, #apply_compaction_headers, #apply_end_user, #cache_content, #compact, #complete, #count_tokens, #delete_cache, #embed, #extend_cache, #find_cache, #initialize, #list_models, #moderate, #ocr, #paint, #parse_error, #parse_image_responses, #post_image, #post_video, #preprocess_message, #raise_transcription_streaming_unsupported, #refresh_video_job, #render, #render_embedding, #render_transcription_options, #render_video_extension_payload, #rerank, #speak, #stream_speech, #stream_speech_response, #stream_transcription, #supports_embedding_media?, #tokenize, #tool_approval_response, #transcribe, #video_extension_attachment, #video_extension_url, #video_request_url

Methods included from RubyLLM::Protocol::BinaryStreaming

#stream_binary

Methods included from RubyLLM::Protocol::Streaming

build_on_data_handler, build_stream_error_response, error_chunk?, failed_http_status, faraday_1?, handle_data, handle_error_chunk, handle_error_event, handle_failed_response, handle_json_error_chunk, handle_sse, handle_stream, json_error_payload?, parse_error_from_json, parse_streaming_error, process_stream_chunk, raise_stream_error, stream_events, stream_response, stream_state

Constructor Details

This class inherits a constructor from RubyLLM::Protocol

Instance Method Details

#server_tool_aliasesObject



30
31
32
# File 'lib/ruby_llm/protocols/responses.rb', line 30

def server_tool_aliases
  SERVER_TOOL_ALIASES
end