Class: Postnhost::Translation::OpenaiLlmClient
- Inherits:
-
Object
- Object
- Postnhost::Translation::OpenaiLlmClient
- Defined in:
- app/services/postnhost/translation/openai_llm_client.rb
Constant Summary collapse
- DEFAULT_MODEL =
"gpt-5.6-luna"- TIMEOUT =
1240
Instance Method Summary collapse
-
#initialize(client: nil) ⇒ OpenaiLlmClient
constructor
A new instance of OpenaiLlmClient.
- #text_response(prompt, model: Postnhost.config.openai_gpt_model || DEFAULT_MODEL) ⇒ Object
Constructor Details
#initialize(client: nil) ⇒ OpenaiLlmClient
Returns a new instance of OpenaiLlmClient.
7 8 9 |
# File 'app/services/postnhost/translation/openai_llm_client.rb', line 7 def initialize(client: nil) @client = client end |
Instance Method Details
#text_response(prompt, model: Postnhost.config.openai_gpt_model || DEFAULT_MODEL) ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'app/services/postnhost/translation/openai_llm_client.rb', line 11 def text_response(prompt, model: Postnhost.config.openai_gpt_model || DEFAULT_MODEL) response = client.responses.create( model: model, input: prompt ) response.output_text.strip end |