Class: Vercon::Claude
- Inherits:
-
Object
- Object
- Vercon::Claude
- Defined in:
- lib/vercon/claude.rb
Constant Summary collapse
- BASE_URL =
"https://api.anthropic.com"
Instance Method Summary collapse
-
#initialize ⇒ Claude
constructor
A new instance of Claude.
-
#submit(model: nil, system: nil, max_tokens: 4096, temperature: 0.2, stop_sequences: nil, user: nil, messages: nil, tools: nil) ⇒ Object
rubocop:disable Metrics/ParameterLists.
Constructor Details
Instance Method Details
#submit(model: nil, system: nil, max_tokens: 4096, temperature: 0.2, stop_sequences: nil, user: nil, messages: nil, tools: nil) ⇒ Object
rubocop:disable Metrics/ParameterLists
16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/vercon/claude.rb', line 16 def submit(model: nil, system: nil, max_tokens: 4096, temperature: 0.2, stop_sequences: nil, user: nil, # rubocop:disable Metrics/ParameterLists messages: nil, tools: nil) body = { model: model || @claude_model, system: system, max_tokens: max_tokens, temperature: temperature, stop_sequences: stop_sequences, messages: || [{role: "user", content: user}], tools: tools }.reject { |_, v| v.nil? || ["", [], {}].include?(v) } client.post("/v1/messages", body: body.to_json).then { |res| prepare_response(res.json) } end |