-
Notifications
You must be signed in to change notification settings - Fork 68
Expand file tree
/
Copy pathclient.ts
More file actions
56 lines (47 loc) · 1.59 KB
/
client.ts
File metadata and controls
56 lines (47 loc) · 1.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/**
* @license
* Copyright 2026 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import {ApiClient, NodeAuth, NodeDownloader, NodeUploader,} from '@google/genai/vertex_internal';
import {AgentEngines} from './agentengines';
export const SDK_VERSION = '1.12.0'; // x-release-please-version
let agentEnginesInternalWarned = false;
export class Client {
protected readonly apiClient: ApiClient;
public readonly _agentEnginesInternal: AgentEngines;
constructor(
options: {project?: string; location?: string; apiEndpoint?: string;}) {
const auth = new NodeAuth({
googleAuthOptions: {
scopes: ['https://www.googleapis.com/auth/cloud-platform'],
},
});
const uploader = new NodeUploader();
const downloader = new NodeDownloader();
this.apiClient = new ApiClient({
auth,
uploader,
downloader,
project: options.project,
location: options.location,
vertexai: true,
httpOptions: options.apiEndpoint ? {baseUrl: options.apiEndpoint} :
undefined,
userAgentExtra: `vertex-genai-modules/${SDK_VERSION}`,
});
this._agentEnginesInternal = new AgentEngines(this.apiClient);
}
/**
* Getter for agentEnginesInternal that logs a warning on first use.
*/
public get agentEnginesInternal(): AgentEngines {
if (!agentEnginesInternalWarned) {
console.warn(
'The agentEnginesInternal implementation is experimental, and may change in future versions.',
);
agentEnginesInternalWarned = true;
}
return this._agentEnginesInternal;
}
}