kyd-shared-badge 0.3.36 → 0.3.37

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kyd-shared-badge",
3
- "version": "0.3.36",
3
+ "version": "0.3.37",
4
4
  "private": false,
5
5
  "main": "./src/index.ts",
6
6
  "module": "./src/index.ts",
@@ -16,7 +16,7 @@
16
16
  "react-dom": "^19.0.0"
17
17
  },
18
18
  "dependencies": {
19
- "@ai-sdk/amazon-bedrock": "^3.0.22",
19
+ "@ai-sdk/openai": "^3.0.22",
20
20
  "@aws-sdk/client-s3": "^3.893.0",
21
21
  "@aws-sdk/lib-dynamodb": "^3.893.0",
22
22
  "@chatscope/chat-ui-kit-react": "^2.1.1",
@@ -2,9 +2,9 @@ declare module 'ai' {
2
2
  export function streamText(args: any): any;
3
3
  }
4
4
 
5
- declare module '@ai-sdk/amazon-bedrock' {
5
+ declare module '@ai-sdk/openai' {
6
6
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
7
- export function bedrock(modelId: string, opts?: any): any;
7
+ export function createOpenAI(config?: any): (model: string, options?: any) => any;
8
8
  }
9
9
 
10
10
 
package/src/lib/routes.ts CHANGED
@@ -3,7 +3,7 @@
3
3
 
4
4
  import { NextRequest } from 'next/server';
5
5
  import { streamText } from 'ai';
6
- import { bedrock } from '@ai-sdk/amazon-bedrock';
6
+ import { createOpenAI } from '@ai-sdk/openai';
7
7
 
8
8
  import { getHistory, putMessage } from './chat-store';
9
9
  import {
@@ -42,8 +42,13 @@ export async function chatStreamRoute(req: NextRequest, userId: string, companyI
42
42
  const system = buildAllContextPrompt(cleaned, graphData, { concise: true });
43
43
  const history = await getHistory(sessionId, 20);
44
44
 
45
+ const openrouter = createOpenAI({
46
+ apiKey: process.env.OPENROUTER_API_KEY,
47
+ baseURL: 'https://openrouter.ai/api/v1',
48
+ });
49
+
45
50
  const result = await streamText({
46
- model: bedrock('us.anthropic.claude-3-5-haiku-20241022-v1:0', { region: process.env.AWS_REGION }),
51
+ model: openrouter('openai/o4-mini'),
47
52
  system,
48
53
  messages: [...history, { role: 'user' as const, content }],
49
54
  maxTokens: 1024,