Class: LLM::Chat::Prompt::Completion

Inherits:
Struct
  • Object
show all
Defined in:
lib/llm/chat/prompt/completion.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#botObject

Returns the value of attribute bot

Returns:

  • (Object)

    the current value of bot



4
5
6
# File 'lib/llm/chat/prompt/completion.rb', line 4

def bot
  @bot
end

Instance Method Details

#system(prompt, params = {}) ⇒ LLM::Chat

Parameters:

  • prompt (String)
  • params (Hash) (defaults to: {})

    (see LLM::Provider#complete)

Returns:



9
10
11
# File 'lib/llm/chat/prompt/completion.rb', line 9

def system(prompt, params = {})
  bot.chat prompt, params.merge(role: :system)
end

#user(prompt, params = {}) ⇒ LLM::Chat

Parameters:

  • prompt (String)
  • params (Hash) (defaults to: {})

    (see LLM::Provider#complete)

Returns:



17
18
19
# File 'lib/llm/chat/prompt/completion.rb', line 17

def user(prompt, params = {})
  bot.chat prompt, params.merge(role: :user)
end