Skip to content

Commit

Permalink
fix: update user agent in AssemblyAI (run-llama#1039)
Browse files Browse the repository at this point in the history
Co-authored-by: Alex Yang <himself65@outlook.com>
  • Loading branch information
Swimburger and himself65 authored Jul 24, 2024
1 parent d917cdc commit 3d5ba08
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
6 changes: 6 additions & 0 deletions .changeset/shy-pots-marry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"llamaindex": patch
"llamaindex-loader-example": patch
---

fix: update user agent in AssemblyAI
1 change: 1 addition & 0 deletions examples/readers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
14 changes: 12 additions & 2 deletions packages/llamaindex/src/readers/AssemblyAIReader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand All @@ -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[]>;
Expand Down

0 comments on commit 3d5ba08

Please sign in to comment.