File tree Expand file tree Collapse file tree 3 files changed +3
-7
lines changed
Expand file tree Collapse file tree 3 files changed +3
-7
lines changed Original file line number Diff line number Diff line change @@ -34,17 +34,14 @@ export default function createExplicitLocalizer(
3434 ) ;
3535 }
3636
37- const skipAuth = provider . id === "ollama" ;
3837 try {
3938 const model = createProviderClient ( provider . id as ProviderId , provider . model , {
4039 baseUrl : provider . baseUrl ,
41- skipAuth,
4240 } ) ;
4341 return createLocalizerFromModel ( {
4442 model,
4543 id : provider . id ,
4644 prompt : provider . prompt ,
47- skipAuth,
4845 } ) ;
4946 } catch ( error : unknown ) {
5047 if ( error instanceof ProviderKeyMissingError ) {
@@ -80,7 +77,6 @@ function createLocalizerFromModel(params: {
8077 model : LanguageModel ;
8178 id : NonNullable < I18nConfig [ "provider" ] > [ "id" ] ;
8279 prompt : string ;
83- skipAuth ?: boolean ;
8480} ) : ILocalizer {
8581 const { model } = params ;
8682
Original file line number Diff line number Diff line change @@ -74,11 +74,9 @@ function getPureModelProvider(provider: I18nConfig["provider"]) {
7474 throw new Error ( createUnsupportedProviderErrorMessage ( provider ?. id ) ) ;
7575 }
7676
77- const skipAuth = provider ?. id === "ollama" ;
7877 try {
7978 return createProviderClient ( provider ! . id as ProviderId , provider ! . model , {
8079 baseUrl : provider ! . baseUrl ,
81- skipAuth,
8280 } ) ;
8381 } catch ( error : unknown ) {
8482 if ( error instanceof ProviderKeyMissingError ) {
Original file line number Diff line number Diff line change 11import { LanguageModel } from "ai" ;
22import { ProviderId } from "./constants" ;
33import { resolveProviderApiKey } from "./keys" ;
4+ import { PROVIDER_METADATA } from "./metadata" ;
45import { UnsupportedProviderError } from "./errors" ;
56import { createOpenAI } from "@ai-sdk/openai" ;
67import { createAnthropic } from "@ai-sdk/anthropic" ;
@@ -21,7 +22,8 @@ export function createProviderClient(
2122 modelId : string ,
2223 options ?: ClientOptions ,
2324) : LanguageModel {
24- const skipAuth = options ?. skipAuth === true || providerId === "ollama" ;
25+ const skipAuth =
26+ options ?. skipAuth === true || ! PROVIDER_METADATA [ providerId ] ?. apiKeyEnvVar ;
2527 const apiKey = options ?. apiKey ?? resolveProviderApiKey ( providerId , { required : ! skipAuth } ) ;
2628
2729 switch ( providerId ) {
You can’t perform that action at this time.
0 commit comments