An AI-powered search engine with a generative UI
TypeScript generative-aigenerative-uinextjsollamareactsearxngshadcn-uitailwindcsstavilytypescriptupstashvercel-ai-sdk
feat: update Ollama model configuration and enhance tool call support
Yoshiki Miura9a2da14fd24e
diff --git a/.env.local.example b/.env.local.exampleindex 1b9e53b9..fe96ae10 100644--- a/.env.local.example+++ b/.env.local.example@@ -43,8 +43,11 @@ TAVILY_API_KEY=[YOUR_TAVILY_API_KEY] # Get your API key at: https://app.tavily.# Groq# GROQ_API_KEY=[YOUR_GROQ_API_KEY]-# Ollama (Local AI)+# Ollama# OLLAMA_BASE_URL=http://localhost:11434+# NEXT_PUBLIC_OLLAMA_MODEL=[YOUR_MODEL_NAME] (eg: deepseek-r1)+# If you want to use a different model for tool call, set the model name here.+# NEXT_PUBLIC_OLLAMA_TOOL_CALL_MODEL=[YOUR_MODEL_NAME] (eg: phi4) (optional)# Azure OpenAI# AZURE_API_KEY=diff --git a/lib/tools/search.ts b/lib/tools/search.tsindex f46cfb99..1a1170ab 100644--- a/lib/tools/search.ts+++ b/lib/tools/search.ts@@ -82,6 +82,7 @@ export const searchTool = tool({}}+ console.log('completed search')return searchResult}})diff --git a/lib/types/models.ts b/lib/types/models.tsindex 871ab690..5f0bd3f2 100644--- a/lib/types/models.ts+++ b/lib/types/models.ts@@ -61,8 +61,8 @@ export const models: Model[] = [providerId: 'groq'},{- id: 'deepseek-r1',- name: 'DeepSeek R1',+ id: process.env.NEXT_PUBLIC_OLLAMA_MODEL || 'deepseek-r1',+ name: process.env.NEXT_PUBLIC_OLLAMA_MODEL || 'DeepSeek R1',provider: 'Ollama',providerId: 'ollama'},diff --git a/lib/utils/registry.ts b/lib/utils/registry.tsindex 3cbf7188..89f6fcd3 100644--- a/lib/utils/registry.ts+++ b/lib/utils/registry.ts@@ -114,6 +114,7 @@ export function isProviderEnabled(providerId: string): boolean {export function getToolCallModel(model?: string) {const provider = model?.split(':')[0]+ const modelName = model?.split(':')[1]switch (provider) {case 'deepseek':return getModel('deepseek:deepseek-chat')@@ -124,15 +125,21 @@ export function getToolCallModel(model?: string) {case 'groq':return getModel('groq:llama-3.1-8b-instant')case 'ollama':- return getModel('ollama:phi4')+ const ollamaModel =+ process.env.NEXT_PUBLIC_OLLAMA_TOOL_CALL_MODEL || modelName+ return getModel(`ollama:${ollamaModel}`)default:return getModel('openai:gpt-4o-mini')}}export function isToolCallSupported(model?: string) {+ const provider = model?.split(':')[0]const modelName = model?.split(':')[1]+ if (provider === 'ollama') {+ return false+ }// Deepseek R1 is not supported// Deepseek v3's tool call is unstable, so we include it in the listreturn !modelName?.includes('deepseek')