Skip to content

Commit

Permalink
turbo model update
Browse files Browse the repository at this point in the history
  • Loading branch information
Zaki-1052 committed Apr 12, 2024
1 parent 3e45807 commit c1c022a
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 18 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ THREAD_ID=thread_0LhmZXMUOljwx8jojB2dcMyU

[**~~Deprecated~~**]

- **Smartest Snapshot of ChatGPT**: This application uses the `gpt-4` model without vision capabilities. However, users can switch to the standard `gpt-4-turbo-preview` model and adjust token limits (default is 4000) for different use cases.
- **Smartest Snapshot of ChatGPT**: This application uses the `gpt-4-turbo` model by default. However, users can switch to the old standard `gpt-4` model, which has a higher maxmimum completion output of 6000 tokens, rather than 4k.
- The Model Parameters, including the model itself, can be found on/around Line 200 in `server.js`, and has multiple comments to guide you if you're just getting started with customizing the API Responses.
- Be aware that although the API returns will be objectively better than what you receive on ChatGPT, usage adds up, and you may soon run out of credits.
- Always keep track of your token usage (relevant link found below); adjust instructions and/or parameters as needed.
Expand Down
3 changes: 1 addition & 2 deletions public/portal.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@
<div class="custom-select" id="selected-model">Select a Model</div>
<div id="model-options" class="select-options">
<button id="model-gpt-4" data-value="gpt-4">GPT-4: Default</button>
<button id="model-gpt-4-turbo" data-value="gpt-4-turbo-preview">GPT-4-Turbo</button>
<button id="model-gpt-4-vision" data-value="gpt-4-vision-preview">GPT-4-Vision</button>
<button id="model-gpt-4-turbo" data-value="gpt-4-turbo-">GPT-4-Turbo</button>
<button id="model-gpt-3.5" data-value="gpt-3.5-turbo-0125">GPT-3.5-Turbo</button>
<button id="model-gemini-pro" data-value="gemini-pro">Gemini Pro</button>
<button id="model-claude-opus" data-value="claude-3-opus-20240229">Claude Opus</button>
Expand Down
21 changes: 8 additions & 13 deletions public/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,8 @@ fetchConfig();

const modelID = {
"GPT-4": "gpt-4",
"GPT-4-Vision": "gpt-4-vision-preview",
"GPT-4-32k": "gpt-4-32k",
"GPT-4-Turbo": "gpt-4-turbo-preview",
"GPT-4-Turbo": "gpt-4-turbo",
"GPT-3.5-Turbo": "gpt-3.5-turbo-0125",
"Gemini-Pro": "gemini-pro",
"Gemini-Pro-Vision": "gemini-pro-vision",
Expand All @@ -59,9 +58,8 @@ fetchConfig();

const customModelNames = {
"gpt-4": "GPT-4",
"gpt-4-vision-preview": "GPT-4-Vision",
"gpt-4-32k": "GPT-4-32k",
"gpt-4-turbo-preview": "GPT-4-Turbo",
"gpt-4-turbo": "GPT-4-Turbo",
"gpt-3.5-turbo-0125": "GPT-3.5-Turbo",
"gemini-pro": "Gemini-Pro",
"gemini-pro-vision": "Gemini-Pro-Vision",
Expand All @@ -86,7 +84,7 @@ fetchConfig();
// Default model functionality
function setDefaultModel() {
let selectedModelDiv = document.getElementById("selected-model");
let defaultModel = "gpt-4-turbo-preview";
let defaultModel = "gpt-4-turbo";

// Check if a model has been selected, if not, set to default model ID and update display
if (selectedModelDiv.textContent.trim() === "Select a Model") {
Expand All @@ -95,7 +93,7 @@ fetchConfig();
}
}

let currentModelID = 'gpt-4-turbo-preview'; // Global declaration
let currentModelID = 'gpt-4-turbo'; // Global declaration

let selectedImage = null;

Expand Down Expand Up @@ -235,9 +233,8 @@ const selectedModelDisplayName = document.getElementById('selected-model').textC
// Define model descriptions
const modelDescriptions = {
"gpt-4": "GPT-4: Most Intelligent — Default",
"gpt-4-vision-preview": "GPT-4-Vision: View & Analyze Images",
"gpt-4-32k": "GPT-4-32k: Longer Context Window — Higher Price",
"gpt-4-turbo-preview": "GPT-4-Turbo: ChatGPT-Plus Model — 128k Tokens",
"gpt-4-turbo": "GPT-4-Turbo: ChatGPT-Plus Model — 128k Tokens",
"gpt-3.5-turbo-0125": "GPT-3.5-Turbo: Cheapest Option Available",
"gemini-pro": "Gemini-Pro: Google Bard Model — 3.5 Equivalent",
"gemini-pro-vision": "Gemini-Vision: View Images — One-Time Use",
Expand Down Expand Up @@ -304,7 +301,7 @@ document.querySelector('.custom-select').addEventListener('click', toggleDropdow
modeSelectorDiv.style.backgroundColor = '#4CAF50'; // Example: change background to green
modeSelectorDiv.textContent = 'Assistants Mode ON'; // Update text to indicate mode is on
isAssistants = true;
currentModelID = 'gpt-4-turbo-preview';
currentModelID = 'gpt-4-turbo';
} else {
modeSelectorDiv.style.backgroundColor = ''; // Reset background
modeSelectorDiv.textContent = 'Assistants Mode'; // Reset text
Expand Down Expand Up @@ -334,16 +331,14 @@ document.querySelector('.custom-select').addEventListener('click', toggleDropdow

// Event listeners for selecting GPT models
document.getElementById('model-gpt-4').addEventListener('click', () => selectModel('gpt-4'));
document.getElementById('model-gpt-4-vision').addEventListener('click', () => selectModel('gpt-4-vision-preview'));
document.getElementById('model-gpt-4-32k').addEventListener('click', () => selectModel('gpt-4-32k'));
document.getElementById('model-gpt-4-turbo').addEventListener('click', () => selectModel('gpt-4-turbo-preview'));
document.getElementById('model-gpt-4-turbo').addEventListener('click', () => selectModel('gpt-4-turbo'));
document.getElementById('model-gpt-3.5').addEventListener('click', () => selectModel('gpt-3.5-turbo-0125'));

// Event listeners for showing GPT model descriptions on hover
document.getElementById('model-gpt-4').addEventListener('mouseover', (event) => showCustomTooltip(modelDescriptions["gpt-4"], event.currentTarget));
document.getElementById('model-gpt-4-vision').addEventListener('mouseover', (event) => showCustomTooltip(modelDescriptions["gpt-4-vision-preview"], event.currentTarget));
document.getElementById('model-gpt-4-32k').addEventListener('mouseover', (event) => showCustomTooltip(modelDescriptions["gpt-4-32k"], event.currentTarget));
document.getElementById('model-gpt-4-turbo').addEventListener('mouseover', (event) => showCustomTooltip(modelDescriptions["gpt-4-turbo-preview"], event.currentTarget));
document.getElementById('model-gpt-4-turbo').addEventListener('mouseover', (event) => showCustomTooltip(modelDescriptions["gpt-4-turbo"], event.currentTarget));
document.getElementById('model-gpt-3.5').addEventListener('mouseover', (event) => showCustomTooltip(modelDescriptions["gpt-3.5-turbo-0125"], event.currentTarget));

// Event listeners for selecting Gemini models
Expand Down
4 changes: 2 additions & 2 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ let thread = null;
let response = '';
let initialize = true;
let messages;
let modelID = 'gpt-4-turbo-preview';
let modelID = 'gpt-4-turbo';

// Utility function to ensure Assistant and Thread initialization
async function AssistantAndThread(modelID, systemMessage) {
Expand Down Expand Up @@ -1062,7 +1062,7 @@ if (modelID === 'gpt-4') {

// top_p: 1, // Controls diversity via nucleus sampling: 0.5 means half of all likelihood-weighted options are considered.

max_tokens: 4000, // The maximum number of tokens to **generate** shared between the prompt and completion. The exact limit varies by model.
max_tokens: tokens, // The maximum number of tokens to **generate** shared between the prompt and completion. The exact limit varies by model.
// (One token is roughly 4 characters for standard English text)

// frequency_penalty: 0,
Expand Down

0 comments on commit c1c022a

Please sign in to comment.