foobara-anthropic-api 0.0.5 → 0.0.6

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: 397ca8262c02350325ef056b1515b62690470a725cd991221b7bab6cc85ee6df
4
- data.tar.gz: 5b077cc5e81663bb5c414fd121a87104527ae5918ffbbb1a8c7ca8495103c545
3
+ metadata.gz: daf62838415e58692f48048970c2306fb4c4432c9be1036e73c2d1c93f5f488a
4
+ data.tar.gz: d40457b63a22ee95e691a7070ad6cb0b971284575b897961d6885644f50f8519
5
5
  SHA512:
6
- metadata.gz: 22f52f6c00e4f81c0c709a39128189c98210f4f92745d430a1cf0057cfa34cdce6f9421e7e2580fb453323b03bf576a7cdc7b92092dc2f05ab037467bc71cc3b
7
- data.tar.gz: ece188c59cd4d84974ed4ce43e1f31098f6a1406f34de934cd6d3ddcdbfdac5e4b2b7425466e113c367617f78b46df63a3e30c1d1ba6298c8c8c7c95d6d33bae
6
+ metadata.gz: a8b7e11af929dd6b675cdc8b20bb9a6a07ab93d30f4868acb60f9e62d9e4760904015f5a88349cfe7dbc8cc17cd534e105539dca6a3c0c9f1b276f74c05e18c1
7
+ data.tar.gz: '08ebc138fd1cbe48dd1429971c2654b483f29e88d8b7b5b11f920c3ca481aef653ddc55fd2408417a14ccedebe803a743d57e27c4d9efa4d4cc44cc1f0450d6e'
@@ -4,6 +4,10 @@ module Foobara
4
4
  module Ai
5
5
  module AnthropicApi
6
6
  class BaseCommand < Foobara::Command
7
+ class << self
8
+ attr_accessor :api_token
9
+ end
10
+
7
11
  include HttpApiCommand
8
12
 
9
13
  base_url "https://api.anthropic.com/v1"
@@ -22,7 +26,11 @@ module Foobara
22
26
  end
23
27
 
24
28
  def api_token
25
- inputs[:api_token] || ENV.fetch("ANTHROPIC_API_KEY", nil)
29
+ inputs[:api_token] || BaseCommand.api_token || api_token_from_env
30
+ end
31
+
32
+ def api_token_from_env
33
+ ENV.fetch("ANTHROPIC_API_KEY", nil)
26
34
  end
27
35
 
28
36
  def anthropic_version
@@ -3,7 +3,7 @@ require_relative "base_command"
3
3
  module Foobara
4
4
  module Ai
5
5
  module AnthropicApi
6
- class ListModels < Foobara::Command
6
+ class ListModels < BaseCommand
7
7
  description "A convenience command that will repeatedly fetch pages of models until all are fetched"
8
8
 
9
9
  inputs do
@@ -7,6 +7,16 @@ module Foobara
7
7
 
8
8
  module AnthropicApi
9
9
  foobara_domain!
10
+
11
+ class << self
12
+ def api_token=(token)
13
+ BaseCommand.api_token = token
14
+ end
15
+
16
+ def api_token
17
+ BaseCommand.api_token
18
+ end
19
+ end
10
20
  end
11
21
  end
12
22
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foobara-anthropic-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miles Georgi