Class: TranslationAPI::Llm::Prompt
- Inherits:
-
Object
- Object
- TranslationAPI::Llm::Prompt
- Defined in:
- lib/translation_api/llm/prompt.rb
Constant Summary collapse
- SYSTEM_PROMPT_BASE =
<<~TEXT Translate only. Return result only, no extra info Keep symbols TEXT
Instance Method Summary collapse
-
#initialize(except_words:, language:, custom_prompt:) ⇒ Prompt
constructor
A new instance of Prompt.
- #system_prompt ⇒ Object
- #user_prompt ⇒ Object
Constructor Details
#initialize(except_words:, language:, custom_prompt:) ⇒ Prompt
Returns a new instance of Prompt.
12 13 14 15 16 |
# File 'lib/translation_api/llm/prompt.rb', line 12 def initialize(except_words:, language:, custom_prompt:) @except_words = except_words @language = language @custom_prompt = custom_prompt end |
Instance Method Details
#system_prompt ⇒ Object
18 19 20 |
# File 'lib/translation_api/llm/prompt.rb', line 18 def system_prompt SYSTEM_PROMPT_BASE + except_option_text end |
#user_prompt ⇒ Object
22 23 24 25 26 27 |
# File 'lib/translation_api/llm/prompt.rb', line 22 def user_prompt <<~TEXT #{@custom_prompt || ""} Please translate this text to #{@language}: TEXT end |