Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 21 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,11 @@ Then, import the `assemblyai` module and create an AssemblyAI object with your A
```js
import { AssemblyAI } from "assemblyai";

const baseUrl = "https://api.assemblyai.com";

const client = new AssemblyAI({
apiKey: process.env.ASSEMBLYAI_API_KEY,
apiKey: "YOUR_API_KEY",
baseUrl: baseUrl,
});
```

Expand Down Expand Up @@ -96,9 +99,20 @@ When you create a transcript, you can either pass in a URL to an audio file or u

```js
// Transcribe file at remote URL
let transcript = await client.transcripts.transcribe({
audio: "https://assembly.ai/espn.m4a",
});
const audioFile = "https://assembly.ai/sports_injuries.mp3";

const params = {
audio: audioFile,
speech_models: ["universal-3-pro", "universal-2"],
language_detection: true,
};

const run = async () => {
const transcript = await client.transcripts.transcribe(params);
console.log(transcript.text);
};

run();
```

> [!NOTE]
Expand Down Expand Up @@ -245,15 +259,10 @@ const res = await client.transcripts.delete(transcript.id);
Create the streaming transcriber.

```typescript
const rt = client.streaming.transcriber();
```

You can also pass in the following options.

```typescript
const rt = client.streaming.transcriber({
apiKey: process.env.ASSEMBLYAI_API_KEY // The API key passed to `AssemblyAI` will be used by default,
const transcriber = client.streaming.transcriber({
speechModel: "u3-rt-pro",
sampleRate: 16_000,
formatTurns: true,
});
```

Expand Down