Skip to content

Commit

Permalink
added codestral
Browse files Browse the repository at this point in the history
  • Loading branch information
Zaki-1052 committed May 31, 2024
1 parent 9d56781 commit 78352a4
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 1 deletion.
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ MISTRAL_API_KEY=your_mistral_ai_key_here
CLAUDE_API_KEY=your_anthropic_ai_key_here
QROQ_API_KEY=your_qroq_ai_key_here
OPENROUTER_API_KEY=your_openrouter_ai_key_here
CODESTRAL_API_KEY=your_codestral_ai_key_here


# Uncomment (remove the '#') from the following lines
Expand Down
1 change: 1 addition & 0 deletions public/portal.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
<button id="model-gemini-pro-vision" data-value="gemini-pro-vision">Gemini Pro Vision</button>
<button id="model-llama-8b" data-value="llama3-8b-8192">Llama3 8b</button>
<button id="model-gemma-it" data-value="gemma-7b-it">Gemma 7B</button>
<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>
Expand Down
5 changes: 5 additions & 0 deletions public/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ fetchConfig();
"Llama3-70b": "llama3-70b-8192",
"Llama3-8b": "llama3-8b-8192",
"Gemma-7b": "gemma-7b-it",
"Codestral": "codestral-latest",
// Open Router Models
"OpenRouter Auto": "openrouter/auto",
"Nous: Capybara 7B (free)": "nousresearch/nous-capybara-7b:free",
Expand Down Expand Up @@ -214,6 +215,7 @@ fetchConfig();
"llama3-70b-8192": "Llama3-70b",
"llama3-8b-8192": "Llama3-8b",
"gemma-7b-it": "Gemma-7b",
"codestral-latest": "Codestral",
// Open Router Models
"openrouter/auto": "OpenRouter Auto",
"nousresearch/nous-capybara-7b:free": "Nous: Capybara 7B (free)",
Expand Down Expand Up @@ -667,6 +669,9 @@ document.getElementById('model-llama-8b').addEventListener('mouseover', (event)
// gemma it via qroq
document.getElementById('model-gemma-it').addEventListener('click', () => selectModel('gemma-7b-it'));
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));


// select open router models lol

Expand Down
9 changes: 8 additions & 1 deletion server.js
Original file line number Diff line number Diff line change
Expand Up @@ -1128,7 +1128,7 @@ if (modelID === 'gpt-4') {

messages: conversationHistory, // Includes the System Prompt, previous queries and responses, and your most recently sent message.

temperature: 1, // Controls randomness: Lowering results in less random completions.
temperature: 0.8, // Controls randomness: Lowering results in less random completions.
// As the temperature approaches zero, the model will become deterministic and repetitive.

// top_p: 1, // Controls diversity via nucleus sampling: 0.5 means half of all likelihood-weighted options are considered.
Expand Down Expand Up @@ -1195,6 +1195,13 @@ if (modelID === 'gpt-4') {
// Add any Mistral-specific headers here if necessary
};
apiUrl = 'https://api.mistral.ai/v1/chat/completions';
} else if (modelID === 'codestral-latest') {
conversationHistory.push(user_input);
headers = {
'Authorization': `Bearer ${process.env.CODESTRAL_API_KEY}`,
// Add any Mistral-specific headers here if necessary
};
apiUrl = 'https://codestral.mistral.ai/v1/chat/completions';
} else if (modelID.startsWith('claude')) {
claudeHistory.push(user_input);
data = {
Expand Down

0 comments on commit 78352a4

Please sign in to comment.