@ai-sdk/groq 4.0.0-beta.2 → 4.0.0-beta.21

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.
@@ -1,8 +1,8 @@
1
1
  import {
2
- LanguageModelV3,
2
+ LanguageModelV4,
3
3
  NoSuchModelError,
4
- ProviderV3,
5
- TranscriptionModelV3,
4
+ ProviderV4,
5
+ TranscriptionModelV4,
6
6
  } from '@ai-sdk/provider';
7
7
  import {
8
8
  FetchFunction,
@@ -17,21 +17,21 @@ import { GroqTranscriptionModel } from './groq-transcription-model';
17
17
 
18
18
  import { groqTools } from './groq-tools';
19
19
  import { VERSION } from './version';
20
- export interface GroqProvider extends ProviderV3 {
20
+ export interface GroqProvider extends ProviderV4 {
21
21
  /**
22
22
  * Creates a model for text generation.
23
23
  */
24
- (modelId: GroqChatModelId): LanguageModelV3;
24
+ (modelId: GroqChatModelId): LanguageModelV4;
25
25
 
26
26
  /**
27
27
  * Creates an Groq chat model for text generation.
28
28
  */
29
- languageModel(modelId: GroqChatModelId): LanguageModelV3;
29
+ languageModel(modelId: GroqChatModelId): LanguageModelV4;
30
30
 
31
31
  /**
32
32
  * Creates a model for transcription.
33
33
  */
34
- transcription(modelId: GroqTranscriptionModelId): TranscriptionModelV3;
34
+ transcription(modelId: GroqTranscriptionModelId): TranscriptionModelV4;
35
35
 
36
36
  /**
37
37
  * Tools provided by Groq.
@@ -118,7 +118,7 @@ export function createGroq(options: GroqProviderSettings = {}): GroqProvider {
118
118
  return createLanguageModel(modelId);
119
119
  };
120
120
 
121
- provider.specificationVersion = 'v3' as const;
121
+ provider.specificationVersion = 'v4' as const;
122
122
  provider.languageModel = createLanguageModel;
123
123
  provider.chat = createChatModel;
124
124
 
@@ -1,4 +1,4 @@
1
- import { TranscriptionModelV3, SharedV3Warning } from '@ai-sdk/provider';
1
+ import { TranscriptionModelV4, SharedV4Warning } from '@ai-sdk/provider';
2
2
  import {
3
3
  combineHeaders,
4
4
  convertBase64ToUint8Array,
@@ -22,8 +22,8 @@ interface GroqTranscriptionModelConfig extends GroqConfig {
22
22
  };
23
23
  }
24
24
 
25
- export class GroqTranscriptionModel implements TranscriptionModelV3 {
26
- readonly specificationVersion = 'v3';
25
+ export class GroqTranscriptionModel implements TranscriptionModelV4 {
26
+ readonly specificationVersion = 'v4';
27
27
 
28
28
  get provider(): string {
29
29
  return this.config.provider;
@@ -38,8 +38,8 @@ export class GroqTranscriptionModel implements TranscriptionModelV3 {
38
38
  audio,
39
39
  mediaType,
40
40
  providerOptions,
41
- }: Parameters<TranscriptionModelV3['doGenerate']>[0]) {
42
- const warnings: SharedV3Warning[] = [];
41
+ }: Parameters<TranscriptionModelV4['doGenerate']>[0]) {
42
+ const warnings: SharedV4Warning[] = [];
43
43
 
44
44
  // Parse provider options
45
45
  const groqOptions = await parseProviderOptions({
@@ -101,8 +101,8 @@ export class GroqTranscriptionModel implements TranscriptionModelV3 {
101
101
  }
102
102
 
103
103
  async doGenerate(
104
- options: Parameters<TranscriptionModelV3['doGenerate']>[0],
105
- ): Promise<Awaited<ReturnType<TranscriptionModelV3['doGenerate']>>> {
104
+ options: Parameters<TranscriptionModelV4['doGenerate']>[0],
105
+ ): Promise<Awaited<ReturnType<TranscriptionModelV4['doGenerate']>>> {
106
106
  const currentDate = this.config._internal?.currentDate?.() ?? new Date();
107
107
  const { formData, warnings } = await this.getArgs(options);
108
108
 
@@ -1,8 +1,8 @@
1
- import { LanguageModelV3FinishReason } from '@ai-sdk/provider';
1
+ import { LanguageModelV4FinishReason } from '@ai-sdk/provider';
2
2
 
3
3
  export function mapGroqFinishReason(
4
4
  finishReason: string | null | undefined,
5
- ): LanguageModelV3FinishReason['unified'] {
5
+ ): LanguageModelV4FinishReason['unified'] {
6
6
  switch (finishReason) {
7
7
  case 'stop':
8
8
  return 'stop';