Merge pull request 'adapters: openai is a static-key vendor' (#17) from feat/openai-access into main
This commit was merged in pull request #17.
This commit is contained in:
@@ -167,6 +167,7 @@ type UsageRow struct {
|
|||||||
var registry = map[string]Shape{
|
var registry = map[string]Shape{
|
||||||
"anthropic": RefreshableGrant,
|
"anthropic": RefreshableGrant,
|
||||||
"anthropic-api-key": StaticKey,
|
"anthropic-api-key": StaticKey,
|
||||||
|
"openai": StaticKey,
|
||||||
}
|
}
|
||||||
|
|
||||||
// For returns the adapter for a vendor, refusing an unknown one clearly.
|
// For returns the adapter for a vendor, refusing an unknown one clearly.
|
||||||
|
|||||||
@@ -22,6 +22,16 @@ func TestTheTwoShapesAreSelectedByVendor(t *testing.T) {
|
|||||||
if grant.Shape() != RefreshableGrant {
|
if grant.Shape() != RefreshableGrant {
|
||||||
t.Fatalf("anthropic is %q, expected refreshable-grant", grant.Shape())
|
t.Fatalf("anthropic is %q, expected refreshable-grant", grant.Shape())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// openai is a second static-key vendor, served by the same generic adapter — the registry line is
|
||||||
|
// the whole of its integration, and it reports the static-key shape like any other.
|
||||||
|
openai, err := For("openai")
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
if openai.Shape() != StaticKey {
|
||||||
|
t.Fatalf("openai is %q, expected static-key", openai.Shape())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// The type assertion is what gates the carve-out: a static key is not a Refresher, so it can never
|
// The type assertion is what gates the carve-out: a static key is not a Refresher, so it can never
|
||||||
|
|||||||
Reference in New Issue
Block a user