mukaddamzaid commited on
Commit
6377651
·
1 Parent(s): f52651d

feat: add Google and Groq SDKs, update model configurations

Browse files

- Integrated @ai-sdk/google and @ai-sdk/groq as dependencies in the project.
- Updated providers to include Google and Groq models with relevant configurations.
- Modified the ModelPicker component to support new model options for Google and Groq.

Files changed (4) hide show
  1. ai/providers.ts +46 -18
  2. components/model-picker.tsx +4 -0
  3. package.json +2 -0
  4. pnpm-lock.yaml +30 -0
ai/providers.ts CHANGED
@@ -1,6 +1,8 @@
1
  import { xai } from "@ai-sdk/xai";
2
  import { openai } from "@ai-sdk/openai";
3
- import { customProvider } from "ai";
 
 
4
 
5
  export interface ModelInfo {
6
  provider: string;
@@ -10,28 +12,40 @@ export interface ModelInfo {
10
  capabilities: string[];
11
  }
12
 
 
 
 
 
 
13
  const languageModels = {
14
- "grok-3": xai("grok-3-latest"),
15
- "grok-3-mini": xai("grok-3-mini-fast-latest"),
16
  "gpt-4.1-mini": openai("gpt-4.1-mini"),
17
  "gpt-4.1-nano": openai("gpt-4.1-nano"),
 
 
 
 
 
 
 
18
  };
19
 
20
  export const modelDetails: Record<keyof typeof languageModels, ModelInfo> = {
21
- "grok-3": {
22
- provider: "xAI",
23
- name: "Grok-3",
24
- description: "Latest version of xAI's flagship model with strong reasoning and coding capabilities.",
25
- apiVersion: "grok-3-latest",
26
- capabilities: ["Balance", "Efficient", "Agentic"]
27
- },
28
- "grok-3-mini": {
29
- provider: "xAI",
30
- name: "Grok-3 Mini",
31
- description: "Fast, efficient and smaller xAI model with reasoning capabilities.",
32
- apiVersion: "grok-3-mini-fast-latest",
33
- capabilities: ["Fast","Reasoning", "Efficient"]
34
- },
35
  "gpt-4.1-mini": {
36
  provider: "OpenAI",
37
  name: "GPT-4.1 Mini",
@@ -45,7 +59,21 @@ export const modelDetails: Record<keyof typeof languageModels, ModelInfo> = {
45
  description: "Smallest and fastest GPT-4.1 variant designed for efficient rapid responses.",
46
  apiVersion: "gpt-4.1-nano",
47
  capabilities: ["Rapid", "Compact", "Efficient", "Vision"]
 
 
 
 
 
 
 
48
  },
 
 
 
 
 
 
 
49
  };
50
 
51
  export const model = customProvider({
@@ -56,4 +84,4 @@ export type modelID = keyof typeof languageModels;
56
 
57
  export const MODELS = Object.keys(languageModels);
58
 
59
- export const defaultModel: modelID = "grok-3-mini";
 
1
  import { xai } from "@ai-sdk/xai";
2
  import { openai } from "@ai-sdk/openai";
3
+ import { google } from "@ai-sdk/google";
4
+ import { groq } from "@ai-sdk/groq";
5
+ import { customProvider, wrapLanguageModel, extractReasoningMiddleware } from "ai";
6
 
7
  export interface ModelInfo {
8
  provider: string;
 
12
  capabilities: string[];
13
  }
14
 
15
+ const middleware = extractReasoningMiddleware({
16
+ tagName: 'reasoning',
17
+ separator: '\n',
18
+ });
19
+
20
  const languageModels = {
21
+ // "grok-3": xai("grok-3-latest"),
22
+ // "grok-3-mini": xai("grok-3-mini-fast-latest"),
23
  "gpt-4.1-mini": openai("gpt-4.1-mini"),
24
  "gpt-4.1-nano": openai("gpt-4.1-nano"),
25
+ "gemini-2-flash": google("gemini-2.0-flash-001"),
26
+ "qwen-qwq": wrapLanguageModel(
27
+ {
28
+ model: groq("qwen-qwq-32b"),
29
+ middleware
30
+ }
31
+ )
32
  };
33
 
34
  export const modelDetails: Record<keyof typeof languageModels, ModelInfo> = {
35
+ // "grok-3": {
36
+ // provider: "xAI",
37
+ // name: "Grok-3",
38
+ // description: "Latest version of xAI's flagship model with strong reasoning and coding capabilities.",
39
+ // apiVersion: "grok-3-latest",
40
+ // capabilities: ["Balance", "Efficient", "Agentic"]
41
+ // },
42
+ // "grok-3-mini": {
43
+ // provider: "xAI",
44
+ // name: "Grok-3 Mini",
45
+ // description: "Fast, efficient and smaller xAI model with reasoning capabilities.",
46
+ // apiVersion: "grok-3-mini-fast-latest",
47
+ // capabilities: ["Fast","Reasoning", "Efficient"]
48
+ // },
49
  "gpt-4.1-mini": {
50
  provider: "OpenAI",
51
  name: "GPT-4.1 Mini",
 
59
  description: "Smallest and fastest GPT-4.1 variant designed for efficient rapid responses.",
60
  apiVersion: "gpt-4.1-nano",
61
  capabilities: ["Rapid", "Compact", "Efficient", "Vision"]
62
+ },
63
+ "gemini-2-flash": {
64
+ provider: "Google",
65
+ name: "Gemini 2 Flash",
66
+ description: "Latest version of Google's Gemini 2 with strong reasoning and coding capabilities.",
67
+ apiVersion: "gemini-2-flash",
68
+ capabilities: ["Balance", "Efficient", "Agentic"]
69
  },
70
+ "qwen-qwq": {
71
+ provider: "Groq",
72
+ name: "Qwen QWQ",
73
+ description: "Latest version of Alibaba's Qwen QWQ with strong reasoning and coding capabilities.",
74
+ apiVersion: "qwen-qwq",
75
+ capabilities: ["Reasoning", "Efficient", "Agentic"]
76
+ }
77
  };
78
 
79
  export const model = customProvider({
 
84
 
85
  export const MODELS = Object.keys(languageModels);
86
 
87
+ export const defaultModel: modelID = "qwen-qwq";
components/model-picker.tsx CHANGED
@@ -38,6 +38,10 @@ export const ModelPicker = ({ selectedModel, setSelectedModel }: ModelPickerProp
38
  return <Sparkles className="h-3 w-3 text-yellow-500" />;
39
  case 'openai':
40
  return <Zap className="h-3 w-3 text-green-500" />;
 
 
 
 
41
  default:
42
  return <Info className="h-3 w-3 text-blue-500" />;
43
  }
 
38
  return <Sparkles className="h-3 w-3 text-yellow-500" />;
39
  case 'openai':
40
  return <Zap className="h-3 w-3 text-green-500" />;
41
+ case 'google':
42
+ return <Zap className="h-3 w-3 text-red-500" />;
43
+ case 'groq':
44
+ return <Sparkles className="h-3 w-3 text-blue-500" />;
45
  default:
46
  return <Info className="h-3 w-3 text-blue-500" />;
47
  }
package.json CHANGED
@@ -13,6 +13,8 @@
13
  "db:studio": "drizzle-kit studio"
14
  },
15
  "dependencies": {
 
 
16
  "@ai-sdk/openai": "^1.3.16",
17
  "@ai-sdk/react": "^1.2.9",
18
  "@ai-sdk/xai": "^1.2.13",
 
13
  "db:studio": "drizzle-kit studio"
14
  },
15
  "dependencies": {
16
+ "@ai-sdk/google": "^1.2.12",
17
+ "@ai-sdk/groq": "^1.2.8",
18
  "@ai-sdk/openai": "^1.3.16",
19
  "@ai-sdk/react": "^1.2.9",
20
  "@ai-sdk/xai": "^1.2.13",
pnpm-lock.yaml CHANGED
@@ -8,6 +8,12 @@ importers:
8
 
9
  .:
10
  dependencies:
 
 
 
 
 
 
11
  '@ai-sdk/openai':
12
  specifier: ^1.3.16
13
  version: 1.3.16([email protected])
@@ -189,6 +195,18 @@ importers:
189
 
190
  packages:
191
 
 
 
 
 
 
 
 
 
 
 
 
 
192
  '@ai-sdk/[email protected]':
193
  resolution: {integrity: sha512-56U0uNCcFTygA4h6R/uREv8r5sKA3/pGkpIAnMOpRzs5wiARlTYakWW3LZgxg6D4Gpeswo4gwNJczB7nM0K1Qg==}
194
  engines: {node: '>=18'}
@@ -4474,6 +4492,18 @@ packages:
4474
 
4475
  snapshots:
4476
 
 
 
 
 
 
 
 
 
 
 
 
 
4477
4478
  dependencies:
4479
  '@ai-sdk/provider': 1.1.3
 
8
 
9
  .:
10
  dependencies:
11
+ '@ai-sdk/google':
12
+ specifier: ^1.2.12
13
+ version: 1.2.12([email protected])
14
+ '@ai-sdk/groq':
15
+ specifier: ^1.2.8
16
+ version: 1.2.8([email protected])
17
  '@ai-sdk/openai':
18
  specifier: ^1.3.16
19
  version: 1.3.16([email protected])
 
195
 
196
  packages:
197
 
198
+ '@ai-sdk/[email protected]':
199
+ resolution: {integrity: sha512-A8AYqCmBs9SJFiAOP6AX0YEDHWTDrCaUDiRY2cdMSKjJiEknvwnPrAAKf3idgVqYaM2kS0qWz5v9v4pBzXDx+w==}
200
+ engines: {node: '>=18'}
201
+ peerDependencies:
202
+ zod: ^3.0.0
203
+
204
+ '@ai-sdk/[email protected]':
205
+ resolution: {integrity: sha512-DRq0b4twVUh52DFnIhVC4F14Po8w+76sCdigMRRIcAiSmGRr9I3Vyot36tun1q4tBZMYSvQUss60W3eiaoa6mg==}
206
+ engines: {node: '>=18'}
207
+ peerDependencies:
208
+ zod: ^3.0.0
209
+
210
  '@ai-sdk/[email protected]':
211
  resolution: {integrity: sha512-56U0uNCcFTygA4h6R/uREv8r5sKA3/pGkpIAnMOpRzs5wiARlTYakWW3LZgxg6D4Gpeswo4gwNJczB7nM0K1Qg==}
212
  engines: {node: '>=18'}
 
4492
 
4493
  snapshots:
4494
 
4495
4496
+ dependencies:
4497
+ '@ai-sdk/provider': 1.1.3
4498
+ '@ai-sdk/provider-utils': 2.2.7([email protected])
4499
+ zod: 3.24.2
4500
+
4501
4502
+ dependencies:
4503
+ '@ai-sdk/provider': 1.1.3
4504
+ '@ai-sdk/provider-utils': 2.2.7([email protected])
4505
+ zod: 3.24.2
4506
+
4507
4508
  dependencies:
4509
  '@ai-sdk/provider': 1.1.3