@google/generative-ai
Advanced tools
Comparing version 0.4.0 to 0.5.0
@@ -603,2 +603,7 @@ /** | ||
/** | ||
* Additional attribution information to include in the x-goog-api-client header. | ||
* Used by wrapper SDKs. | ||
*/ | ||
apiClient?: string; | ||
/** | ||
* Base endpoint url. Defaults to "https://generativelanguage.googleapis.com" | ||
@@ -605,0 +610,0 @@ */ |
@@ -203,3 +203,3 @@ 'use strict'; | ||
*/ | ||
const PACKAGE_VERSION = "0.4.0"; | ||
const PACKAGE_VERSION = "0.5.0"; | ||
const PACKAGE_LOG_HEADER = "genai-js"; | ||
@@ -236,4 +236,9 @@ var Task; | ||
*/ | ||
function getClientHeaders() { | ||
return `${PACKAGE_LOG_HEADER}/${PACKAGE_VERSION}`; | ||
function getClientHeaders(requestOptions) { | ||
const clientHeaders = []; | ||
if (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.apiClient) { | ||
clientHeaders.push(requestOptions.apiClient); | ||
} | ||
clientHeaders.push(`${PACKAGE_LOG_HEADER}/${PACKAGE_VERSION}`); | ||
return clientHeaders.join(" "); | ||
} | ||
@@ -245,3 +250,3 @@ async function makeRequest(url, body, requestOptions) { | ||
"Content-Type": "application/json", | ||
"x-goog-api-client": getClientHeaders(), | ||
"x-goog-api-client": getClientHeaders(requestOptions), | ||
"x-goog-api-key": url.apiKey, | ||
@@ -248,0 +253,0 @@ }, body })); |
@@ -36,2 +36,6 @@ /** | ||
} | ||
/** | ||
* Simple, but may become more complex if we add more versions to log. | ||
*/ | ||
export declare function getClientHeaders(requestOptions: RequestOptions): string; | ||
export declare function makeRequest(url: RequestUrl, body: string, requestOptions?: RequestOptions): Promise<Response>; |
@@ -109,2 +109,7 @@ /** | ||
/** | ||
* Additional attribution information to include in the x-goog-api-client header. | ||
* Used by wrapper SDKs. | ||
*/ | ||
apiClient?: string; | ||
/** | ||
* Base endpoint url. Defaults to "https://generativelanguage.googleapis.com" | ||
@@ -111,0 +116,0 @@ */ |
{ | ||
"name": "@google/generative-ai", | ||
"version": "0.4.0", | ||
"version": "0.5.0", | ||
"description": "Google AI JavaScript SDK", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
151962
3863