class RubyLLM::Citation

A Citation links a span of generated text to the source material that supports it. Providers return citations in different shapes. RubyLLM normalizes all of them into Citation objects on Message#citations. Fields a provider does not report are nil.

chat = RubyLLM.chat(model: 'claude-sonnet-4-5').with_citations
response = chat.ask "Who created Ruby?", with: "facts.txt"

response.citations.each do |citation|
  citation.title      # => "facts.txt"
  citation.cited_text # => the quoted passage from facts.txt
  citation.text       # => the span of the answer it supports
end