Class: RubyLLM::Providers::VertexAI
- Inherits:
-
Gemini
- Object
- RubyLLM::Provider
- Gemini
- RubyLLM::Providers::VertexAI
- Includes:
- Chat, Embeddings, Models, Streaming, Transcription
- Defined in:
- lib/ruby_llm/providers/vertexai.rb,
lib/ruby_llm/providers/vertexai/chat.rb,
lib/ruby_llm/providers/vertexai/models.rb,
lib/ruby_llm/providers/vertexai/streaming.rb,
lib/ruby_llm/providers/vertexai/embeddings.rb,
lib/ruby_llm/providers/vertexai/transcription.rb
Overview
Google Vertex AI implementation
Defined Under Namespace
Modules: Chat, Embeddings, Models, Streaming, Transcription
Constant Summary
Constants included from Models
Constants included from Gemini::Transcription
Gemini::Transcription::DEFAULT_PROMPT
Instance Attribute Summary
Attributes inherited from RubyLLM::Provider
Class Method Summary collapse
Instance Method Summary collapse
- #api_base ⇒ Object
- #headers ⇒ Object
-
#initialize(config) ⇒ VertexAI
constructor
A new instance of VertexAI.
Methods included from Models
Methods included from Embeddings
embedding_url, parse_embedding_response, render_embedding_payload
Methods included from Streaming
Methods included from Chat
Methods inherited from Gemini
#attachment_filename, #build_file_attachment, #build_inline_attachment, #build_response_content, capabilities
Methods included from Gemini::Media
format_attachment, format_content, format_text, format_text_file
Methods included from Gemini::Tools
#extract_tool_calls, #format_tool_call, #format_tool_result, #format_tools
Methods included from Gemini::Streaming
Methods included from Gemini::Transcription
Methods included from Gemini::Models
models_url, parse_list_models_response
Methods included from Gemini::Images
#images_url, #parse_image_response, #render_image_payload
Methods included from Gemini::Embeddings
embedding_url, parse_embedding_response, render_embedding_payload
Methods included from Gemini::Chat
completion_url, render_payload
Methods inherited from RubyLLM::Provider
#capabilities, capabilities, #complete, #configuration_requirements, #configured?, configured?, configured_providers, configured_remote_providers, #embed, for, #format_messages, #format_tool_calls, #list_models, #local?, local?, local_providers, #moderate, #name, name, #paint, #parse_error, #parse_tool_calls, providers, register, remote?, #remote?, remote_providers, resolve, slug, #slug, #transcribe
Methods included from Streaming
handle_stream, stream_response
Constructor Details
#initialize(config) ⇒ VertexAI
13 14 15 16 |
# File 'lib/ruby_llm/providers/vertexai.rb', line 13 def initialize(config) super = nil end |
Class Method Details
.configuration_requirements ⇒ Object
34 35 36 |
# File 'lib/ruby_llm/providers/vertexai.rb', line 34 def configuration_requirements i[vertexai_project_id vertexai_location] end |
Instance Method Details
#api_base ⇒ Object
18 19 20 |
# File 'lib/ruby_llm/providers/vertexai.rb', line 18 def api_base "https://#{@config.vertexai_location}-aiplatform.googleapis.com/v1beta1" end |
#headers ⇒ Object
22 23 24 25 26 27 28 29 30 31 |
# File 'lib/ruby_llm/providers/vertexai.rb', line 22 def headers if defined?(VCR) && !VCR.current_cassette.recording? { 'Authorization' => 'Bearer test-token' } else unless .apply({}) end rescue Google::Auth::AuthorizationError => e raise .new(nil, "Invalid Google Cloud credentials for Vertex AI: #{e.message}") end |