Class: Soapstone::AI::AnthropicProvider
- Inherits:
-
Object
- Object
- Soapstone::AI::AnthropicProvider
- Defined in:
- lib/soapstone/core/ai/anthropic_provider.rb
Instance Method Summary collapse
- #generate_commit_message(prompt) ⇒ Object
-
#initialize(api_key:, model: "claude-3-haiku-20240307", **options) ⇒ AnthropicProvider
constructor
A new instance of AnthropicProvider.
Constructor Details
#initialize(api_key:, model: "claude-3-haiku-20240307", **options) ⇒ AnthropicProvider
Returns a new instance of AnthropicProvider.
2 3 4 5 |
# File 'lib/soapstone/core/ai/anthropic_provider.rb', line 2 def initialize(api_key:, model: "claude-3-haiku-20240307", **) @client = Anthropic::Client.new(api_key: api_key) @model = [:model] || model end |
Instance Method Details
#generate_commit_message(prompt) ⇒ Object
7 8 9 10 11 12 |
# File 'lib/soapstone/core/ai/anthropic_provider.rb', line 7 def (prompt) response = make_anthropic_request(prompt.system, prompt.user) parse_response(response) rescue => e "AI generation failed: #{e.}" end |