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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: daf62838415e58692f48048970c2306fb4c4432c9be1036e73c2d1c93f5f488a
|
4
|
+
data.tar.gz: d40457b63a22ee95e691a7070ad6cb0b971284575b897961d6885644f50f8519
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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] ||
|
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 <
|
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
|