Module: OllamaChat::PromptHandling

Included in:
Chat
Defined in:
lib/ollama_chat/prompt_handling.rb

Overview

Provides methods for retrieving and iterating over prompt templates stored in the database.

This module is designed to be mixed into the Chat class, allowing it to access prompt overrides stored in the database using the ‘models` helper.

Instance Method Summary collapse

Instance Method Details

#system_prompt(name) ⇒ OllamaChat::Database::Models::Prompt?

Retrieves a specific system prompt by name from the ‘system_prompt’ context.

Parameters:

  • name (String, Symbol)

    the name of the system prompt to retrieve

Returns:



13
14
15
# File 'lib/ollama_chat/prompt_handling.rb', line 13

def system_prompt(name)
  models::Prompt.where(context: 'system_prompt', name: name.to_s).first
end