An AI-powered search engine with a generative UI
TypeScript generative-aigenerative-uinextjsollamareactsearxngshadcn-uitailwindcsstavilytypescriptupstashvercel-ai-sdk
Update OpenAI API model to gpt-4o
Yoshiki Miurab59e7a67f50b
diff --git a/.env.local.example b/.env.local.exampleindex 60112b2a..b1c07776 100644--- a/.env.local.example+++ b/.env.local.example@@ -20,8 +20,8 @@ UPSTASH_REDIS_REST_TOKEN=[YOUR_UPSTASH_REDIS_REST_TOKEN]# OPENAI_API_BASE=# Used to set the model for OpenAI API requests.-# If not set, the default is gpt-4-turbo.-# OPENAI_API_MODEL='gpt-4-turbo'+# If not set, the default is gpt-4o.+# OPENAI_API_MODEL='gpt-4o'# Only writers can set a specific model. It must be compatible with the OpenAI API.# USE_SPECIFIC_API_FOR_WRITER=truediff --git a/lib/agents/inquire.tsx b/lib/agents/inquire.tsxindex e83e1d71..021df906 100644--- a/lib/agents/inquire.tsx+++ b/lib/agents/inquire.tsx@@ -18,7 +18,7 @@ export async function inquire(let finalInquiry: PartialInquiry = {}await streamObject({- model: openai.chat(process.env.OPENAI_API_MODEL || 'gpt-4-turbo'),+ model: openai.chat(process.env.OPENAI_API_MODEL || 'gpt-4o'),system: `As a professional web researcher, your role is to deepen your understanding of the user's input by conducting further inquiries when necessary.After receiving an initial response from the user, carefully assess whether additional questions are absolutely essential to provide a comprehensive and accurate answer. Only proceed with further inquiries if the available information is insufficient or ambiguous.diff --git a/lib/agents/query-suggestor.tsx b/lib/agents/query-suggestor.tsxindex d64c920f..0cac58c4 100644--- a/lib/agents/query-suggestor.tsx+++ b/lib/agents/query-suggestor.tsx@@ -23,7 +23,7 @@ export async function querySuggestor(let finalRelatedQueries: PartialRelated = {}await streamObject({- model: openai.chat(process.env.OPENAI_API_MODEL || 'gpt-4-turbo'),+ model: openai.chat(process.env.OPENAI_API_MODEL || 'gpt-4o'),system: `As a professional web researcher, your task is to generate a set of three queries that explore the subject matter more deeply, building upon the initial query and the information uncovered in its search results.For instance, if the original query was "Starship's third test flight key milestones", your output should follow this format:diff --git a/lib/agents/researcher.tsx b/lib/agents/researcher.tsxindex fc18adb1..79fb653e 100644--- a/lib/agents/researcher.tsx+++ b/lib/agents/researcher.tsx@@ -37,7 +37,7 @@ export async function researcher(let isFirstToolResponse = trueconst result = await nonexperimental_streamText({- model: openai.chat(process.env.OPENAI_API_MODEL || 'gpt-4-turbo'),+ model: openai.chat(process.env.OPENAI_API_MODEL || 'gpt-4o'),maxTokens: 2500,system: `As a professional search expert, you possess the ability to search for any information on the web.For each user query, utilize the search results to their fullest potential to provide additional information and assistance in your response.diff --git a/lib/agents/task-manager.tsx b/lib/agents/task-manager.tsxindex ad434e84..89cb52d6 100644--- a/lib/agents/task-manager.tsx+++ b/lib/agents/task-manager.tsx@@ -12,7 +12,7 @@ export async function taskManager(messages: CoreMessage[]) {try {const result = await generateObject({- model: openai.chat(process.env.OPENAI_API_MODEL || 'gpt-4-turbo'),+ model: openai.chat(process.env.OPENAI_API_MODEL || 'gpt-4o'),system: `As a professional web researcher, your primary objective is to fully comprehend the user's query, conduct thorough web searches to gather the necessary information, and provide an appropriate response.To achieve this, you must first analyze the user's input and determine the optimal course of action. You have two options at your disposal:1. "proceed": If the provided information is sufficient to address the query effectively, choose this option to proceed with the research and formulate a response.