Class: Riffer::StreamEvents::WebSearchDone

Inherits:
Base
  • Object
show all
Defined in:
lib/riffer/stream_events/web_search_done.rb

Overview

Represents the result of a web search during streaming.

Emitted when the LLM has finished a server-side web search.

Instance Attribute Summary collapse

Attributes inherited from Base

#role

Instance Method Summary collapse

Constructor Details

#initialize(query, sources: [], role: :assistant) ⇒ WebSearchDone

– : (String, ?sources: Array[Hash[Symbol, String?]], ?role: Symbol) -> void



16
17
18
19
20
# File 'lib/riffer/stream_events/web_search_done.rb', line 16

def initialize(query, sources: [], role: :assistant)
  super(role: role)
  @query = query
  @sources = sources
end

Instance Attribute Details

#queryObject (readonly)

The search query used.



9
10
11
# File 'lib/riffer/stream_events/web_search_done.rb', line 9

def query
  @query
end

#sourcesObject (readonly)

The search result sources with title and url.



12
13
14
# File 'lib/riffer/stream_events/web_search_done.rb', line 12

def sources
  @sources
end

Instance Method Details

#to_hObject

– : () -> Hash[Symbol, untyped]



24
25
26
# File 'lib/riffer/stream_events/web_search_done.rb', line 24

def to_h
  {role: @role, query: @query, sources: @sources}
end