@ai-sdk/gladia 0.0.1
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 +7 -0
- package/LICENSE +13 -0
- package/README.md +38 -0
- package/dist/index.d.mts +63 -0
- package/dist/index.d.ts +63 -0
- package/dist/index.js +583 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +566 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +64 -0
package/CHANGELOG.md
ADDED
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 - Gladia Provider
|
|
2
|
+
|
|
3
|
+
The **[Gladia provider](https://sdk.vercel.ai/providers/ai-sdk-providers/assemblyai)** for the [AI SDK](https://sdk.vercel.ai/docs)
|
|
4
|
+
contains transcription model support for the Gladia transcription API.
|
|
5
|
+
|
|
6
|
+
## Setup
|
|
7
|
+
|
|
8
|
+
The Gladia provider is available in the `@ai-sdk/gladia` module. You can install it with
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
npm i @ai-sdk/gladia
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Provider Instance
|
|
15
|
+
|
|
16
|
+
You can import the default provider instance `gladia` from `@ai-sdk/gladia`:
|
|
17
|
+
|
|
18
|
+
```ts
|
|
19
|
+
import { gladia } from '@ai-sdk/gladia';
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Example
|
|
23
|
+
|
|
24
|
+
```ts
|
|
25
|
+
import { gladia } from '@ai-sdk/gladia';
|
|
26
|
+
import { experimental_transcribe as transcribe } from 'ai';
|
|
27
|
+
|
|
28
|
+
const { text } = await transcribe({
|
|
29
|
+
model: gladia.transcription(),
|
|
30
|
+
audio: new URL(
|
|
31
|
+
'https://github.com/vercel/ai/raw/refs/heads/main/examples/ai-core/data/galileo.mp3',
|
|
32
|
+
),
|
|
33
|
+
});
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Documentation
|
|
37
|
+
|
|
38
|
+
Please check out the **[Gladia provider documentation](https://sdk.vercel.ai/providers/ai-sdk-providers/gladia)** for more information.
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { TranscriptionModelV1, ProviderV1 } from '@ai-sdk/provider';
|
|
2
|
+
import { FetchFunction } from '@ai-sdk/provider-utils';
|
|
3
|
+
|
|
4
|
+
type GladiaConfig = {
|
|
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
|
+
interface GladiaTranscriptionModelConfig extends GladiaConfig {
|
|
16
|
+
_internal?: {
|
|
17
|
+
currentDate?: () => Date;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
declare class GladiaTranscriptionModel implements TranscriptionModelV1 {
|
|
21
|
+
readonly modelId: 'default';
|
|
22
|
+
private readonly config;
|
|
23
|
+
readonly specificationVersion = "v1";
|
|
24
|
+
get provider(): string;
|
|
25
|
+
constructor(modelId: 'default', config: GladiaTranscriptionModelConfig);
|
|
26
|
+
private getArgs;
|
|
27
|
+
doGenerate(options: Parameters<TranscriptionModelV1['doGenerate']>[0]): Promise<Awaited<ReturnType<TranscriptionModelV1['doGenerate']>>>;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
interface GladiaProvider extends Pick<ProviderV1, 'transcriptionModel'> {
|
|
31
|
+
(): {
|
|
32
|
+
transcription: GladiaTranscriptionModel;
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
Creates a model for transcription.
|
|
36
|
+
*/
|
|
37
|
+
transcription(): TranscriptionModelV1;
|
|
38
|
+
}
|
|
39
|
+
interface GladiaProviderSettings {
|
|
40
|
+
/**
|
|
41
|
+
API key for authenticating requests.
|
|
42
|
+
*/
|
|
43
|
+
apiKey?: string;
|
|
44
|
+
/**
|
|
45
|
+
Custom headers to include in the requests.
|
|
46
|
+
*/
|
|
47
|
+
headers?: Record<string, string>;
|
|
48
|
+
/**
|
|
49
|
+
Custom fetch implementation. You can use it as a middleware to intercept requests,
|
|
50
|
+
or to provide a custom fetch implementation for e.g. testing.
|
|
51
|
+
*/
|
|
52
|
+
fetch?: FetchFunction;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
Create a Gladia provider instance.
|
|
56
|
+
*/
|
|
57
|
+
declare function createGladia(options?: GladiaProviderSettings): GladiaProvider;
|
|
58
|
+
/**
|
|
59
|
+
Default Gladia provider instance.
|
|
60
|
+
*/
|
|
61
|
+
declare const gladia: GladiaProvider;
|
|
62
|
+
|
|
63
|
+
export { type GladiaProvider, type GladiaProviderSettings, createGladia, gladia };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { TranscriptionModelV1, ProviderV1 } from '@ai-sdk/provider';
|
|
2
|
+
import { FetchFunction } from '@ai-sdk/provider-utils';
|
|
3
|
+
|
|
4
|
+
type GladiaConfig = {
|
|
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
|
+
interface GladiaTranscriptionModelConfig extends GladiaConfig {
|
|
16
|
+
_internal?: {
|
|
17
|
+
currentDate?: () => Date;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
declare class GladiaTranscriptionModel implements TranscriptionModelV1 {
|
|
21
|
+
readonly modelId: 'default';
|
|
22
|
+
private readonly config;
|
|
23
|
+
readonly specificationVersion = "v1";
|
|
24
|
+
get provider(): string;
|
|
25
|
+
constructor(modelId: 'default', config: GladiaTranscriptionModelConfig);
|
|
26
|
+
private getArgs;
|
|
27
|
+
doGenerate(options: Parameters<TranscriptionModelV1['doGenerate']>[0]): Promise<Awaited<ReturnType<TranscriptionModelV1['doGenerate']>>>;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
interface GladiaProvider extends Pick<ProviderV1, 'transcriptionModel'> {
|
|
31
|
+
(): {
|
|
32
|
+
transcription: GladiaTranscriptionModel;
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
Creates a model for transcription.
|
|
36
|
+
*/
|
|
37
|
+
transcription(): TranscriptionModelV1;
|
|
38
|
+
}
|
|
39
|
+
interface GladiaProviderSettings {
|
|
40
|
+
/**
|
|
41
|
+
API key for authenticating requests.
|
|
42
|
+
*/
|
|
43
|
+
apiKey?: string;
|
|
44
|
+
/**
|
|
45
|
+
Custom headers to include in the requests.
|
|
46
|
+
*/
|
|
47
|
+
headers?: Record<string, string>;
|
|
48
|
+
/**
|
|
49
|
+
Custom fetch implementation. You can use it as a middleware to intercept requests,
|
|
50
|
+
or to provide a custom fetch implementation for e.g. testing.
|
|
51
|
+
*/
|
|
52
|
+
fetch?: FetchFunction;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
Create a Gladia provider instance.
|
|
56
|
+
*/
|
|
57
|
+
declare function createGladia(options?: GladiaProviderSettings): GladiaProvider;
|
|
58
|
+
/**
|
|
59
|
+
Default Gladia provider instance.
|
|
60
|
+
*/
|
|
61
|
+
declare const gladia: GladiaProvider;
|
|
62
|
+
|
|
63
|
+
export { type GladiaProvider, type GladiaProviderSettings, createGladia, gladia };
|