From 623cc42010bae14f9f324d4459c953cdb7433ffa Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Fri, 15 Dec 2023 10:54:14 -0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Mistral=20API=20provider?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/llm/llms/Mistral.ts | 3 ++- core/llm/llms/index.ts | 2 ++ core/llm/test/llm.test.ts | 21 ++++++++++++--------- 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/core/llm/llms/Mistral.ts b/core/llm/llms/Mistral.ts index f07ab5263..9543ae58e 100644 --- a/core/llm/llms/Mistral.ts +++ b/core/llm/llms/Mistral.ts @@ -4,7 +4,8 @@ import OpenAI from "./OpenAI"; class Mistral extends OpenAI { static providerName: ModelProvider = "mistral"; static defaultOptions: Partial = { - apiBase: "https://api.mistral.ai/v1", + apiBase: "https://api.mistral.ai", + model: "mistral-small", }; } diff --git a/core/llm/llms/index.ts b/core/llm/llms/index.ts index 3cbc722b0..f341f1bbc 100644 --- a/core/llm/llms/index.ts +++ b/core/llm/llms/index.ts @@ -10,6 +10,7 @@ import HuggingFaceTGI from "./HuggingFaceTGI"; import LMStudio from "./LMStudio"; import LlamaCpp from "./LlamaCpp"; import Llamafile from "./Llamafile"; +import Mistral from "./Mistral"; import Ollama from "./Ollama"; import OpenAI from "./OpenAI"; import Replicate from "./Replicate"; @@ -32,6 +33,7 @@ const LLMs = [ OpenAI, LMStudio, Gemini, + Mistral, ]; export function llmFromDescription( diff --git a/core/llm/test/llm.test.ts b/core/llm/test/llm.test.ts index 439ddde82..7ef18c3d5 100644 --- a/core/llm/test/llm.test.ts +++ b/core/llm/test/llm.test.ts @@ -2,7 +2,7 @@ // import { BaseLLM } from ".."; // import { CompletionOptions } from "../.."; -// import GooglePalm from "../llms/GooglePalm"; +// import Mistral from "../llms/Mistral"; // jest.setTimeout(100_000); @@ -27,7 +27,7 @@ // test("Stream Chat works", async () => { // let total = ""; // for await (const chunk of llm.streamChat([ -// { role: "user", content: "Hello" }, +// { role: "user", content: "Tell a story" }, // ])) { // total += chunk.content; // } @@ -94,14 +94,17 @@ // // // testLLM(new TextGenWebUI({ model: "codellama-7b" })); // // // testLLM(new HuggingFaceTGI({ model: "codellama-7b" })); // // // testLLM(new HuggingFaceInferenceAPI({ model: "codellama-7b" })); -// testLLM( -// new GooglePalm({ -// model: "gemini-pro", -// // model: "chat-bison-001", -// apiKey: process.env.GOOGLE_PALM_API_KEY, -// }) -// ); +// // testLLM( +// // new GooglePalm({ +// // model: "gemini-pro", +// // // model: "chat-bison-001", +// // apiKey: process.env.GOOGLE_PALM_API_KEY, +// // }) +// // ); // // testLLM( // // new Gemini({ model: "gemini-pro", apiKey: process.env.GOOGLE_PALM_API_KEY }) // // ); +// testLLM( +// new Mistral({ apiKey: process.env.MISTRAL_API_KEY, model: "mistral-small" }) +// ); // });