Skip to content
Snippets Groups Projects
Unverified Commit 55fc9cd6 authored by Sean Hatfield's avatar Sean Hatfield Committed by GitHub
Browse files

TogetherAI Llama 3.2 vision models support (#2666)


* togetherai llama 3.2 vision models support

* remove console log

* fix listing to reflect what is on the chart

---------

Co-authored-by: default avatartimothycarambat <rambat1010@gmail.com>
parent 5e698534
No related branches found
No related tags found
No related merge requests found
...@@ -40,6 +40,23 @@ class TogetherAiLLM { ...@@ -40,6 +40,23 @@ class TogetherAiLLM {
); );
} }
#generateContent({ userPrompt, attachments = [] }) {
if (!attachments.length) {
return userPrompt;
}
const content = [{ type: "text", text: userPrompt }];
for (let attachment of attachments) {
content.push({
type: "image_url",
image_url: {
url: attachment.contentString,
},
});
}
return content.flat();
}
allModelInformation() { allModelInformation() {
return togetherAiModels(); return togetherAiModels();
} }
...@@ -70,12 +87,20 @@ class TogetherAiLLM { ...@@ -70,12 +87,20 @@ class TogetherAiLLM {
contextTexts = [], contextTexts = [],
chatHistory = [], chatHistory = [],
userPrompt = "", userPrompt = "",
attachments = [],
}) { }) {
const prompt = { const prompt = {
role: "system", role: "system",
content: `${systemPrompt}${this.#appendContext(contextTexts)}`, content: `${systemPrompt}${this.#appendContext(contextTexts)}`,
}; };
return [prompt, ...chatHistory, { role: "user", content: userPrompt }]; return [
prompt,
...chatHistory,
{
role: "user",
content: this.#generateContent({ userPrompt, attachments }),
},
];
} }
async getChatCompletion(messages = null, { temperature = 0.7 }) { async getChatCompletion(messages = null, { temperature = 0.7 }) {
......
This diff is collapsed.
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
// copy outputs into the export in ../models.js // copy outputs into the export in ../models.js
// Update the date below if you run this again because TogetherAI added new models. // Update the date below if you run this again because TogetherAI added new models.
// Last Collected: Nov 18, 2024 // Last Collected: Nov 20, 2024
// Since last collection Together's docs are broken. I just copied the HTML table // Since last collection Together's docs are broken. I just copied the HTML table
// and had claude3 convert to markdown and it works well enough. // and had claude3 convert to markdown and it works well enough.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment