Skip to content

Commit

Permalink
models
Browse files Browse the repository at this point in the history
  • Loading branch information
Zaki-1052 committed May 31, 2024
1 parent 78352a4 commit 58519ae
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 15 deletions.
5 changes: 3 additions & 2 deletions public/portal.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
<button id="model-gemini-pro" data-value="gemini-pro">Gemini Pro</button>
<button id="model-claude-sonnet" data-value="claude-3-sonnet-20240229">Claude Sonnet</button>
<button id="model-claude-haiku" data-value="claude-3-haiku-20240307">Claude Haiku</button>
<button id="model-mistral-large" data-value="mistral-large-latest">Mistral Large</button>
<button id="model-llama-70b" data-value="llama3-70b-8192">Llama3 70b</button>
<button id="model-mistral-large" data-value="mistral-large-latest">Mistral Large</button>
<button id="model-gemini-1.5-pro" data-value="gemini-1.5-pro-latest">Gemini-1.5 Pro</button>
<button id="model-gemini-1.5-flash" data-value="gemini-1.5-flash-latest">Gemini-1.5 Flash</button>
<button id="model-gemini-pro-vision" data-value="gemini-pro-vision">Gemini Pro Vision</button>
Expand All @@ -33,12 +33,13 @@
<button id="model-codestral" data-value="codestral-latest">Codestral</button>
<button id="model-mistral-small" data-value="mistral-small-latest">Mistral Small</button>
<button id="model-mistral-medium" data-value="mistral-medium-latest">Mistral Medium</button>
<button id="model-mistral-8x7b" data-value="open-mixtral-8x7b">Mixtral 8x7b</button>
<button id="model-qroq-mistral-8x7b" data-value="mixtral-8x7b-32768">Free Mixtral 8x7b</button>
<button id="model-mistral-8x22b" data-value="open-mixtral-8x22b">Mixtral 8x22b</button>
<button id="model-mistral-tiny" data-value="open-mistral-7b">Mistral Tiny</button>
<button id="model-claude-1.2" data-value="claude-instant-1.2">Claude 1.2</button>
<button id="model-claude-2.0" data-value="claude-2.0">Claude 2.0</button>
<button id="model-claude-2.1" data-value="claude-2.1">Claude 2.1</button>
<button id="model-mistral-8x7b" data-value="open-mixtral-8x7b">Mixtral 8x7b</button>
<button id="model-gpt-4-32k" data-value="gpt-4-32k">GPT-4-32k</button>
<button id="model-gemini-ultra" data-value="gemini-1.0-ultra">Gemini Ultra</button>
<!-- Add other models as options -->
Expand Down
4 changes: 4 additions & 0 deletions public/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ fetchConfig();
"Llama3-8b": "llama3-8b-8192",
"Gemma-7b": "gemma-7b-it",
"Codestral": "codestral-latest",
"Free Mixtral 8x7b": "mixtral-8x7b-32768",
// Open Router Models
"OpenRouter Auto": "openrouter/auto",
"Nous: Capybara 7B (free)": "nousresearch/nous-capybara-7b:free",
Expand Down Expand Up @@ -216,6 +217,7 @@ fetchConfig();
"llama3-8b-8192": "Llama3-8b",
"gemma-7b-it": "Gemma-7b",
"codestral-latest": "Codestral",
"mixtral-8x7b-32768": "Free Mixtral 8x7b",
// Open Router Models
"openrouter/auto": "OpenRouter Auto",
"nousresearch/nous-capybara-7b:free": "Nous: Capybara 7B (free)",
Expand Down Expand Up @@ -671,6 +673,8 @@ document.getElementById('model-gemma-it').addEventListener('click', () => select
document.getElementById('model-gemma-it').addEventListener('mouseover', (event) => showCustomTooltip(modelDescriptions["gemma-7b-it"], event.currentTarget));
document.getElementById('model-codestral').addEventListener('click', () => selectModel('codestral-latest'));
document.getElementById('model-codestral').addEventListener('mouseover', (event) => showCustomTooltip(modelDescriptions["codestral-latest"], event.currentTarget));
document.getElementById('model-qroq-mistral-8x7b').addEventListener('click', () => selectModel('mixtral-8x7b-32768'));
document.getElementById('model-qroq-mistral-8x7b').addEventListener('mouseover', (event) => showCustomTooltip(modelDescriptions["mixtral-8x7b-32768"], event.currentTarget));


// select open router models lol
Expand Down
26 changes: 13 additions & 13 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -1181,13 +1181,25 @@ if (modelID === 'gpt-4') {

// Define the headers with the Authorization and, if needed, Organization
// Determine the API to use based on modelID prefix
if (modelID.startsWith('gpt')) {
if (modelID.includes('/')) {
conversationHistory.push(user_input);
headers = {
'Authorization': `Bearer ${process.env.OPENROUTER_API_KEY}`,
};
apiUrl = 'https://openrouter.ai/api/v1/chat/completions';
} else if (modelID.startsWith('gpt')) {
conversationHistory.push(user_input);
headers = {
'Authorization': `Bearer ${process.env.OPENAI_API_KEY}`,
// 'OpenAI-Organization': 'process.env.ORGANIZATION' // Uncomment if using an organization ID
};
apiUrl = 'https://api.openai.com/v1/chat/completions';
} else if (modelID.startsWith('llama') || modelID.startsWith('gemma') || modelID === 'mixtral-8x7b-32768') {
conversationHistory.push(user_input);
headers = {
'Authorization': `Bearer ${process.env.QROQ_API_KEY}`,
};
apiUrl = 'https://api.groq.com/openai/v1/chat/completions';
} else if (modelID.includes('mistral') || modelID.includes('mixtral')) {
conversationHistory.push(user_input);
headers = {
Expand Down Expand Up @@ -1219,18 +1231,6 @@ if (modelID === 'gpt-4') {
// Add any Mistral-specific headers here if necessary
};
apiUrl = 'https://api.anthropic.com/v1/messages';
} else if (modelID.startsWith('llama') || modelID.startsWith('gemma')) {
conversationHistory.push(user_input);
headers = {
'Authorization': `Bearer ${process.env.QROQ_API_KEY}`,
};
apiUrl = 'https://api.groq.com/openai/v1/chat/completions';
} else if (modelID.includes('/')) {
conversationHistory.push(user_input);
headers = {
'Authorization': `Bearer ${process.env.OPENROUTER_API_KEY}`,
};
apiUrl = 'https://openrouter.ai/api/v1/chat/completions';
}

// Log the data payload just before sending it to the chosen API
Expand Down

0 comments on commit 58519ae

Please sign in to comment.