Module: LLM::Transport::Utils Private
- Extended by:
- Utils
- Included in:
- A2A::Transport::HTTP, MCP::Transport::HTTP, Utils
- Defined in:
- lib/llm/transport/utils.rb
Overview
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
Shared utility methods for HTTP-backed transports.
These methods resolve the transport options accepted by providers, MCP HTTP clients, and A2A HTTP clients into concrete LLM::Transport instances.
Instance Method Summary collapse
-
#resolve_transport(host:, port:, timeout:, ssl:, persistent:, transport:) ⇒ LLM::Transport
private
Resolves a transport configuration into a transport instance.
Instance Method Details
#resolve_transport(host:, port:, timeout:, ssl:, persistent:, transport:) ⇒ LLM::Transport
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Resolves a transport configuration into a transport instance.
Nil values use the default Net::HTTP transport, or the persistent Net::HTTP transport when ‘persistent` is true. Transport subclasses are instantiated with the endpoint settings, symbols are resolved through LLM::Transport shortcut methods, and transport instances are returned as-is.
31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/llm/transport/utils.rb', line 31 def resolve_transport(host:, port:, timeout:, ssl:, persistent:, transport:) if transport.nil? default_transport(host:, port:, timeout:, ssl:, persistent:) elsif Class === transport && transport <= LLM::Transport transport.new(host:, port:, timeout:, ssl:) elsif Symbol === transport transport = LLM::Transport.public_send(transport) transport.new(host:, port:, timeout:, ssl:) else transport end end |