add LlamaStack as new model
This commit is contained in:
parent
e760f7ab75
commit
a378350b7d
3 changed files with 61 additions and 3 deletions
57
core/llm/llms/LlamaStack.ts
Normal file
57
core/llm/llms/LlamaStack.ts
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
import { streamSse } from "@continuedev/fetch";
|
||||
import { CompletionOptions, LLMOptions } from "../../index.js";
|
||||
import { osModelsEditPrompt } from "../templates/edit.js";
|
||||
|
||||
import OpenAI from "./OpenAI.js";
|
||||
|
||||
class LlamaStack extends OpenAI {
|
||||
static providerName = "llamastack";
|
||||
static defaultOptions: Partial<LLMOptions> = {
|
||||
apiBase: "http://localhost:8321/v1/openai/v1/",
|
||||
model: "meta-llama/Llama-4-Maverick-17B-128E-Instruct-FP8",
|
||||
promptTemplates: {
|
||||
edit: osModelsEditPrompt,
|
||||
},
|
||||
useLegacyCompletionsEndpoint: false,
|
||||
};
|
||||
maxStopWords: number | undefined = 16;
|
||||
|
||||
supportsFim(): boolean {
|
||||
return true;
|
||||
}
|
||||
|
||||
async *_streamFim(
|
||||
prefix: string,
|
||||
suffix: string,
|
||||
signal: AbortSignal,
|
||||
options: CompletionOptions,
|
||||
): AsyncGenerator<string> {
|
||||
const endpoint = new URL("completions", this.apiBase);
|
||||
const resp = await this.fetch(endpoint, {
|
||||
method: "POST",
|
||||
body: JSON.stringify({
|
||||
model: options.model,
|
||||
prompt: prefix,
|
||||
suffix,
|
||||
max_tokens: options.maxTokens,
|
||||
temperature: options.temperature,
|
||||
top_p: options.topP,
|
||||
frequency_penalty: options.frequencyPenalty,
|
||||
presence_penalty: options.presencePenalty,
|
||||
stop: options.stop,
|
||||
stream: true,
|
||||
}),
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
Accept: "application/json",
|
||||
Authorization: `Bearer ${this.apiKey}`,
|
||||
},
|
||||
signal,
|
||||
});
|
||||
for await (const chunk of streamSse(resp)) {
|
||||
yield chunk.choices[0].text;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export default Deepseek;
|
||||
|
|
@ -33,6 +33,7 @@ import Inception from "./Inception";
|
|||
import Kindo from "./Kindo";
|
||||
import LlamaCpp from "./LlamaCpp";
|
||||
import Llamafile from "./Llamafile";
|
||||
import LlamaStack from "./LlamaStack";
|
||||
import LMStudio from "./LMStudio";
|
||||
import Mistral from "./Mistral";
|
||||
import MockLLM from "./Mock";
|
||||
|
|
@ -62,7 +63,6 @@ import Vllm from "./Vllm";
|
|||
import Voyage from "./Voyage";
|
||||
import WatsonX from "./WatsonX";
|
||||
import xAI from "./xAI";
|
||||
|
||||
export const LLMClasses = [
|
||||
Anthropic,
|
||||
Cohere,
|
||||
|
|
@ -116,6 +116,7 @@ export const LLMClasses = [
|
|||
Relace,
|
||||
Inception,
|
||||
Voyage,
|
||||
LlamaStack,
|
||||
];
|
||||
|
||||
export async function llmFromDescription(
|
||||
|
|
|
|||
4
extensions/vscode/package-lock.json
generated
4
extensions/vscode/package-lock.json
generated
|
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "continue",
|
||||
"version": "1.1.47",
|
||||
"version": "1.1.48",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "continue",
|
||||
"version": "1.1.47",
|
||||
"version": "1.1.48",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@continuedev/config-types": "^1.0.14",
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue