@@ -2,6 +2,7 @@ import { OllamaEmbeddings } from '@langchain/community/embeddings/ollama';
2
2
import { getKeepAlive , getOllamaApiEndpoint } from '../../config' ;
3
3
import logger from '../../utils/logger' ;
4
4
import { ChatOllama } from '@langchain/community/chat_models/ollama' ;
5
+ import axios from 'axios' ;
5
6
6
7
export const loadOllamaChatModels = async ( ) => {
7
8
const ollamaEndpoint = getOllamaApiEndpoint ( ) ;
@@ -10,13 +11,13 @@ export const loadOllamaChatModels = async () => {
10
11
if ( ! ollamaEndpoint ) return { } ;
11
12
12
13
try {
13
- const response = await fetch ( `${ ollamaEndpoint } /api/tags` , {
14
+ const response = await axios . get ( `${ ollamaEndpoint } /api/tags` , {
14
15
headers : {
15
16
'Content-Type' : 'application/json' ,
16
17
} ,
17
18
} ) ;
18
19
19
- const { models : ollamaModels } = ( await response . json ( ) ) as any ;
20
+ const { models : ollamaModels } = response . data ;
20
21
21
22
const chatModels = ollamaModels . reduce ( ( acc , model ) => {
22
23
acc [ model . model ] = {
@@ -45,13 +46,13 @@ export const loadOllamaEmbeddingsModels = async () => {
45
46
if ( ! ollamaEndpoint ) return { } ;
46
47
47
48
try {
48
- const response = await fetch ( `${ ollamaEndpoint } /api/tags` , {
49
+ const response = await axios . get ( `${ ollamaEndpoint } /api/tags` , {
49
50
headers : {
50
51
'Content-Type' : 'application/json' ,
51
52
} ,
52
53
} ) ;
53
54
54
- const { models : ollamaModels } = ( await response . json ( ) ) as any ;
55
+ const { models : ollamaModels } = response . data ;
55
56
56
57
const embeddingsModels = ollamaModels . reduce ( ( acc , model ) => {
57
58
acc [ model . model ] = {
0 commit comments