Module: PolylingoChat::Translator
- Defined in:
- lib/polylingo_chat/translator.rb,
lib/polylingo_chat/translator/base.rb,
lib/polylingo_chat/translator/gemini_client.rb,
lib/polylingo_chat/translator/openai_client.rb,
lib/polylingo_chat/translator/anthropic_client.rb
Defined Under Namespace
Classes: AnthropicClient, Base, GeminiClient, OpenAIClient
Class Method Summary
collapse
Class Method Details
.detect_language(text) ⇒ Object
9
10
11
|
# File 'lib/polylingo_chat/translator.rb', line 9
def detect_language(text)
provider_client.detect_language(text)
end
|
.provider_client ⇒ Object
17
18
19
|
# File 'lib/polylingo_chat/translator.rb', line 17
def provider_client
@provider_client ||= configure_provider
end
|
.reset_provider! ⇒ Object
34
35
36
37
|
# File 'lib/polylingo_chat/translator.rb', line 34
def reset_provider!
@provider_client = nil
configure_provider
end
|
.translate(text:, from: nil, to:, context: nil) ⇒ Object
13
14
15
|
# File 'lib/polylingo_chat/translator.rb', line 13
def translate(text:, from: nil, to:, context: nil)
provider_client.translate(text: text, from: from, to: to, context: context)
end
|