Class: Riffer::StreamEvents::WebSearchStatus

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

Overview

Represents a web search status notification during streaming.

Emitted when the LLM performs a server-side web search and its status changes.

Instance Attribute Summary collapse

Attributes inherited from Base

#role

Instance Method Summary collapse

Constructor Details

#initialize(status, url: nil, query: nil, role: :assistant) ⇒ WebSearchStatus

– : (String, ?url: String?, ?query: String?, ?role: Symbol) -> void



19
20
21
22
23
24
# File 'lib/riffer/stream_events/web_search_status.rb', line 19

def initialize(status, url: nil, query: nil, role: :assistant)
  super(role: role)
  @status = status
  @url = url
  @query = query
end

Instance Attribute Details

#queryObject (readonly)

The search query (present when available during status changes).



15
16
17
# File 'lib/riffer/stream_events/web_search_status.rb', line 15

def query
  @query
end

#statusObject (readonly)

The web search status (“in_progress”, “searching”, “completed”, “open_page”).



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

def status
  @status
end

#urlObject (readonly)

The URL being fetched (present for “open_page” status).



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

def url
  @url
end

Instance Method Details

#to_hObject

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



28
29
30
31
32
33
# File 'lib/riffer/stream_events/web_search_status.rb', line 28

def to_h
  h = {role: @role, status: @status}
  h[:url] = @url if @url
  h[:query] = @query if @query
  h
end