@ai-sdk/google 4.0.101 → 4.0.102
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 +10 -0
- package/dist/index.d.ts +10 -13
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +42 -46
- package/dist/index.js.map +1 -1
- package/dist/internal/index.d.ts.map +1 -1
- package/dist/internal/index.js +19 -29
- package/dist/internal/index.js.map +1 -1
- package/docs/15-google.mdx +1 -1
- package/package.json +2 -2
- package/src/google-batch.ts +37 -34
- package/src/google-embedding-model-options.ts +15 -14
- package/src/google-files.ts +1 -11
- package/src/google-image-model-options.ts +1 -1
- package/src/google-language-model.ts +43 -40
- package/src/google-speech-model-options.ts +17 -14
- package/src/google-video-model.ts +34 -27
- package/src/tool/file-search.ts +34 -27
- package/src/tool/google-search.ts +16 -15
- package/src/transcription/google-transcription-model-options.ts +40 -31
- package/src/transcription/google-transcription-model.ts +37 -30
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
import {
|
|
2
|
+
lazySchema,
|
|
3
|
+
zodSchema,
|
|
4
|
+
type InferSchema,
|
|
5
|
+
} from '@ai-sdk/provider-utils';
|
|
1
6
|
import { z } from 'zod/v4';
|
|
2
7
|
|
|
3
8
|
export type GoogleTranscriptionModelId =
|
|
@@ -10,41 +15,45 @@ export type GoogleTranscriptionModelId =
|
|
|
10
15
|
* live (`gemini-3.5-transcribe-live`) transcription. Maps onto Google's
|
|
11
16
|
* `AudioTranscriptionConfig`.
|
|
12
17
|
*/
|
|
13
|
-
export const googleTranscriptionModelOptions =
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
18
|
+
export const googleTranscriptionModelOptions = lazySchema(() =>
|
|
19
|
+
zodSchema(
|
|
20
|
+
z.object({
|
|
21
|
+
/**
|
|
22
|
+
* BCP-47 language codes providing hints about the languages present in the
|
|
23
|
+
* audio. If omitted or empty, defaults to automatic language detection.
|
|
24
|
+
*/
|
|
25
|
+
languageCodes: z.array(z.string()).optional(),
|
|
19
26
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
27
|
+
/**
|
|
28
|
+
* Custom vocabulary phrases, which bias the speech recognition model
|
|
29
|
+
* toward recognizing specific terms.
|
|
30
|
+
*/
|
|
31
|
+
customVocabulary: z.array(z.string()).optional(),
|
|
25
32
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
33
|
+
/**
|
|
34
|
+
* Enables word-level timestamp generation.
|
|
35
|
+
*/
|
|
36
|
+
wordTimestamp: z.boolean().optional(),
|
|
30
37
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
38
|
+
/**
|
|
39
|
+
* Enables speaker diarization.
|
|
40
|
+
*/
|
|
41
|
+
diarization: z.boolean().optional(),
|
|
35
42
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
})
|
|
43
|
+
/**
|
|
44
|
+
* Transcription output formatting mode.
|
|
45
|
+
*
|
|
46
|
+
* - `VERBATIM` (default): exact literal transcript preserving filler
|
|
47
|
+
* words, repetitions, and false starts.
|
|
48
|
+
* - `SMART`: cleans up and structures the transcript in real time —
|
|
49
|
+
* disfluency removal, inline self-corrections, structured formatting
|
|
50
|
+
* (lists, numbers, dates, paragraph breaks), and grammar/casing polish.
|
|
51
|
+
*/
|
|
52
|
+
mode: z.enum(['SMART', 'VERBATIM']).optional(),
|
|
53
|
+
}),
|
|
54
|
+
),
|
|
55
|
+
);
|
|
47
56
|
|
|
48
|
-
export type GoogleTranscriptionModelOptions =
|
|
57
|
+
export type GoogleTranscriptionModelOptions = InferSchema<
|
|
49
58
|
typeof googleTranscriptionModelOptions
|
|
50
59
|
>;
|
|
@@ -7,6 +7,8 @@ import {
|
|
|
7
7
|
type TranscriptionModelV4,
|
|
8
8
|
} from '@ai-sdk/provider';
|
|
9
9
|
import {
|
|
10
|
+
lazySchema,
|
|
11
|
+
zodSchema,
|
|
10
12
|
combineHeaders,
|
|
11
13
|
connectToWebSocket,
|
|
12
14
|
convertToBase64,
|
|
@@ -684,33 +686,38 @@ function validateLiveInputAudioFormat(
|
|
|
684
686
|
}
|
|
685
687
|
}
|
|
686
688
|
|
|
687
|
-
const googleInteractionsWordAnnotationSchema =
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
.
|
|
699
|
-
z.
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
.
|
|
703
|
-
z.
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
689
|
+
const googleInteractionsWordAnnotationSchema = () =>
|
|
690
|
+
z.object({
|
|
691
|
+
type: z.string().nullish(),
|
|
692
|
+
text: z.string().nullish(),
|
|
693
|
+
speaker: z.string().nullish(),
|
|
694
|
+
start_offset: z.string().nullish(),
|
|
695
|
+
end_offset: z.string().nullish(),
|
|
696
|
+
});
|
|
697
|
+
|
|
698
|
+
const googleInteractionsTranscriptionResponseSchema = lazySchema(() =>
|
|
699
|
+
zodSchema(
|
|
700
|
+
z.object({
|
|
701
|
+
status: z.string().nullish(),
|
|
702
|
+
steps: z
|
|
703
|
+
.array(
|
|
704
|
+
z.object({
|
|
705
|
+
type: z.string().nullish(),
|
|
706
|
+
content: z
|
|
707
|
+
.array(
|
|
708
|
+
z.object({
|
|
709
|
+
type: z.string().nullish(),
|
|
710
|
+
text: z.string().nullish(),
|
|
711
|
+
annotations: z
|
|
712
|
+
.array(googleInteractionsWordAnnotationSchema())
|
|
713
|
+
.nullish(),
|
|
714
|
+
}),
|
|
715
|
+
)
|
|
716
|
+
.nullish(),
|
|
717
|
+
}),
|
|
718
|
+
)
|
|
719
|
+
.nullish(),
|
|
720
|
+
usage: z.record(z.string(), z.json()).nullish(),
|
|
721
|
+
}),
|
|
722
|
+
),
|
|
723
|
+
);
|