Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions packages/tasks/src/local-apps.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,4 +125,19 @@ curl -X POST "http://localhost:8000/v1/chat/completions" \\

expect(snippet).toEqual(`docker model run hf.co/bartowski/Llama-3.2-3B-Instruct-GGUF:{{QUANT_TAG}}`);
});

it("nexa-sdk", async () => {
const { snippet: snippetFunc } = LOCAL_APPS["nexa-sdk"];
const model: ModelData = {
id: "NexaAI/OmniNeural-4B",
tags: [],
inference: "",
};
const snippet = snippetFunc(model);

expect(snippet.length).toBe(8);
expect(snippet[0].content).toBe(
`nexa infer NexaAI/OmniNeural-4B --prompt "NexaAI embraces HuggingFace and open source."`
);
});
});
48 changes: 48 additions & 0 deletions packages/tasks/src/local-apps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,42 @@ const snippetLemonade = (model: ModelData, filepath?: string): LocalAppSnippet[]
];
};

const snippetNexaSdk = (model: ModelData): LocalAppSnippet[] => {
const command = `nexa infer ${model.id} --prompt "NexaAI embraces HuggingFace and open source."`;
const releaseUrl = "https://github.com/NexaAI/nexa-sdk/releases/latest";

const downloadSetup = (filename: string) => `# Download installer from:\n# ${releaseUrl}/download/${filename}`;
const curlSetup = (arch: string) =>
`curl -fsSL ${releaseUrl}/download/nexa-cli_linux_${arch}.sh -o install.sh && chmod +x install.sh && ./install.sh && rm install.sh`;

const platformConfigs = [
{ title: "Install on Windows (x86_64)", filename: "nexa-cli_windows_x86_64.exe" },
{ title: "Install on Windows (x86_64 CUDA)", filename: "nexa-cli_windows_x86_64_cuda.exe" },
{ title: "Install on Windows (arm64)", filename: "nexa-cli_windows_arm64.exe" },
{ title: "Install on macOS (arm64)", filename: "nexa-cli_macos_arm64.pkg" },
{ title: "Install on macOS (x86_64)", filename: "nexa-cli_macos_x86_64.pkg" },
];

const platforms: LocalAppSnippet[] = [
...platformConfigs.map(({ title, filename }) => ({ title, setup: downloadSetup(filename), content: command })),
{ title: "Install on Linux (x86_64)", setup: curlSetup("x86_64"), content: command },
{ title: "Install on Linux (arm64)", setup: curlSetup("arm64"), content: command },
];

return [
...platforms,
{
title: "OpenAI-compatible Server Mode",
content: [
"# Start OpenAI-compatible server:",
"nexa serve --host 127.0.0.1:8080",
"",
"# Open the Swagger UI at: http://localhost:8080/docs/ui",
].join("\n"),
},
];
};

/**
* Add your new local app here.
*
Expand Down Expand Up @@ -545,6 +581,18 @@ export const LOCAL_APPS = {
displayOnModelPage: (model) => isLlamaCppGgufModel(model) || isAmdRyzenModel(model),
snippet: snippetLemonade,
},
"nexa-sdk": {
prettyLabel: "Nexa SDK",
docsUrl: "https://docs.nexa.ai/",
mainTask: "text-generation",
displayOnModelPage: (model) =>
(model.id.startsWith("NexaAI/") || isLlamaCppGgufModel(model) || isMlxModel(model) || isAmdRyzenModel(model)) &&
(model.pipeline_tag === "text-generation" ||
model.pipeline_tag === "text-to-speech" ||
model.pipeline_tag === "automatic-speech-recognition" ||
model.pipeline_tag === "text-to-image"),
snippet: snippetNexaSdk,
},
} satisfies Record<string, LocalApp>;

export type LocalAppKey = keyof typeof LOCAL_APPS;