36 lines
1.1 KiB
TypeScript
36 lines
1.1 KiB
TypeScript
import {
|
|
customProvider,
|
|
extractReasoningMiddleware,
|
|
wrapLanguageModel,
|
|
} from 'ai';
|
|
import { gateway } from '@ai-sdk/gateway';
|
|
import { isTestEnvironment } from '../constants';
|
|
|
|
export const myProvider = isTestEnvironment
|
|
? (() => {
|
|
const {
|
|
artifactModel,
|
|
chatModel,
|
|
reasoningModel,
|
|
titleModel,
|
|
} = require('./models.test');
|
|
return customProvider({
|
|
languageModels: {
|
|
'chat-model': chatModel,
|
|
'chat-model-reasoning': reasoningModel,
|
|
'title-model': titleModel,
|
|
'artifact-model': artifactModel,
|
|
},
|
|
});
|
|
})()
|
|
: customProvider({
|
|
languageModels: {
|
|
'chat-model': gateway.languageModel('xai/grok-2-vision-1212'),
|
|
'chat-model-reasoning': wrapLanguageModel({
|
|
model: gateway.languageModel('xai/grok-3-mini'),
|
|
middleware: extractReasoningMiddleware({ tagName: 'think' }),
|
|
}),
|
|
'title-model': gateway.languageModel('xai/grok-2-1212'),
|
|
'artifact-model': gateway.languageModel('xai/grok-2-1212'),
|
|
},
|
|
});
|