Module: Legion::Extensions::Llm::Provider::OpenAICompatible
- Defined in:
- lib/legion/extensions/llm/provider/open_ai_compatible.rb
Overview
Shared OpenAI-compatible HTTP payload and response adapter — the reference implementation for the OpenAI wire dialect (08 R3). Renders FROM Canonical (render_payload) and parses TO Canonical (parse_completion_response / build_chunk). Provider-dialect translation (usage spellings, JSON-string arguments, reasoning fields) lives here, at the edge (03 O03a).
Instance Method Summary collapse
- #completion_url ⇒ Object
- #embedding_url ⇒ Object
- #images_url(with:, mask:) ⇒ Object
- #models_url ⇒ Object
- #moderation_url ⇒ Object
- #stream_url ⇒ Object
- #stream_usage_supported? ⇒ Boolean
- #transcription_url ⇒ Object
Instance Method Details
#completion_url ⇒ Object
15 |
# File 'lib/legion/extensions/llm/provider/open_ai_compatible.rb', line 15 def completion_url = '/v1/chat/completions' |
#embedding_url ⇒ Object
19 |
# File 'lib/legion/extensions/llm/provider/open_ai_compatible.rb', line 19 def (**) = '/v1/embeddings' |
#images_url(with:, mask:) ⇒ Object
22 23 24 |
# File 'lib/legion/extensions/llm/provider/open_ai_compatible.rb', line 22 def images_url(with:, mask:) with || mask ? '/v1/images/edits' : '/v1/images/generations' end |
#models_url ⇒ Object
17 |
# File 'lib/legion/extensions/llm/provider/open_ai_compatible.rb', line 17 def models_url = '/v1/models' |
#moderation_url ⇒ Object
18 |
# File 'lib/legion/extensions/llm/provider/open_ai_compatible.rb', line 18 def moderation_url = '/v1/moderations' |
#stream_url ⇒ Object
16 |
# File 'lib/legion/extensions/llm/provider/open_ai_compatible.rb', line 16 def stream_url = completion_url |
#stream_usage_supported? ⇒ Boolean
14 |
# File 'lib/legion/extensions/llm/provider/open_ai_compatible.rb', line 14 def stream_usage_supported? = false |
#transcription_url ⇒ Object
20 |
# File 'lib/legion/extensions/llm/provider/open_ai_compatible.rb', line 20 def transcription_url = '/v1/audio/transcriptions' |