Class: Durable::Llm::Providers::Huggingface::HuggingfaceStreamToken

Inherits:
Object
  • Object
show all
Defined in:
lib/durable/llm/providers/huggingface.rb

Overview

Individual token from Hugging Face streaming response.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(token) ⇒ HuggingfaceStreamToken

Returns a new instance of HuggingfaceStreamToken.



184
185
186
# File 'lib/durable/llm/providers/huggingface.rb', line 184

def initialize(token)
  @text = token['token']['text']
end

Instance Attribute Details

#textObject (readonly)

Returns the value of attribute text.



182
183
184
# File 'lib/durable/llm/providers/huggingface.rb', line 182

def text
  @text
end

Instance Method Details

#to_sObject



188
189
190
# File 'lib/durable/llm/providers/huggingface.rb', line 188

def to_s
  @text || ''
end