Skip to content

Commit

Permalink
Customize ChatGPT model
Browse files Browse the repository at this point in the history
  • Loading branch information
winniesi committed Apr 13, 2024
1 parent 9e47edc commit 4b2c4e4
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 3 deletions.
4 changes: 4 additions & 0 deletions .env.local.example
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
# If you need to set a BASE URL, uncomment and set the following:
# 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'

# OpenAI API key retrieved here: https://platform.openai.com/api-keys
OPENAI_API_KEY=

Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ Your .env.local file should look like this:
# If you need to set a BASE URL, uncomment and set the following:
# 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'
# OpenAI API key retrieved here: https://platform.openai.com/api-keys
OPENAI_API_KEY=[YOUR_OPENAI_API_KEY]
Expand Down
2 changes: 1 addition & 1 deletion lib/agents/inquire.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export async function inquire(

let finalInquiry: PartialInquiry = {}
await experimental_streamObject({
model: openai.chat('gpt-4-turbo'),
model: openai.chat(process.env.OPENAI_API_MODEL || 'gpt-4-turbo'),
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.
Expand Down
2 changes: 1 addition & 1 deletion lib/agents/query-suggestor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export async function querySuggestor(
)

await experimental_streamObject({
model: openai.chat('gpt-4-turbo'),
model: openai.chat(process.env.OPENAI_API_MODEL || 'gpt-4-turbo'),
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:
Expand Down
2 changes: 1 addition & 1 deletion lib/agents/researcher.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export async function researcher(
)

const result = await experimental_streamText({
model: openai.chat('gpt-4-turbo'),
model: openai.chat(process.env.OPENAI_API_MODEL || 'gpt-4-turbo'),
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.
Expand Down

0 comments on commit 4b2c4e4

Please sign in to comment.