elelem-anthropic 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5048cfd730cccae4f7acfecebf30f27ad499895d45ef500b20da10b1da9f434f
4
- data.tar.gz: 1bd0ad0fd71859a3995d3da4f85ecaa9c2c797da771505affdda4d5e9420ffe4
3
+ metadata.gz: d98c22b655807bb10b5821cd4eccd5e1e6a891b1db4257bf1e8d858c7dc796d7
4
+ data.tar.gz: 802419f91993a295cc8cae9f8b4c4520b1133a868931645dc9a1028b1e12ec45
5
5
  SHA512:
6
- metadata.gz: 8deb7b3db26d065e251dbe9f873d3e749902a240423a500b1822c31959c36377fb0f758d61b574c68be41804eb878a72ff3e5e3248e8e88f438f7c6ec4ba3a9d
7
- data.tar.gz: 746705924a2fbe02cef39d81c98c26aa1c95e130d3520c7db30f199f4fbade6aac60d16052e6c34655b4d459fb3407862eb620d81ba225f8e70506097f90ddc8
6
+ metadata.gz: b95f05e79d764b2079a94de2bb9372e73c3a20de2aa9ab8f24babad7a26d1c62bab45a043bb33deb9e57c15023682cff93b537332971213dcfe9def48f6b40e7
7
+ data.tar.gz: a9ff618f9163aac6dc464ba15a71e1155c117bc87db18bcb58eddd6172582c76a1895cba7474813c46ca5066d74a289b017629f9bb30f251ff944cfcf21a8ddf
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Elelem
4
4
  module Anthropic
5
- class Client
5
+ class Provider
6
6
  def initialize(endpoint:, headers:, model:, version: nil, read_timeout: 3600, open_timeout: 10)
7
7
  @uri = URI.parse(endpoint)
8
8
  @headers_source = headers
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Elelem
4
4
  module Anthropic
5
- VERSION = "0.2.0"
5
+ VERSION = "0.2.1"
6
6
  end
7
7
  end
@@ -5,16 +5,28 @@ require "json"
5
5
  require "net/http"
6
6
  require "uri"
7
7
 
8
+ require_relative "anthropic/provider"
8
9
  require_relative "anthropic/version"
9
- require_relative "anthropic/client"
10
10
 
11
11
  Elelem.configure do |config|
12
12
  config.provider(:anthropic) do
13
13
  api_key = ENV.fetch("ANTHROPIC_API_KEY")
14
- Elelem::Anthropic::Client.new(
14
+ Elelem::Anthropic::Provider.new(
15
15
  endpoint: "https://api.anthropic.com/v1/messages",
16
16
  headers: { "x-api-key" => api_key, "anthropic-version" => "2023-06-01" },
17
17
  model: ENV.fetch("ANTHROPIC_MODEL", "claude-opus-4-5-20250514")
18
18
  )
19
19
  end
20
+
21
+ config.provider(:vertex) do
22
+ model = ENV.fetch("VERTEX_MODEL", "claude-opus-4-5@20251101")
23
+ project = ENV.fetch("GOOGLE_CLOUD_PROJECT")
24
+ region = ENV.fetch("GOOGLE_CLOUD_REGION", "us-east5")
25
+ Elelem::Anthropic::Provider.new(
26
+ endpoint: "https://#{region}-aiplatform.googleapis.com/v1/projects/#{project}/locations/#{region}/publishers/anthropic/models/#{model}:rawPredict",
27
+ headers: -> { { "Authorization" => "Bearer #{`gcloud auth application-default print-access-token`.strip}" } },
28
+ model: model,
29
+ version: "vertex-2023-10-16"
30
+ )
31
+ end
20
32
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: elelem-anthropic
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - mo khan
@@ -77,7 +77,7 @@ files:
77
77
  - Rakefile
78
78
  - exe/elelem-anthropic
79
79
  - lib/elelem/anthropic.rb
80
- - lib/elelem/anthropic/client.rb
80
+ - lib/elelem/anthropic/provider.rb
81
81
  - lib/elelem/anthropic/version.rb
82
82
  homepage: https://src.mokhan.ca/elelem/anthropic
83
83
  licenses: