class RubyLLM::WebSource
A WebSource is a page a hosted web search returned. They appear on Message#web_sources, normalized across providers. A Citation is different: it links a span of the answer to what supports it, so a search usually has more sources than citations.
response = chat.with_provider_tools(:web_search).ask "What changed in Ruby 4.0?" response.web_sources.map(&:url) # => ["https://www.ruby-lang.org/en/news/", ...]
An address here comes from the outside world. See Message#web_sources before treating one as safe to open.
Attributes
The title the provider reports for the page, or nil.
The address the provider reports for the page.
Public Instance Methods
Source
# File lib/ruby_llm/web_source.rb, line 30 def to_h { url: url, title: title }.compact end
Returns the source as a Hash with symbol keys, omitting a nil title.