langchain 0.0.169 → 0.0.170

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 (69) hide show
  1. package/README.md +2 -2
  2. package/agents/format_scratchpad.cjs +1 -0
  3. package/agents/format_scratchpad.d.ts +1 -0
  4. package/agents/format_scratchpad.js +1 -0
  5. package/dist/agents/agent.cjs +49 -1
  6. package/dist/agents/agent.d.ts +19 -1
  7. package/dist/agents/agent.js +47 -0
  8. package/dist/agents/executor.cjs +10 -1
  9. package/dist/agents/executor.d.ts +22 -8
  10. package/dist/agents/executor.js +11 -2
  11. package/dist/agents/format_scratchpad.cjs +25 -0
  12. package/dist/agents/format_scratchpad.d.ts +10 -0
  13. package/dist/agents/format_scratchpad.js +21 -0
  14. package/dist/agents/toolkits/aws_sfn.d.ts +4 -1
  15. package/dist/agents/toolkits/conversational_retrieval/openai_functions.d.ts +1 -1
  16. package/dist/agents/toolkits/json/json.d.ts +4 -1
  17. package/dist/agents/toolkits/openapi/openapi.cjs +8 -0
  18. package/dist/agents/toolkits/openapi/openapi.d.ts +12 -1
  19. package/dist/agents/toolkits/openapi/openapi.js +8 -0
  20. package/dist/agents/toolkits/sql/sql.d.ts +4 -1
  21. package/dist/agents/toolkits/vectorstore/vectorstore.d.ts +8 -2
  22. package/dist/agents/types.d.ts +13 -1
  23. package/dist/chains/sql_db/sql_db_chain.cjs +9 -0
  24. package/dist/chains/sql_db/sql_db_chain.d.ts +9 -0
  25. package/dist/chains/sql_db/sql_db_chain.js +9 -0
  26. package/dist/chat_models/baiduwenxin.cjs +12 -1
  27. package/dist/chat_models/baiduwenxin.d.ts +3 -1
  28. package/dist/chat_models/baiduwenxin.js +12 -1
  29. package/dist/document_loaders/web/assemblyai.cjs +63 -114
  30. package/dist/document_loaders/web/assemblyai.d.ts +38 -57
  31. package/dist/document_loaders/web/assemblyai.js +63 -100
  32. package/dist/load/import_constants.cjs +1 -0
  33. package/dist/load/import_constants.js +1 -0
  34. package/dist/load/import_map.cjs +3 -2
  35. package/dist/load/import_map.d.ts +1 -0
  36. package/dist/load/import_map.js +1 -0
  37. package/dist/memory/index.d.ts +1 -1
  38. package/dist/memory/index.js +1 -1
  39. package/dist/retrievers/time_weighted.cjs +1 -1
  40. package/dist/retrievers/time_weighted.d.ts +1 -1
  41. package/dist/retrievers/time_weighted.js +1 -1
  42. package/dist/schema/runnable/base.cjs +4 -1
  43. package/dist/schema/runnable/base.d.ts +1 -0
  44. package/dist/schema/runnable/base.js +4 -1
  45. package/dist/schema/runnable/passthrough.cjs +33 -1
  46. package/dist/schema/runnable/passthrough.d.ts +11 -1
  47. package/dist/schema/runnable/passthrough.js +32 -1
  48. package/dist/sql_db.cjs +12 -0
  49. package/dist/sql_db.d.ts +12 -0
  50. package/dist/sql_db.js +12 -0
  51. package/dist/storage/ioredis.cjs +2 -1
  52. package/dist/storage/ioredis.js +2 -1
  53. package/dist/storage/upstash_redis.cjs +155 -0
  54. package/dist/storage/upstash_redis.d.ts +59 -0
  55. package/dist/storage/upstash_redis.js +151 -0
  56. package/dist/storage/vercel_kv.cjs +2 -1
  57. package/dist/storage/vercel_kv.js +2 -1
  58. package/dist/types/assemblyai-types.cjs +0 -150
  59. package/dist/types/assemblyai-types.d.ts +4 -670
  60. package/dist/types/assemblyai-types.js +1 -149
  61. package/dist/vectorstores/pgvector.cjs +1 -1
  62. package/dist/vectorstores/pgvector.js +1 -1
  63. package/package.json +23 -2
  64. package/storage/upstash_redis.cjs +1 -0
  65. package/storage/upstash_redis.d.ts +1 -0
  66. package/storage/upstash_redis.js +1 -0
  67. package/dist/util/assemblyai-client.cjs +0 -173
  68. package/dist/util/assemblyai-client.d.ts +0 -63
  69. package/dist/util/assemblyai-client.js +0 -170
@@ -25,7 +25,7 @@ function messageToWenxinRole(message) {
25
25
  case "human":
26
26
  return "user";
27
27
  case "system":
28
- throw new Error("System messages not supported");
28
+ throw new Error("System messages should not be here");
29
29
  case "function":
30
30
  throw new Error("Function messages not supported");
31
31
  case "generic": {
@@ -161,6 +161,10 @@ export class ChatBaiduWenxin extends BaseChatModel {
161
161
  this.apiUrl =
162
162
  "https://aip.baidubce.com/rpc/2.0/ai_custom/v1/wenxinworkshop/chat/eb-instant";
163
163
  }
164
+ else if (this.modelName === "ERNIE-Bot-4") {
165
+ this.apiUrl =
166
+ "https://aip.baidubce.com/rpc/2.0/ai_custom/v1/wenxinworkshop/chat/completions_pro";
167
+ }
164
168
  else {
165
169
  throw new Error(`Invalid model name: ${this.modelName}`);
166
170
  }
@@ -216,6 +220,13 @@ export class ChatBaiduWenxin extends BaseChatModel {
216
220
  async _generate(messages, options, runManager) {
217
221
  const tokenUsage = {};
218
222
  const params = this.invocationParams();
223
+ // Wenxin requires the system message to be put in the params, not messages array
224
+ const systemMessage = messages.find((message) => message._getType() === "system");
225
+ if (systemMessage) {
226
+ // eslint-disable-next-line no-param-reassign
227
+ messages = messages.filter((message) => message !== systemMessage);
228
+ params.system = systemMessage.text;
229
+ }
219
230
  const messagesMapped = messages.map((message) => ({
220
231
  role: messageToWenxinRole(message),
221
232
  content: message.text,
@@ -1,27 +1,10 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
2
  Object.defineProperty(exports, "__esModule", { value: true });
17
3
  exports.AudioSubtitleLoader = exports.AudioTranscriptSentencesLoader = exports.AudioTranscriptParagraphsLoader = exports.AudioTranscriptLoader = void 0;
18
- const node_fs_1 = require("node:fs");
4
+ const assemblyai_1 = require("assemblyai");
19
5
  const document_js_1 = require("../../document.cjs");
20
6
  const base_js_1 = require("../base.cjs");
21
7
  const env_js_1 = require("../../util/env.cjs");
22
- const assemblyai_client_js_1 = require("../../util/assemblyai-client.cjs");
23
- const assemblyai_types_js_1 = require("../../types/assemblyai-types.cjs");
24
- __exportStar(require("../../types/assemblyai-types.cjs"), exports);
25
8
  /**
26
9
  * Base class for AssemblyAI loaders.
27
10
  */
@@ -39,57 +22,67 @@ class AssemblyAILoader extends base_js_1.BaseDocumentLoader {
39
22
  writable: true,
40
23
  value: void 0
41
24
  });
42
- const apiKey = assemblyAIOptions?.apiKey ?? (0, env_js_1.getEnvironmentVariable)("ASSEMBLYAI_API_KEY");
43
- this.client = new assemblyai_client_js_1.AssemblyAIClient(apiKey);
44
- }
45
- /**
46
- * Attempts to upload the file to AssemblyAI if it is a local file.
47
- * If `audio_url` starts with `http://` or `https://`, it is assumed to be a remote file.
48
- * Otherwise, it is assumed to be a local file and is uploaded to AssemblyAI.
49
- * @param createTranscriptOptions
50
- */
51
- async uploadFile(createTranscriptOptions) {
52
- let path = createTranscriptOptions.audio_url;
53
- if (path.startsWith("http://") || path.startsWith("https://"))
54
- return;
55
- if (path.startsWith("file://"))
56
- path = path.slice("file://".length);
57
- const file = await node_fs_1.promises.readFile(path);
58
- const uploadUrl = await this.client.uploadFile(file);
59
- // eslint-disable-next-line no-param-reassign
60
- createTranscriptOptions.audio_url = uploadUrl;
25
+ let options = assemblyAIOptions;
26
+ if (!options) {
27
+ options = {};
28
+ }
29
+ if (!options.apiKey) {
30
+ options.apiKey = (0, env_js_1.getEnvironmentVariable)("ASSEMBLYAI_API_KEY");
31
+ }
32
+ if (!options.apiKey) {
33
+ throw new Error("No AssemblyAI API key provided");
34
+ }
35
+ this.client = new assemblyai_1.AssemblyAI(options);
61
36
  }
62
37
  }
63
- /**
64
- * Creates a transcript for the given `CreateTranscriptParams.audio_url`,
65
- * and loads the transcript as a document using AssemblyAI.
66
- */
67
- class AudioTranscriptLoader extends AssemblyAILoader {
38
+ class CreateTranscriptLoader extends AssemblyAILoader {
68
39
  /**
69
- * Creates a new AudioTranscriptLoader.
70
- * @param createTranscriptParams The parameters to create the transcript.
40
+ * Retrevies an existing transcript by its ID.
41
+ * @param params The parameters to create the transcript, or the ID of the transcript to retrieve.
71
42
  * @param assemblyAIOptions The options to configure the AssemblyAI loader.
72
43
  * Configure the `assemblyAIOptions.apiKey` with your AssemblyAI API key, or configure it as the `ASSEMBLYAI_API_KEY` environment variable.
73
44
  */
74
- constructor(createTranscriptParams, assemblyAIOptions) {
45
+ constructor(params, assemblyAIOptions) {
75
46
  super(assemblyAIOptions);
76
- Object.defineProperty(this, "createTranscriptParams", {
47
+ Object.defineProperty(this, "CreateTranscriptParameters", {
77
48
  enumerable: true,
78
49
  configurable: true,
79
50
  writable: true,
80
- value: createTranscriptParams
51
+ value: void 0
81
52
  });
53
+ Object.defineProperty(this, "transcriptId", {
54
+ enumerable: true,
55
+ configurable: true,
56
+ writable: true,
57
+ value: void 0
58
+ });
59
+ if (typeof params === "string") {
60
+ this.transcriptId = params;
61
+ }
62
+ else {
63
+ this.CreateTranscriptParameters = params;
64
+ }
65
+ }
66
+ async getOrCreateTranscript() {
67
+ if (this.transcriptId) {
68
+ return await this.client.transcripts.get(this.transcriptId);
69
+ }
70
+ if (this.CreateTranscriptParameters) {
71
+ return await this.client.transcripts.create(this.CreateTranscriptParameters);
72
+ }
82
73
  }
74
+ }
75
+ /**
76
+ * Creates and loads the transcript as a document using AssemblyAI.
77
+ */
78
+ class AudioTranscriptLoader extends CreateTranscriptLoader {
83
79
  /**
84
- * Creates a transcript for the given `CreateTranscriptParams.audio_url`,
85
- * and loads the transcript as a document using AssemblyAI.
80
+ * Creates a transcript and loads the transcript as a document using AssemblyAI.
86
81
  * @returns A promise that resolves to a single document containing the transcript text
87
82
  * as the page content, and the transcript object as the metadata.
88
83
  */
89
84
  async load() {
90
- await this.uploadFile(this.createTranscriptParams);
91
- let transcript = await this.client.createTranscript(this.createTranscriptParams);
92
- transcript = await this.client.waitForTranscriptToComplete(transcript.id);
85
+ const transcript = await this.getOrCreateTranscript();
93
86
  return [
94
87
  new document_js_1.Document({
95
88
  pageContent: transcript.text,
@@ -100,34 +93,16 @@ class AudioTranscriptLoader extends AssemblyAILoader {
100
93
  }
101
94
  exports.AudioTranscriptLoader = AudioTranscriptLoader;
102
95
  /**
103
- * Creates a transcript for the given `CreateTranscriptParams.audio_url`,
104
- * and loads the paragraphs of the transcript, creating a document for each paragraph.
96
+ * Creates a transcript and loads the paragraphs of the transcript, creating a document for each paragraph.
105
97
  */
106
- class AudioTranscriptParagraphsLoader extends AssemblyAILoader {
98
+ class AudioTranscriptParagraphsLoader extends CreateTranscriptLoader {
107
99
  /**
108
- * Creates a new AudioTranscriptParagraphsLoader.
109
- * @param createTranscriptParams The parameters to create the transcript.
110
- * @param assemblyAIOptions The options to configure the AssemblyAI loader.
111
- * Configure the `assemblyAIOptions.apiKey` with your AssemblyAI API key, or configure it as the `ASSEMBLYAI_API_KEY` environment variable.
112
- */
113
- constructor(createTranscriptParams, assemblyAIOptions) {
114
- super(assemblyAIOptions);
115
- Object.defineProperty(this, "createTranscriptParams", {
116
- enumerable: true,
117
- configurable: true,
118
- writable: true,
119
- value: createTranscriptParams
120
- });
121
- }
122
- /**
123
- * Creates a transcript for the given `CreateTranscriptParams.audio_url`,
124
- * and loads the paragraphs of the transcript, creating a document for each paragraph.
100
+ * Creates a transcript and loads the paragraphs of the transcript, creating a document for each paragraph.
125
101
  * @returns A promise that resolves to an array of documents, each containing a paragraph of the transcript.
126
102
  */
127
103
  async load() {
128
- let transcript = await this.client.createTranscript(this.createTranscriptParams);
129
- transcript = await this.client.waitForTranscriptToComplete(transcript.id);
130
- const paragraphsResponse = await this.client.getParagraphs(transcript.id);
104
+ const transcript = await this.getOrCreateTranscript();
105
+ const paragraphsResponse = await this.client.transcripts.paragraphs(transcript.id);
131
106
  return paragraphsResponse.paragraphs.map((p) => new document_js_1.Document({
132
107
  pageContent: p.text,
133
108
  metadata: p,
@@ -136,34 +111,17 @@ class AudioTranscriptParagraphsLoader extends AssemblyAILoader {
136
111
  }
137
112
  exports.AudioTranscriptParagraphsLoader = AudioTranscriptParagraphsLoader;
138
113
  /**
139
- * Creates a transcript for the given `CreateTranscriptParams.audio_url`,
114
+ * Creates a transcript for the given `CreateTranscriptParameters.audio_url`,
140
115
  * and loads the sentences of the transcript, creating a document for each sentence.
141
116
  */
142
- class AudioTranscriptSentencesLoader extends AssemblyAILoader {
143
- /**
144
- * Creates a new AudioTranscriptSentencesLoader.
145
- * @param createTranscriptParams The parameters to create the transcript.
146
- * @param assemblyAIOptions The options to configure the AssemblyAI loader.
147
- * Configure the `assemblyAIOptions.apiKey` with your AssemblyAI API key, or configure it as the `ASSEMBLYAI_API_KEY` environment variable.
148
- */
149
- constructor(createTranscriptParams, assemblyAIOptions) {
150
- super(assemblyAIOptions);
151
- Object.defineProperty(this, "createTranscriptParams", {
152
- enumerable: true,
153
- configurable: true,
154
- writable: true,
155
- value: createTranscriptParams
156
- });
157
- }
117
+ class AudioTranscriptSentencesLoader extends CreateTranscriptLoader {
158
118
  /**
159
- * Creates a transcript for the given `CreateTranscriptParams.audio_url`,
160
- * and loads the sentences of the transcript, creating a document for each sentence.
119
+ * Creates a transcript and loads the sentences of the transcript, creating a document for each sentence.
161
120
  * @returns A promise that resolves to an array of documents, each containing a sentence of the transcript.
162
121
  */
163
122
  async load() {
164
- let transcript = await this.client.createTranscript(this.createTranscriptParams);
165
- transcript = await this.client.waitForTranscriptToComplete(transcript.id);
166
- const sentencesResponse = await this.client.getSentences(transcript.id);
123
+ const transcript = await this.getOrCreateTranscript();
124
+ const sentencesResponse = await this.client.transcripts.sentences(transcript.id);
167
125
  return sentencesResponse.sentences.map((p) => new document_js_1.Document({
168
126
  pageContent: p.text,
169
127
  metadata: p,
@@ -172,25 +130,18 @@ class AudioTranscriptSentencesLoader extends AssemblyAILoader {
172
130
  }
173
131
  exports.AudioTranscriptSentencesLoader = AudioTranscriptSentencesLoader;
174
132
  /**
175
- * Creates a transcript for the given `CreateTranscriptParams.audio_url`,
176
- * and loads subtitles for the transcript as `srt` or `vtt` format.
133
+ * Creates a transcript and loads subtitles for the transcript as `srt` or `vtt` format.
177
134
  */
178
- class AudioSubtitleLoader extends AssemblyAILoader {
135
+ class AudioSubtitleLoader extends CreateTranscriptLoader {
179
136
  /**
180
137
  * Creates a new AudioSubtitleLoader.
181
- * @param createTranscriptParams The parameters to create the transcript.
138
+ * @param params The parameters to create the transcript, or the ID of the transcript to retrieve.
182
139
  * @param subtitleFormat The format of the subtitles, either `srt` or `vtt`.
183
140
  * @param assemblyAIOptions The options to configure the AssemblyAI loader.
184
141
  * Configure the `assemblyAIOptions.apiKey` with your AssemblyAI API key, or configure it as the `ASSEMBLYAI_API_KEY` environment variable.
185
142
  */
186
- constructor(createTranscriptParams, subtitleFormat = assemblyai_types_js_1.SubtitleFormat.Srt, assemblyAIOptions) {
187
- super(assemblyAIOptions);
188
- Object.defineProperty(this, "createTranscriptParams", {
189
- enumerable: true,
190
- configurable: true,
191
- writable: true,
192
- value: createTranscriptParams
193
- });
143
+ constructor(params, subtitleFormat = "srt", assemblyAIOptions) {
144
+ super(params, assemblyAIOptions);
194
145
  Object.defineProperty(this, "subtitleFormat", {
195
146
  enumerable: true,
196
147
  configurable: true,
@@ -200,14 +151,12 @@ class AudioSubtitleLoader extends AssemblyAILoader {
200
151
  this.subtitleFormat = subtitleFormat;
201
152
  }
202
153
  /**
203
- * Creates a transcript for the given `CreateTranscriptParams.audio_url`,
204
- * and loads subtitles for the transcript as `srt` or `vtt` format.
154
+ * Creates a transcript and loads subtitles for the transcript as `srt` or `vtt` format.
205
155
  * @returns A promise that resolves a document containing the subtitles as the page content.
206
156
  */
207
157
  async load() {
208
- let transcript = await this.client.createTranscript(this.createTranscriptParams);
209
- transcript = await this.client.waitForTranscriptToComplete(transcript.id);
210
- const subtitles = await this.client.getSubtitles(transcript.id, this.subtitleFormat);
158
+ const transcript = await this.getOrCreateTranscript();
159
+ const subtitles = await this.client.transcripts.subtitles(transcript.id, this.subtitleFormat);
211
160
  return [
212
161
  new document_js_1.Document({
213
162
  pageContent: subtitles,
@@ -1,106 +1,87 @@
1
+ import { AssemblyAI, CreateTranscriptParameters, SubtitleFormat, Transcript, TranscriptParagraph, TranscriptSentence } from "assemblyai";
1
2
  import { Document } from "../../document.js";
2
3
  import { BaseDocumentLoader } from "../base.js";
3
- import { AssemblyAIClient } from "../../util/assemblyai-client.js";
4
- import { AssemblyAIOptions, CreateTranscriptParams, SubtitleFormat, Transcript, TranscriptSegment } from "../../types/assemblyai-types.js";
5
- export * from "../../types/assemblyai-types.js";
4
+ import { AssemblyAIOptions } from "../../types/assemblyai-types.js";
5
+ export type * from "../../types/assemblyai-types.js";
6
6
  /**
7
7
  * Base class for AssemblyAI loaders.
8
8
  */
9
9
  declare abstract class AssemblyAILoader extends BaseDocumentLoader {
10
- protected client: AssemblyAIClient;
10
+ protected client: AssemblyAI;
11
11
  /**
12
12
  * Creates a new AssemblyAI loader.
13
13
  * @param assemblyAIOptions The options to configure the AssemblyAI loader.
14
14
  * Configure the `assemblyAIOptions.apiKey` with your AssemblyAI API key, or configure it as the `ASSEMBLYAI_API_KEY` environment variable.
15
15
  */
16
16
  constructor(assemblyAIOptions?: AssemblyAIOptions);
17
- /**
18
- * Attempts to upload the file to AssemblyAI if it is a local file.
19
- * If `audio_url` starts with `http://` or `https://`, it is assumed to be a remote file.
20
- * Otherwise, it is assumed to be a local file and is uploaded to AssemblyAI.
21
- * @param createTranscriptOptions
22
- */
23
- protected uploadFile(createTranscriptOptions: CreateTranscriptParams): Promise<void>;
24
17
  }
25
- /**
26
- * Creates a transcript for the given `CreateTranscriptParams.audio_url`,
27
- * and loads the transcript as a document using AssemblyAI.
28
- */
29
- export declare class AudioTranscriptLoader extends AssemblyAILoader {
30
- private createTranscriptParams;
18
+ declare abstract class CreateTranscriptLoader extends AssemblyAILoader {
19
+ protected CreateTranscriptParameters?: CreateTranscriptParameters;
20
+ protected transcriptId?: string;
31
21
  /**
32
- * Creates a new AudioTranscriptLoader.
33
- * @param createTranscriptParams The parameters to create the transcript.
22
+ * Retrevies an existing transcript by its ID.
23
+ * @param params The parameters to create the transcript, or the ID of the transcript to retrieve.
34
24
  * @param assemblyAIOptions The options to configure the AssemblyAI loader.
35
25
  * Configure the `assemblyAIOptions.apiKey` with your AssemblyAI API key, or configure it as the `ASSEMBLYAI_API_KEY` environment variable.
36
26
  */
37
- constructor(createTranscriptParams: CreateTranscriptParams, assemblyAIOptions?: AssemblyAIOptions);
27
+ constructor(params: CreateTranscriptParameters | string, assemblyAIOptions?: AssemblyAIOptions);
28
+ protected getOrCreateTranscript(): Promise<any>;
29
+ }
30
+ /**
31
+ * Creates and loads the transcript as a document using AssemblyAI.
32
+ */
33
+ export declare class AudioTranscriptLoader extends CreateTranscriptLoader {
38
34
  /**
39
- * Creates a transcript for the given `CreateTranscriptParams.audio_url`,
40
- * and loads the transcript as a document using AssemblyAI.
35
+ * Creates a transcript and loads the transcript as a document using AssemblyAI.
41
36
  * @returns A promise that resolves to a single document containing the transcript text
42
37
  * as the page content, and the transcript object as the metadata.
43
38
  */
44
39
  load(): Promise<Document<Transcript>[]>;
45
40
  }
46
41
  /**
47
- * Creates a transcript for the given `CreateTranscriptParams.audio_url`,
48
- * and loads the paragraphs of the transcript, creating a document for each paragraph.
42
+ * Creates a transcript and loads the paragraphs of the transcript, creating a document for each paragraph.
49
43
  */
50
- export declare class AudioTranscriptParagraphsLoader extends AssemblyAILoader {
51
- private createTranscriptParams;
52
- /**
53
- * Creates a new AudioTranscriptParagraphsLoader.
54
- * @param createTranscriptParams The parameters to create the transcript.
55
- * @param assemblyAIOptions The options to configure the AssemblyAI loader.
56
- * Configure the `assemblyAIOptions.apiKey` with your AssemblyAI API key, or configure it as the `ASSEMBLYAI_API_KEY` environment variable.
57
- */
58
- constructor(createTranscriptParams: CreateTranscriptParams, assemblyAIOptions?: AssemblyAIOptions);
44
+ export declare class AudioTranscriptParagraphsLoader extends CreateTranscriptLoader {
59
45
  /**
60
- * Creates a transcript for the given `CreateTranscriptParams.audio_url`,
61
- * and loads the paragraphs of the transcript, creating a document for each paragraph.
46
+ * Creates a transcript and loads the paragraphs of the transcript, creating a document for each paragraph.
62
47
  * @returns A promise that resolves to an array of documents, each containing a paragraph of the transcript.
63
48
  */
64
- load(): Promise<Document<TranscriptSegment>[]>;
49
+ load(): Promise<Document<TranscriptParagraph>[]>;
65
50
  }
66
51
  /**
67
- * Creates a transcript for the given `CreateTranscriptParams.audio_url`,
52
+ * Creates a transcript for the given `CreateTranscriptParameters.audio_url`,
68
53
  * and loads the sentences of the transcript, creating a document for each sentence.
69
54
  */
70
- export declare class AudioTranscriptSentencesLoader extends AssemblyAILoader {
71
- private createTranscriptParams;
55
+ export declare class AudioTranscriptSentencesLoader extends CreateTranscriptLoader {
72
56
  /**
73
- * Creates a new AudioTranscriptSentencesLoader.
74
- * @param createTranscriptParams The parameters to create the transcript.
75
- * @param assemblyAIOptions The options to configure the AssemblyAI loader.
76
- * Configure the `assemblyAIOptions.apiKey` with your AssemblyAI API key, or configure it as the `ASSEMBLYAI_API_KEY` environment variable.
77
- */
78
- constructor(createTranscriptParams: CreateTranscriptParams, assemblyAIOptions?: AssemblyAIOptions);
79
- /**
80
- * Creates a transcript for the given `CreateTranscriptParams.audio_url`,
81
- * and loads the sentences of the transcript, creating a document for each sentence.
57
+ * Creates a transcript and loads the sentences of the transcript, creating a document for each sentence.
82
58
  * @returns A promise that resolves to an array of documents, each containing a sentence of the transcript.
83
59
  */
84
- load(): Promise<Document<TranscriptSegment>[]>;
60
+ load(): Promise<Document<TranscriptSentence>[]>;
85
61
  }
86
62
  /**
87
- * Creates a transcript for the given `CreateTranscriptParams.audio_url`,
88
- * and loads subtitles for the transcript as `srt` or `vtt` format.
63
+ * Creates a transcript and loads subtitles for the transcript as `srt` or `vtt` format.
89
64
  */
90
- export declare class AudioSubtitleLoader extends AssemblyAILoader {
91
- private createTranscriptParams;
65
+ export declare class AudioSubtitleLoader extends CreateTranscriptLoader {
92
66
  private subtitleFormat;
93
67
  /**
94
68
  * Creates a new AudioSubtitleLoader.
95
- * @param createTranscriptParams The parameters to create the transcript.
69
+ * @param CreateTranscriptParameters The parameters to create the transcript.
70
+ * @param subtitleFormat The format of the subtitles, either `srt` or `vtt`.
71
+ * @param assemblyAIOptions The options to configure the AssemblyAI loader.
72
+ * Configure the `assemblyAIOptions.apiKey` with your AssemblyAI API key, or configure it as the `ASSEMBLYAI_API_KEY` environment variable.
73
+ */
74
+ constructor(CreateTranscriptParameters: CreateTranscriptParameters, subtitleFormat: SubtitleFormat, assemblyAIOptions?: AssemblyAIOptions);
75
+ /**
76
+ * Creates a new AudioSubtitleLoader.
77
+ * @param transcriptId The ID of the transcript to retrieve.
96
78
  * @param subtitleFormat The format of the subtitles, either `srt` or `vtt`.
97
79
  * @param assemblyAIOptions The options to configure the AssemblyAI loader.
98
80
  * Configure the `assemblyAIOptions.apiKey` with your AssemblyAI API key, or configure it as the `ASSEMBLYAI_API_KEY` environment variable.
99
81
  */
100
- constructor(createTranscriptParams: CreateTranscriptParams, subtitleFormat?: (typeof SubtitleFormat)[keyof typeof SubtitleFormat], assemblyAIOptions?: AssemblyAIOptions);
82
+ constructor(transcriptId: string, subtitleFormat: SubtitleFormat, assemblyAIOptions?: AssemblyAIOptions);
101
83
  /**
102
- * Creates a transcript for the given `CreateTranscriptParams.audio_url`,
103
- * and loads subtitles for the transcript as `srt` or `vtt` format.
84
+ * Creates a transcript and loads subtitles for the transcript as `srt` or `vtt` format.
104
85
  * @returns A promise that resolves a document containing the subtitles as the page content.
105
86
  */
106
87
  load(): Promise<Document[]>;