Class: Riffer::StreamEvents::WebSearchStatus

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

Overview

A web search status notification, emitted as a server-side web search progresses.

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



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

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).



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

def query
  @query
end

#statusObject (readonly)

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



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

def status
  @status
end

#urlObject (readonly)

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



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

def url
  @url
end

Instance Method Details

#to_hObject

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



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

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