@ai-sdk/revai 0.0.0-fd764a60-20260114143805
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.
- package/CHANGELOG.md +924 -0
- package/LICENSE +13 -0
- package/README.md +38 -0
- package/dist/index.d.mts +71 -0
- package/dist/index.d.ts +71 -0
- package/dist/index.js +518 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +505 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +67 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
Copyright 2023 Vercel, Inc.
|
|
2
|
+
|
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
you may not use this file except in compliance with the License.
|
|
5
|
+
You may obtain a copy of the License at
|
|
6
|
+
|
|
7
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
|
|
9
|
+
Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
See the License for the specific language governing permissions and
|
|
13
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# AI SDK - Rev.ai Provider
|
|
2
|
+
|
|
3
|
+
The **[Rev.ai provider](https://ai-sdk.dev/providers/ai-sdk-providers/revai)** for the [AI SDK](https://ai-sdk.dev/docs)
|
|
4
|
+
contains language model support for the Rev.ai transcription API.
|
|
5
|
+
|
|
6
|
+
## Setup
|
|
7
|
+
|
|
8
|
+
The Rev.ai provider is available in the `@ai-sdk/revai` module. You can install it with
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
npm i @ai-sdk/revai
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Provider Instance
|
|
15
|
+
|
|
16
|
+
You can import the default provider instance `revai` from `@ai-sdk/revai`:
|
|
17
|
+
|
|
18
|
+
```ts
|
|
19
|
+
import { revai } from '@ai-sdk/revai';
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Example
|
|
23
|
+
|
|
24
|
+
```ts
|
|
25
|
+
import { revai } from '@ai-sdk/revai';
|
|
26
|
+
import { experimental_transcribe as transcribe } from 'ai';
|
|
27
|
+
|
|
28
|
+
const { text } = await transcribe({
|
|
29
|
+
model: revai.transcription('machine'),
|
|
30
|
+
audio: new URL(
|
|
31
|
+
'https://github.com/vercel/ai/raw/refs/heads/main/examples/ai-functions/data/galileo.mp3',
|
|
32
|
+
),
|
|
33
|
+
});
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Documentation
|
|
37
|
+
|
|
38
|
+
Please check out the **[Rev.ai provider documentation](https://ai-sdk.dev/providers/ai-sdk-providers/revai)** for more information.
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { TranscriptionModelV3, ProviderV3 } from '@ai-sdk/provider';
|
|
2
|
+
import { FetchFunction } from '@ai-sdk/provider-utils';
|
|
3
|
+
|
|
4
|
+
type RevaiConfig = {
|
|
5
|
+
provider: string;
|
|
6
|
+
url: (options: {
|
|
7
|
+
modelId: string;
|
|
8
|
+
path: string;
|
|
9
|
+
}) => string;
|
|
10
|
+
headers: () => Record<string, string | undefined>;
|
|
11
|
+
fetch?: FetchFunction;
|
|
12
|
+
generateId?: () => string;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
type RevaiTranscriptionModelId = 'machine' | 'low_cost' | 'fusion';
|
|
16
|
+
|
|
17
|
+
interface RevaiTranscriptionModelConfig extends RevaiConfig {
|
|
18
|
+
_internal?: {
|
|
19
|
+
currentDate?: () => Date;
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
declare class RevaiTranscriptionModel implements TranscriptionModelV3 {
|
|
23
|
+
readonly modelId: RevaiTranscriptionModelId;
|
|
24
|
+
private readonly config;
|
|
25
|
+
readonly specificationVersion = "v3";
|
|
26
|
+
get provider(): string;
|
|
27
|
+
constructor(modelId: RevaiTranscriptionModelId, config: RevaiTranscriptionModelConfig);
|
|
28
|
+
private getArgs;
|
|
29
|
+
doGenerate(options: Parameters<TranscriptionModelV3['doGenerate']>[0]): Promise<Awaited<ReturnType<TranscriptionModelV3['doGenerate']>>>;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
interface RevaiProvider extends ProviderV3 {
|
|
33
|
+
(modelId: 'machine', settings?: {}): {
|
|
34
|
+
transcription: RevaiTranscriptionModel;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
Creates a model for transcription.
|
|
38
|
+
*/
|
|
39
|
+
transcription(modelId: RevaiTranscriptionModelId): TranscriptionModelV3;
|
|
40
|
+
/**
|
|
41
|
+
* @deprecated Use `embeddingModel` instead.
|
|
42
|
+
*/
|
|
43
|
+
textEmbeddingModel(modelId: string): never;
|
|
44
|
+
}
|
|
45
|
+
interface RevaiProviderSettings {
|
|
46
|
+
/**
|
|
47
|
+
API key for authenticating requests.
|
|
48
|
+
*/
|
|
49
|
+
apiKey?: string;
|
|
50
|
+
/**
|
|
51
|
+
Custom headers to include in the requests.
|
|
52
|
+
*/
|
|
53
|
+
headers?: Record<string, string>;
|
|
54
|
+
/**
|
|
55
|
+
Custom fetch implementation. You can use it as a middleware to intercept requests,
|
|
56
|
+
or to provide a custom fetch implementation for e.g. testing.
|
|
57
|
+
*/
|
|
58
|
+
fetch?: FetchFunction;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
Create a Rev.ai provider instance.
|
|
62
|
+
*/
|
|
63
|
+
declare function createRevai(options?: RevaiProviderSettings): RevaiProvider;
|
|
64
|
+
/**
|
|
65
|
+
Default Rev.ai provider instance.
|
|
66
|
+
*/
|
|
67
|
+
declare const revai: RevaiProvider;
|
|
68
|
+
|
|
69
|
+
declare const VERSION: string;
|
|
70
|
+
|
|
71
|
+
export { type RevaiProvider, type RevaiProviderSettings, VERSION, createRevai, revai };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { TranscriptionModelV3, ProviderV3 } from '@ai-sdk/provider';
|
|
2
|
+
import { FetchFunction } from '@ai-sdk/provider-utils';
|
|
3
|
+
|
|
4
|
+
type RevaiConfig = {
|
|
5
|
+
provider: string;
|
|
6
|
+
url: (options: {
|
|
7
|
+
modelId: string;
|
|
8
|
+
path: string;
|
|
9
|
+
}) => string;
|
|
10
|
+
headers: () => Record<string, string | undefined>;
|
|
11
|
+
fetch?: FetchFunction;
|
|
12
|
+
generateId?: () => string;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
type RevaiTranscriptionModelId = 'machine' | 'low_cost' | 'fusion';
|
|
16
|
+
|
|
17
|
+
interface RevaiTranscriptionModelConfig extends RevaiConfig {
|
|
18
|
+
_internal?: {
|
|
19
|
+
currentDate?: () => Date;
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
declare class RevaiTranscriptionModel implements TranscriptionModelV3 {
|
|
23
|
+
readonly modelId: RevaiTranscriptionModelId;
|
|
24
|
+
private readonly config;
|
|
25
|
+
readonly specificationVersion = "v3";
|
|
26
|
+
get provider(): string;
|
|
27
|
+
constructor(modelId: RevaiTranscriptionModelId, config: RevaiTranscriptionModelConfig);
|
|
28
|
+
private getArgs;
|
|
29
|
+
doGenerate(options: Parameters<TranscriptionModelV3['doGenerate']>[0]): Promise<Awaited<ReturnType<TranscriptionModelV3['doGenerate']>>>;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
interface RevaiProvider extends ProviderV3 {
|
|
33
|
+
(modelId: 'machine', settings?: {}): {
|
|
34
|
+
transcription: RevaiTranscriptionModel;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
Creates a model for transcription.
|
|
38
|
+
*/
|
|
39
|
+
transcription(modelId: RevaiTranscriptionModelId): TranscriptionModelV3;
|
|
40
|
+
/**
|
|
41
|
+
* @deprecated Use `embeddingModel` instead.
|
|
42
|
+
*/
|
|
43
|
+
textEmbeddingModel(modelId: string): never;
|
|
44
|
+
}
|
|
45
|
+
interface RevaiProviderSettings {
|
|
46
|
+
/**
|
|
47
|
+
API key for authenticating requests.
|
|
48
|
+
*/
|
|
49
|
+
apiKey?: string;
|
|
50
|
+
/**
|
|
51
|
+
Custom headers to include in the requests.
|
|
52
|
+
*/
|
|
53
|
+
headers?: Record<string, string>;
|
|
54
|
+
/**
|
|
55
|
+
Custom fetch implementation. You can use it as a middleware to intercept requests,
|
|
56
|
+
or to provide a custom fetch implementation for e.g. testing.
|
|
57
|
+
*/
|
|
58
|
+
fetch?: FetchFunction;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
Create a Rev.ai provider instance.
|
|
62
|
+
*/
|
|
63
|
+
declare function createRevai(options?: RevaiProviderSettings): RevaiProvider;
|
|
64
|
+
/**
|
|
65
|
+
Default Rev.ai provider instance.
|
|
66
|
+
*/
|
|
67
|
+
declare const revai: RevaiProvider;
|
|
68
|
+
|
|
69
|
+
declare const VERSION: string;
|
|
70
|
+
|
|
71
|
+
export { type RevaiProvider, type RevaiProviderSettings, VERSION, createRevai, revai };
|