Class: RubyLLM::Protocols::VertexAI::Research

Inherits:
Interactions show all
Defined in:
lib/ruby_llm/protocols/vertexai/research.rb

Overview

Single-turn hosted Deep Research through Vertex AI Interactions.

Constant Summary collapse

SERVER_TOOL_ALIASES =
{
  mcp: { tool: { type: 'mcp_server' } },
  web_search: { tool: { type: 'google_search' } }
}.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

#cancel_research_job(job, timeout: nil) ⇒ Object



43
44
45
46
47
48
# File 'lib/ruby_llm/protocols/vertexai/research.rb', line 43

def cancel_research_job(job, timeout: nil)
  response = @connection.post("#{research_url(job.id)}/cancel", {}, idempotent: false) do |request|
    request.options.timeout = request_timeout(timeout)
  end
  parse_research_state(response, id: job.id, agent: job.agent)
end

#create_research_job(prompt, agent:, with: nil, provider_tools: nil, provider_options: {}) ⇒ Object



24
25
26
27
28
29
# File 'lib/ruby_llm/protocols/vertexai/research.rb', line 24

def create_research_job(prompt, agent:, with: nil, provider_tools: nil, provider_options: {})
  validate_research_agent(agent)
  payload = render_research_payload(prompt, agent:, with:, provider_tools:, provider_options:)
  response = @connection.post(research_url, payload, idempotent: false)
  parse_research_job(response, agent:)
end

#find_research_job(id) ⇒ Object



31
32
33
34
# File 'lib/ruby_llm/protocols/vertexai/research.rb', line 31

def find_research_job(id)
  response = @connection.get(research_url(id))
  parse_research_job(response, id:)
end

#refresh_research_job(job, timeout: nil) ⇒ Object



36
37
38
39
40
41
# File 'lib/ruby_llm/protocols/vertexai/research.rb', line 36

def refresh_research_job(job, timeout: nil)
  response = @connection.get(research_url(job.id)) do |request|
    request.options.timeout = request_timeout(timeout)
  end
  parse_research_state(response, id: job.id, agent: job.agent)
end

#server_tool_aliasesObject



22
# File 'lib/ruby_llm/protocols/vertexai/research.rb', line 22

def server_tool_aliases = SERVER_TOOL_ALIASES