Skip to content

Commit

Permalink
prefer spec dec
Browse files Browse the repository at this point in the history
  • Loading branch information
KTibow committed Nov 27, 2024
1 parent 364759c commit 2e12d3a
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/Chat.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,21 @@
export let groqKey: string;
const getModel = async () => {
if (localStorage.model) return localStorage.model;
const r = await fetch("https://api.groq.com/openai/v1/models", {
headers: {
Authorization: `Bearer ${groqKey}`,
},
});
const models = await r.json();
const model = models.data.find((m) => m.id == "llama-3.1-70b-specdec")
? "llama-3.1-70b-specdec"
: "llama-3.1-70b-versatile";
localStorage.model = model;
return model;
};
const generate = async (prompt: string) => {
conversation = [...conversation, { role: "user", content: prompt }];
const r = await fetch("https://api.groq.com/openai/v1/chat/completions", {
Expand All @@ -16,7 +31,7 @@
Authorization: `Bearer ${groqKey}`,
},
body: JSON.stringify({
model: "llama-3.1-70b-versatile",
model: await getModel(),
messages: conversation,
stream: true,
temperature: 0.7,
Expand Down

0 comments on commit 2e12d3a

Please sign in to comment.