diff --git a/packages/tasks/src/local-apps.spec.ts b/packages/tasks/src/local-apps.spec.ts index 534efbbc88..3a059a966d 100644 --- a/packages/tasks/src/local-apps.spec.ts +++ b/packages/tasks/src/local-apps.spec.ts @@ -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."` + ); + }); }); diff --git a/packages/tasks/src/local-apps.ts b/packages/tasks/src/local-apps.ts index 7f9aeb6c43..fffdf8eb29 100644 --- a/packages/tasks/src/local-apps.ts +++ b/packages/tasks/src/local-apps.ts @@ -361,6 +361,10 @@ const snippetLemonade = (model: ModelData, filepath?: string): LocalAppSnippet[] ]; }; +const snippetNexaSdk = (model: ModelData): string => { + return `nexa infer ${model.id}`; +}; + /** * Add your new local app here. * @@ -545,6 +549,31 @@ 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) => { + const supportedPipelineTags = new Set([ + "text-generation", + "text-to-speech", + "automatic-speech-recognition", + "image-text-to-text", + "audio-text-to-text", + "text-ranking", + "text-to-image", + "image-classification", + "object-detection", + ]); + return ( + model.id.startsWith("NexaAI/") || + ((isLlamaCppGgufModel(model) || isMlxModel(model) || isAmdRyzenModel(model)) && + model.pipeline_tag !== undefined && + supportedPipelineTags.has(model.pipeline_tag)) + ); + }, + snippet: snippetNexaSdk, + }, } satisfies Record; export type LocalAppKey = keyof typeof LOCAL_APPS;