langchain 0.0.132 → 0.0.134

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.
Files changed (70) hide show
  1. package/dist/agents/chat/outputParser.cjs +2 -1
  2. package/dist/agents/chat/outputParser.js +2 -1
  3. package/dist/agents/executor.cjs +106 -7
  4. package/dist/agents/executor.d.ts +23 -0
  5. package/dist/agents/executor.js +104 -6
  6. package/dist/agents/mrkl/outputParser.cjs +2 -1
  7. package/dist/agents/mrkl/outputParser.js +2 -1
  8. package/dist/callbacks/index.cjs +2 -1
  9. package/dist/callbacks/index.d.ts +1 -1
  10. package/dist/callbacks/index.js +1 -1
  11. package/dist/chains/sql_db/sql_db_chain.d.ts +1 -1
  12. package/dist/chains/sql_db/sql_db_prompt.d.ts +6 -6
  13. package/dist/chat_models/googlevertexai.cjs +1 -1
  14. package/dist/chat_models/googlevertexai.d.ts +2 -2
  15. package/dist/chat_models/googlevertexai.js +2 -2
  16. package/dist/chat_models/ollama.cjs +8 -8
  17. package/dist/chat_models/ollama.js +8 -8
  18. package/dist/document_loaders/web/notionapi.cjs +153 -74
  19. package/dist/document_loaders/web/notionapi.d.ts +19 -10
  20. package/dist/document_loaders/web/notionapi.js +154 -75
  21. package/dist/document_loaders/web/recursive_url.cjs +177 -0
  22. package/dist/document_loaders/web/recursive_url.d.ts +27 -0
  23. package/dist/document_loaders/web/recursive_url.js +173 -0
  24. package/dist/embeddings/googlevertexai.cjs +1 -1
  25. package/dist/embeddings/googlevertexai.d.ts +2 -2
  26. package/dist/embeddings/googlevertexai.js +2 -2
  27. package/dist/experimental/multimodal_embeddings/googlevertexai.cjs +1 -1
  28. package/dist/experimental/multimodal_embeddings/googlevertexai.d.ts +2 -2
  29. package/dist/experimental/multimodal_embeddings/googlevertexai.js +2 -2
  30. package/dist/hub.cjs +16 -0
  31. package/dist/hub.d.ts +4 -0
  32. package/dist/hub.js +11 -0
  33. package/dist/llms/bedrock.cjs +63 -19
  34. package/dist/llms/bedrock.d.ts +9 -1
  35. package/dist/llms/bedrock.js +63 -19
  36. package/dist/llms/googlevertexai.cjs +1 -1
  37. package/dist/llms/googlevertexai.js +2 -2
  38. package/dist/load/import_constants.cjs +3 -0
  39. package/dist/load/import_constants.js +3 -0
  40. package/dist/schema/output_parser.cjs +2 -2
  41. package/dist/schema/output_parser.js +2 -2
  42. package/dist/tools/base.cjs +26 -2
  43. package/dist/tools/base.d.ts +9 -0
  44. package/dist/tools/base.js +24 -1
  45. package/dist/tools/sql.cjs +9 -3
  46. package/dist/tools/sql.d.ts +0 -1
  47. package/dist/tools/sql.js +9 -3
  48. package/dist/types/googlevertexai-types.d.ts +8 -3
  49. package/dist/util/googlevertexai-connection.cjs +49 -15
  50. package/dist/util/googlevertexai-connection.d.ts +12 -4
  51. package/dist/util/googlevertexai-connection.js +46 -13
  52. package/dist/vectorstores/googlevertexai.cjs +551 -0
  53. package/dist/vectorstores/googlevertexai.d.ts +180 -0
  54. package/dist/vectorstores/googlevertexai.js +520 -0
  55. package/dist/vectorstores/myscale.cjs +2 -2
  56. package/dist/vectorstores/myscale.d.ts +1 -1
  57. package/dist/vectorstores/myscale.js +2 -2
  58. package/dist/vectorstores/vectara.cjs +11 -2
  59. package/dist/vectorstores/vectara.d.ts +10 -1
  60. package/dist/vectorstores/vectara.js +11 -2
  61. package/document_loaders/web/recursive_url.cjs +1 -0
  62. package/document_loaders/web/recursive_url.d.ts +1 -0
  63. package/document_loaders/web/recursive_url.js +1 -0
  64. package/hub.cjs +1 -0
  65. package/hub.d.ts +1 -0
  66. package/hub.js +1 -0
  67. package/package.json +41 -2
  68. package/vectorstores/googlevertexai.cjs +1 -0
  69. package/vectorstores/googlevertexai.d.ts +1 -0
  70. package/vectorstores/googlevertexai.js +1 -0
@@ -30,6 +30,7 @@ export const optionalImportEntrypoints = [
30
30
  "langchain/vectorstores/analyticdb",
31
31
  "langchain/vectorstores/elasticsearch",
32
32
  "langchain/vectorstores/chroma",
33
+ "langchain/vectorstores/googlevertexai",
33
34
  "langchain/vectorstores/hnswlib",
34
35
  "langchain/vectorstores/faiss",
35
36
  "langchain/vectorstores/weaviate",
@@ -65,6 +66,7 @@ export const optionalImportEntrypoints = [
65
66
  "langchain/document_loaders/web/github",
66
67
  "langchain/document_loaders/web/notiondb",
67
68
  "langchain/document_loaders/web/notionapi",
69
+ "langchain/document_loaders/web/recursive_url",
68
70
  "langchain/document_loaders/web/s3",
69
71
  "langchain/document_loaders/web/sonix_audio",
70
72
  "langchain/document_loaders/web/confluence",
@@ -111,5 +113,6 @@ export const optionalImportEntrypoints = [
111
113
  "langchain/stores/message/planetscale",
112
114
  "langchain/stores/message/xata",
113
115
  "langchain/storage/ioredis",
116
+ "langchain/hub",
114
117
  "langchain/experimental/multimodal_embeddings/googlevertexai",
115
118
  ];
@@ -96,7 +96,7 @@ class StringOutputParser extends BaseTransformOutputParser {
96
96
  enumerable: true,
97
97
  configurable: true,
98
98
  writable: true,
99
- value: ["schema", "output_parser"]
99
+ value: ["langchain", "schema", "output_parser"]
100
100
  });
101
101
  Object.defineProperty(this, "lc_serializable", {
102
102
  enumerable: true,
@@ -135,7 +135,7 @@ class BytesOutputParser extends BaseTransformOutputParser {
135
135
  enumerable: true,
136
136
  configurable: true,
137
137
  writable: true,
138
- value: ["schema", "output_parser"]
138
+ value: ["langchain", "schema", "output_parser"]
139
139
  });
140
140
  Object.defineProperty(this, "lc_serializable", {
141
141
  enumerable: true,
@@ -90,7 +90,7 @@ export class StringOutputParser extends BaseTransformOutputParser {
90
90
  enumerable: true,
91
91
  configurable: true,
92
92
  writable: true,
93
- value: ["schema", "output_parser"]
93
+ value: ["langchain", "schema", "output_parser"]
94
94
  });
95
95
  Object.defineProperty(this, "lc_serializable", {
96
96
  enumerable: true,
@@ -128,7 +128,7 @@ export class BytesOutputParser extends BaseTransformOutputParser {
128
128
  enumerable: true,
129
129
  configurable: true,
130
130
  writable: true,
131
- value: ["schema", "output_parser"]
131
+ value: ["langchain", "schema", "output_parser"]
132
132
  });
133
133
  Object.defineProperty(this, "lc_serializable", {
134
134
  enumerable: true,
@@ -1,9 +1,27 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Tool = exports.StructuredTool = void 0;
3
+ exports.Tool = exports.StructuredTool = exports.ToolInputParsingException = void 0;
4
4
  const zod_1 = require("zod");
5
5
  const manager_js_1 = require("../callbacks/manager.cjs");
6
6
  const index_js_1 = require("../base_language/index.cjs");
7
+ /**
8
+ * Custom error class used to handle exceptions related to tool input parsing.
9
+ * It extends the built-in `Error` class and adds an optional `output`
10
+ * property that can hold the output that caused the exception.
11
+ */
12
+ class ToolInputParsingException extends Error {
13
+ constructor(message, output) {
14
+ super(message);
15
+ Object.defineProperty(this, "output", {
16
+ enumerable: true,
17
+ configurable: true,
18
+ writable: true,
19
+ value: void 0
20
+ });
21
+ this.output = output;
22
+ }
23
+ }
24
+ exports.ToolInputParsingException = ToolInputParsingException;
7
25
  /**
8
26
  * Base class for Tools that accept input of any shape defined by a Zod schema.
9
27
  */
@@ -41,7 +59,13 @@ class StructuredTool extends index_js_1.BaseLangChain {
41
59
  async call(arg, configArg,
42
60
  /** @deprecated */
43
61
  tags) {
44
- const parsed = await this.schema.parseAsync(arg);
62
+ let parsed;
63
+ try {
64
+ parsed = await this.schema.parseAsync(arg);
65
+ }
66
+ catch (e) {
67
+ throw new ToolInputParsingException(`Received tool input did not match expected schema`, JSON.stringify(arg));
68
+ }
45
69
  const config = (0, manager_js_1.parseCallbackConfigArg)(configArg);
46
70
  const callbackManager_ = await manager_js_1.CallbackManager.configure(config.callbacks, this.callbacks, config.tags || tags, this.tags, config.metadata, this.metadata, { verbose: this.verbose });
47
71
  const runManager = await callbackManager_?.handleToolStart(this.toJSON(), typeof parsed === "string" ? parsed : JSON.stringify(parsed));
@@ -7,6 +7,15 @@ import { RunnableConfig } from "../schema/runnable.js";
7
7
  */
8
8
  export interface ToolParams extends BaseLangChainParams {
9
9
  }
10
+ /**
11
+ * Custom error class used to handle exceptions related to tool input parsing.
12
+ * It extends the built-in `Error` class and adds an optional `output`
13
+ * property that can hold the output that caused the exception.
14
+ */
15
+ export declare class ToolInputParsingException extends Error {
16
+ output?: string;
17
+ constructor(message: string, output?: string);
18
+ }
10
19
  /**
11
20
  * Base class for Tools that accept input of any shape defined by a Zod schema.
12
21
  */
@@ -1,6 +1,23 @@
1
1
  import { z } from "zod";
2
2
  import { CallbackManager, parseCallbackConfigArg, } from "../callbacks/manager.js";
3
3
  import { BaseLangChain } from "../base_language/index.js";
4
+ /**
5
+ * Custom error class used to handle exceptions related to tool input parsing.
6
+ * It extends the built-in `Error` class and adds an optional `output`
7
+ * property that can hold the output that caused the exception.
8
+ */
9
+ export class ToolInputParsingException extends Error {
10
+ constructor(message, output) {
11
+ super(message);
12
+ Object.defineProperty(this, "output", {
13
+ enumerable: true,
14
+ configurable: true,
15
+ writable: true,
16
+ value: void 0
17
+ });
18
+ this.output = output;
19
+ }
20
+ }
4
21
  /**
5
22
  * Base class for Tools that accept input of any shape defined by a Zod schema.
6
23
  */
@@ -38,7 +55,13 @@ export class StructuredTool extends BaseLangChain {
38
55
  async call(arg, configArg,
39
56
  /** @deprecated */
40
57
  tags) {
41
- const parsed = await this.schema.parseAsync(arg);
58
+ let parsed;
59
+ try {
60
+ parsed = await this.schema.parseAsync(arg);
61
+ }
62
+ catch (e) {
63
+ throw new ToolInputParsingException(`Received tool input did not match expected schema`, JSON.stringify(arg));
64
+ }
42
65
  const config = parseCallbackConfigArg(configArg);
43
66
  const callbackManager_ = await CallbackManager.configure(config.callbacks, this.callbacks, config.tags || tags, this.tags, config.metadata, this.metadata, { verbose: this.verbose });
44
67
  const runManager = await callbackManager_?.handleToolStart(this.toJSON(), typeof parsed === "string" ? parsed : JSON.stringify(parsed));
@@ -126,14 +126,20 @@ class ListTablesSqlTool extends base_js_1.Tool {
126
126
  enumerable: true,
127
127
  configurable: true,
128
128
  writable: true,
129
- value: `Input is an empty string, output is a comma separated list of tables in the database.`
129
+ value: `Input is an empty string, output is a comma-separated list of tables in the database.`
130
130
  });
131
131
  this.db = db;
132
132
  }
133
- /** @ignore */
134
133
  async _call(_) {
135
134
  try {
136
- const tables = this.db.allTables.map((table) => table.tableName);
135
+ let selectedTables = this.db.allTables;
136
+ if (this.db.includesTables.length > 0) {
137
+ selectedTables = selectedTables.filter((currentTable) => this.db.includesTables.includes(currentTable.tableName));
138
+ }
139
+ if (this.db.ignoreTables.length > 0) {
140
+ selectedTables = selectedTables.filter((currentTable) => !this.db.ignoreTables.includes(currentTable.tableName));
141
+ }
142
+ const tables = selectedTables.map((table) => table.tableName);
137
143
  return tables.join(", ");
138
144
  }
139
145
  catch (error) {
@@ -51,7 +51,6 @@ export declare class ListTablesSqlTool extends Tool implements SqlTool {
51
51
  name: string;
52
52
  db: SqlDatabase;
53
53
  constructor(db: SqlDatabase);
54
- /** @ignore */
55
54
  _call(_: string): Promise<string>;
56
55
  description: string;
57
56
  }
package/dist/tools/sql.js CHANGED
@@ -121,14 +121,20 @@ export class ListTablesSqlTool extends Tool {
121
121
  enumerable: true,
122
122
  configurable: true,
123
123
  writable: true,
124
- value: `Input is an empty string, output is a comma separated list of tables in the database.`
124
+ value: `Input is an empty string, output is a comma-separated list of tables in the database.`
125
125
  });
126
126
  this.db = db;
127
127
  }
128
- /** @ignore */
129
128
  async _call(_) {
130
129
  try {
131
- const tables = this.db.allTables.map((table) => table.tableName);
130
+ let selectedTables = this.db.allTables;
131
+ if (this.db.includesTables.length > 0) {
132
+ selectedTables = selectedTables.filter((currentTable) => this.db.includesTables.includes(currentTable.tableName));
133
+ }
134
+ if (this.db.ignoreTables.length > 0) {
135
+ selectedTables = selectedTables.filter((currentTable) => !this.db.ignoreTables.includes(currentTable.tableName));
136
+ }
137
+ const tables = selectedTables.map((table) => table.tableName);
132
138
  return tables.join(", ");
133
139
  }
134
140
  catch (error) {
@@ -6,10 +6,12 @@ export interface GoogleVertexAIConnectionParams {
6
6
  authOptions?: GoogleAuthOptions;
7
7
  /** Region where the LLM is stored */
8
8
  location?: string;
9
- /** Model to use */
10
- model?: string;
9
+ /** The version of the API functions. Part of the path. */
10
+ apiVersion?: string;
11
11
  }
12
12
  export interface GoogleVertexAIModelParams {
13
+ /** Model to use */
14
+ model?: string;
13
15
  /** Sampling temperature to use */
14
16
  temperature?: number;
15
17
  /**
@@ -39,7 +41,10 @@ export interface GoogleVertexAIModelParams {
39
41
  }
40
42
  export interface GoogleVertexAIBaseLLMInput extends BaseLLMParams, GoogleVertexAIConnectionParams, GoogleVertexAIModelParams {
41
43
  }
42
- export interface GoogleVertexAIBasePrediction {
44
+ export interface GoogleVertexAIResponse {
45
+ data: any;
46
+ }
47
+ export interface GoogleVertexAIBasePrediction extends GoogleVertexAIResponse {
43
48
  safetyAttributes?: any;
44
49
  }
45
50
  export interface GoogleVertexAILLMResponse<PredictionType extends GoogleVertexAIBasePrediction> {
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.GoogleVertexAIConnection = void 0;
3
+ exports.GoogleVertexAILLMConnection = exports.GoogleVertexAIConnection = void 0;
4
4
  const google_auth_library_1 = require("google-auth-library");
5
5
  class GoogleVertexAIConnection {
6
6
  constructor(fields, caller) {
@@ -22,11 +22,11 @@ class GoogleVertexAIConnection {
22
22
  writable: true,
23
23
  value: "us-central1"
24
24
  });
25
- Object.defineProperty(this, "model", {
25
+ Object.defineProperty(this, "apiVersion", {
26
26
  enumerable: true,
27
27
  configurable: true,
28
28
  writable: true,
29
- value: void 0
29
+ value: "v1"
30
30
  });
31
31
  Object.defineProperty(this, "auth", {
32
32
  enumerable: true,
@@ -37,31 +37,65 @@ class GoogleVertexAIConnection {
37
37
  this.caller = caller;
38
38
  this.endpoint = fields?.endpoint ?? this.endpoint;
39
39
  this.location = fields?.location ?? this.location;
40
- this.model = fields?.model ?? this.model;
40
+ this.apiVersion = fields?.apiVersion ?? this.apiVersion;
41
41
  this.auth = new google_auth_library_1.GoogleAuth({
42
42
  scopes: "https://www.googleapis.com/auth/cloud-platform",
43
43
  ...fields?.authOptions,
44
44
  });
45
45
  }
46
- async request(instances, parameters, options) {
46
+ buildMethod() {
47
+ return "POST";
48
+ }
49
+ async _request(data, options) {
47
50
  const client = await this.auth.getClient();
48
- const projectId = await this.auth.getProjectId();
49
- const url = `https://${this.endpoint}/v1/projects/${projectId}/locations/${this.location}/publishers/google/models/${this.model}:predict`;
50
- const method = "POST";
51
- const data = {
52
- instances,
53
- parameters,
54
- };
51
+ const url = await this.buildUrl();
52
+ const method = this.buildMethod();
53
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
55
54
  const opts = {
56
55
  url,
57
56
  method,
58
- data,
59
57
  };
58
+ if (data && method === "POST") {
59
+ opts.data = data;
60
+ }
60
61
  async function _request() {
61
62
  return client.request(opts);
62
63
  }
63
- const response = await this.caller.callWithOptions({ signal: options.signal }, _request.bind(client));
64
- return response;
64
+ try {
65
+ const callResponse = await this.caller.callWithOptions({ signal: options?.signal }, _request.bind(client));
66
+ const response = callResponse; // Done for typecast safety, I guess
67
+ return response;
68
+ }
69
+ catch (x) {
70
+ console.error(JSON.stringify(x, null, 1));
71
+ throw x;
72
+ }
65
73
  }
66
74
  }
67
75
  exports.GoogleVertexAIConnection = GoogleVertexAIConnection;
76
+ class GoogleVertexAILLMConnection extends GoogleVertexAIConnection {
77
+ constructor(fields, caller) {
78
+ super(fields, caller);
79
+ Object.defineProperty(this, "model", {
80
+ enumerable: true,
81
+ configurable: true,
82
+ writable: true,
83
+ value: void 0
84
+ });
85
+ this.model = fields?.model ?? this.model;
86
+ }
87
+ async buildUrl() {
88
+ const projectId = await this.auth.getProjectId();
89
+ const url = `https://${this.endpoint}/v1/projects/${projectId}/locations/${this.location}/publishers/google/models/${this.model}:predict`;
90
+ return url;
91
+ }
92
+ async request(instances, parameters, options) {
93
+ const data = {
94
+ instances,
95
+ parameters,
96
+ };
97
+ const response = await this._request(data, options);
98
+ return response;
99
+ }
100
+ }
101
+ exports.GoogleVertexAILLMConnection = GoogleVertexAILLMConnection;
@@ -1,13 +1,21 @@
1
1
  import { GoogleAuth } from "google-auth-library";
2
2
  import { BaseLanguageModelCallOptions } from "../base_language/index.js";
3
- import { AsyncCaller } from "./async_caller.js";
4
- import { GoogleVertexAIBasePrediction, GoogleVertexAIConnectionParams, GoogleVertexAILLMResponse, GoogleVertexAIModelParams } from "../types/googlevertexai-types.js";
5
- export declare class GoogleVertexAIConnection<CallOptions extends BaseLanguageModelCallOptions, InstanceType, PredictionType extends GoogleVertexAIBasePrediction> implements GoogleVertexAIConnectionParams {
3
+ import { AsyncCaller, AsyncCallerCallOptions } from "./async_caller.js";
4
+ import { GoogleVertexAIBaseLLMInput, GoogleVertexAIBasePrediction, GoogleVertexAIConnectionParams, GoogleVertexAILLMResponse, GoogleVertexAIModelParams, GoogleVertexAIResponse } from "../types/googlevertexai-types.js";
5
+ export declare abstract class GoogleVertexAIConnection<CallOptions extends AsyncCallerCallOptions, ResponseType extends GoogleVertexAIResponse> implements GoogleVertexAIConnectionParams {
6
6
  caller: AsyncCaller;
7
7
  endpoint: string;
8
8
  location: string;
9
- model: string;
9
+ apiVersion: string;
10
10
  auth: GoogleAuth;
11
11
  constructor(fields: GoogleVertexAIConnectionParams | undefined, caller: AsyncCaller);
12
+ abstract buildUrl(): Promise<string>;
13
+ buildMethod(): string;
14
+ _request(data: unknown | undefined, options: CallOptions): Promise<ResponseType>;
15
+ }
16
+ export declare class GoogleVertexAILLMConnection<CallOptions extends BaseLanguageModelCallOptions, InstanceType, PredictionType extends GoogleVertexAIBasePrediction> extends GoogleVertexAIConnection<CallOptions, PredictionType> implements GoogleVertexAIBaseLLMInput {
17
+ model: string;
18
+ constructor(fields: GoogleVertexAIBaseLLMInput | undefined, caller: AsyncCaller);
19
+ buildUrl(): Promise<string>;
12
20
  request(instances: InstanceType[], parameters: GoogleVertexAIModelParams, options: CallOptions): Promise<GoogleVertexAILLMResponse<PredictionType>>;
13
21
  }
@@ -19,11 +19,11 @@ export class GoogleVertexAIConnection {
19
19
  writable: true,
20
20
  value: "us-central1"
21
21
  });
22
- Object.defineProperty(this, "model", {
22
+ Object.defineProperty(this, "apiVersion", {
23
23
  enumerable: true,
24
24
  configurable: true,
25
25
  writable: true,
26
- value: void 0
26
+ value: "v1"
27
27
  });
28
28
  Object.defineProperty(this, "auth", {
29
29
  enumerable: true,
@@ -34,30 +34,63 @@ export class GoogleVertexAIConnection {
34
34
  this.caller = caller;
35
35
  this.endpoint = fields?.endpoint ?? this.endpoint;
36
36
  this.location = fields?.location ?? this.location;
37
- this.model = fields?.model ?? this.model;
37
+ this.apiVersion = fields?.apiVersion ?? this.apiVersion;
38
38
  this.auth = new GoogleAuth({
39
39
  scopes: "https://www.googleapis.com/auth/cloud-platform",
40
40
  ...fields?.authOptions,
41
41
  });
42
42
  }
43
- async request(instances, parameters, options) {
43
+ buildMethod() {
44
+ return "POST";
45
+ }
46
+ async _request(data, options) {
44
47
  const client = await this.auth.getClient();
45
- const projectId = await this.auth.getProjectId();
46
- const url = `https://${this.endpoint}/v1/projects/${projectId}/locations/${this.location}/publishers/google/models/${this.model}:predict`;
47
- const method = "POST";
48
- const data = {
49
- instances,
50
- parameters,
51
- };
48
+ const url = await this.buildUrl();
49
+ const method = this.buildMethod();
50
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
52
51
  const opts = {
53
52
  url,
54
53
  method,
55
- data,
56
54
  };
55
+ if (data && method === "POST") {
56
+ opts.data = data;
57
+ }
57
58
  async function _request() {
58
59
  return client.request(opts);
59
60
  }
60
- const response = await this.caller.callWithOptions({ signal: options.signal }, _request.bind(client));
61
+ try {
62
+ const callResponse = await this.caller.callWithOptions({ signal: options?.signal }, _request.bind(client));
63
+ const response = callResponse; // Done for typecast safety, I guess
64
+ return response;
65
+ }
66
+ catch (x) {
67
+ console.error(JSON.stringify(x, null, 1));
68
+ throw x;
69
+ }
70
+ }
71
+ }
72
+ export class GoogleVertexAILLMConnection extends GoogleVertexAIConnection {
73
+ constructor(fields, caller) {
74
+ super(fields, caller);
75
+ Object.defineProperty(this, "model", {
76
+ enumerable: true,
77
+ configurable: true,
78
+ writable: true,
79
+ value: void 0
80
+ });
81
+ this.model = fields?.model ?? this.model;
82
+ }
83
+ async buildUrl() {
84
+ const projectId = await this.auth.getProjectId();
85
+ const url = `https://${this.endpoint}/v1/projects/${projectId}/locations/${this.location}/publishers/google/models/${this.model}:predict`;
86
+ return url;
87
+ }
88
+ async request(instances, parameters, options) {
89
+ const data = {
90
+ instances,
91
+ parameters,
92
+ };
93
+ const response = await this._request(data, options);
61
94
  return response;
62
95
  }
63
96
  }