Module: Legion::Extensions::Llm::Bedrock::Provider::Capabilities

Defined in:
lib/legion/extensions/llm/bedrock/provider.rb

Overview

Capability predicates inferred from Bedrock model IDs and API modalities.

Class Method Summary collapse

Class Method Details

.chat?(model) ⇒ Boolean

Returns:

  • (Boolean)


92
# File 'lib/legion/extensions/llm/bedrock/provider.rb', line 92

def chat?(model) = !embeddings?(model)

.embeddings?(model) ⇒ Boolean

Returns:

  • (Boolean)


96
# File 'lib/legion/extensions/llm/bedrock/provider.rb', line 96

def embeddings?(model) = model_id(model).match?(/embed|embedding/)

.functions?(model) ⇒ Boolean

Returns:

  • (Boolean)


95
# File 'lib/legion/extensions/llm/bedrock/provider.rb', line 95

def functions?(model) = chat?(model)

.model_id(model) ⇒ Object



98
99
100
101
102
# File 'lib/legion/extensions/llm/bedrock/provider.rb', line 98

def model_id(model)
  return model.fetch('model', model.fetch('id', '')) if model.is_a?(Hash)

  model.respond_to?(:id) ? model.id.to_s : model.to_s
end

.streaming?(model) ⇒ Boolean

Returns:

  • (Boolean)


93
# File 'lib/legion/extensions/llm/bedrock/provider.rb', line 93

def streaming?(model) = chat?(model)

.vision?(model) ⇒ Boolean

Returns:

  • (Boolean)


94
# File 'lib/legion/extensions/llm/bedrock/provider.rb', line 94

def vision?(model) = model_id(model).match?(/(claude-3|llama3-2-(11|90)b)/)