Class: LastLLM::Completion

Inherits:
Object
  • Object
show all
Defined in:
lib/last_llm/completion.rb

Overview

Represents a completion response from an LLM provider Contains the generated text and any additional metadata

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ Completion

Returns a new instance of Completion.



7
8
9
# File 'lib/last_llm/completion.rb', line 7

def initialize(client)
  @client = client
end

Instance Method Details

#generate(prompt, options = {}) ⇒ String

Generate text completion in a single response

Parameters:

  • prompt (String)

    The input text to complete

  • options (Hash) (defaults to: {})

    Options to control the completion

Returns:

  • (String)

    The generated text



15
16
17
# File 'lib/last_llm/completion.rb', line 15

def generate(prompt, options = {})
  @client.provider.generate_text(prompt, options)
end