File tree 3 files changed +15
-4
lines changed
3 files changed +15
-4
lines changed Original file line number Diff line number Diff line change 1
- import { experimental_createProviderRegistry as createProviderRegistry } from 'ai'
2
- import { openai , createOpenAI } from '@ai-sdk/openai'
3
1
import { anthropic } from '@ai-sdk/anthropic'
4
- import { google } from '@ai-sdk/google'
5
2
import { createAzure } from '@ai-sdk/azure'
3
+ import { google } from '@ai-sdk/google'
4
+ import { createOpenAI , openai } from '@ai-sdk/openai'
5
+ import { experimental_createProviderRegistry as createProviderRegistry } from 'ai'
6
6
import { createOllama } from 'ollama-ai-provider'
7
7
8
8
export const registry = createProviderRegistry ( {
@@ -27,6 +27,17 @@ export const registry = createProviderRegistry({
27
27
} )
28
28
29
29
export function getModel ( model : string ) {
30
+ // if ollama provider, set simulateStreaming to true
31
+ if ( model . includes ( 'ollama' ) ) {
32
+ const modelName = model . split ( ':' ) [ 1 ]
33
+ const ollama = createOllama ( {
34
+ baseURL : `${ process . env . OLLAMA_BASE_URL } /api`
35
+ } )
36
+ return ollama ( modelName , {
37
+ simulateStreaming : true
38
+ } )
39
+ }
40
+
30
41
return registry . languageModel ( model )
31
42
}
32
43
Original file line number Diff line number Diff line change 40
40
"next" : " ^15.1.3" ,
41
41
"next-themes" : " ^0.3.0" ,
42
42
"node-html-parser" : " ^6.1.13" ,
43
- "ollama-ai-provider" : " ^1.1 .0" ,
43
+ "ollama-ai-provider" : " ^1.2 .0" ,
44
44
"react" : " ^19.0.0" ,
45
45
"react-dom" : " ^19.0.0" ,
46
46
"react-icons" : " ^5.0.1" ,
You can’t perform that action at this time.
0 commit comments