fix: update user agent in AssemblyAI (#1039)

Co-authored-by: Alex Yang <himself65@outlook.com>
This commit is contained in:
Niels Swimberghe
2024-07-24 03:50:35 -04:00
committed by GitHub
parent d917cdc3fa
commit 3d5ba0873c
3 changed files with 19 additions and 2 deletions
+6
View File
@@ -0,0 +1,6 @@
---
"llamaindex": patch
"llamaindex-loader-example": patch
---
fix: update user agent in AssemblyAI
+1
View File
@@ -11,6 +11,7 @@
"start:pdf": "node --import tsx ./src/pdf.ts",
"start:llamaparse": "node --import tsx ./src/llamaparse.ts",
"start:notion": "node --import tsx ./src/notion.ts",
"start:assemblyai": "node --import tsx ./src/assemblyai.ts",
"start:llamaparse-dir": "node --import tsx ./src/simple-directory-reader-with-llamaparse.ts",
"start:llamaparse-json": "node --import tsx ./src/llamaparse-json.ts",
"start:discord": "node --import tsx ./src/discord.ts"
@@ -11,7 +11,14 @@ import { AssemblyAI } from "assemblyai";
import type { BaseReader } from "./type.js";
type AssemblyAIOptions = Partial<BaseServiceParams>;
const defaultOptions = {
userAgent: {
integration: {
name: "LlamaIndexTS",
version: "1.0.1",
},
},
};
/**
* Base class for AssemblyAI Readers.
*/
@@ -37,7 +44,10 @@ abstract class AssemblyAIReader implements BaseReader {
);
}
this.client = new AssemblyAI(options as BaseServiceParams);
this.client = new AssemblyAI({
...defaultOptions,
...options,
} as BaseServiceParams);
}
abstract loadData(params: TranscribeParams | string): Promise<Document[]>;