@outputai/llm 0.12.1-next.39bbc03.0 → 0.12.1-next.4f4bf8f.0
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.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@outputai/llm",
|
|
3
|
-
"version": "0.12.1-next.
|
|
3
|
+
"version": "0.12.1-next.4f4bf8f.0",
|
|
4
4
|
"description": "Framework abstraction to interact with LLM models",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.js",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"gray-matter": "4.0.3",
|
|
22
22
|
"liquidjs": "10.27.2",
|
|
23
23
|
"undici": "8.9.0",
|
|
24
|
-
"@outputai/core": "0.12.1-next.
|
|
24
|
+
"@outputai/core": "0.12.1-next.4f4bf8f.0"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"@ai-sdk/amazon-bedrock": "5.0.57",
|
package/src/ai_provider.js
CHANGED
|
@@ -8,7 +8,6 @@ import { createOpenAI } from '@ai-sdk/openai';
|
|
|
8
8
|
import { createPerplexity } from '@ai-sdk/perplexity';
|
|
9
9
|
import { createVertex } from '@ai-sdk/google-vertex';
|
|
10
10
|
import { deprecatedProviderAliases } from './deprecated_provider_aliases.js';
|
|
11
|
-
import { resolveGoogleVertexAuthOptions } from './utils/google_vertex_auth.js';
|
|
12
11
|
|
|
13
12
|
/** This custom dispatcher has longer timeouts. */
|
|
14
13
|
const customDispatcher = new EnvHttpProxyAgent( {
|
|
@@ -25,7 +24,7 @@ const providerInitializers = {
|
|
|
25
24
|
'amazon-bedrock': createAmazonBedrock,
|
|
26
25
|
anthropic: createAnthropic,
|
|
27
26
|
azure: createAzure,
|
|
28
|
-
'google-vertex':
|
|
27
|
+
'google-vertex': createVertex,
|
|
29
28
|
openai: createOpenAI,
|
|
30
29
|
perplexity: createPerplexity
|
|
31
30
|
};
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { ValidationError } from '@outputai/core';
|
|
2
|
-
|
|
3
|
-
const envVar = 'GCP_CREDENTIALS_JSON';
|
|
4
|
-
|
|
5
|
-
const unescapeLinebreaks = v => v.replaceAll( '\\n', '\n' );
|
|
6
|
-
|
|
7
|
-
const decodeBase64 = v => Buffer.from( v, 'base64' ).toString( 'utf8' );
|
|
8
|
-
|
|
9
|
-
const parseJson = v => {
|
|
10
|
-
try {
|
|
11
|
-
return JSON.parse( v );
|
|
12
|
-
} catch ( cause ) {
|
|
13
|
-
throw new ValidationError( `Invalid ${envVar}: value is neither JSON nor base64 encoded JSON`, { cause } );
|
|
14
|
-
}
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
export const resolveGoogleVertexAuthOptions = () => {
|
|
18
|
-
const value = process.env[envVar]?.trim();
|
|
19
|
-
|
|
20
|
-
if ( !value ) {
|
|
21
|
-
return {};
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
const credentials = parseJson( value.startsWith( '{' ) ? value : decodeBase64( value ) );
|
|
25
|
-
|
|
26
|
-
if ( credentials.private_key ) {
|
|
27
|
-
credentials.private_key = unescapeLinebreaks( credentials.private_key );
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
return { googleAuthOptions: { credentials } };
|
|
31
|
-
};
|