feat: add the community-funded Homarr assistant provider (#6563)
* Add Homarr provider proxy foundation * Complete Homarr provider integration * Harden Homarr provider integration * Address Homarr provider review feedback * Address CodeRabbit provider feedback * Localize provider errors * Handle provider activity load failures * docs: improve workshop and homepage * Harden Homarr provider limits * fix: harden the Homarr provider * fix: address provider review feedback * fix: clarify provider request accounting * feat: complete the Homarr provider endpoint * fix: terminate invalid provider streams
This commit is contained in:
1 parent
b8f360c04e
commit
45d8bc9443
77 files changed
+4035
-763
No files matched your search
@@ -5,13 +5,16 @@ import {
|
||||
buildEvaluationPrompt,
|
||||
buildJudgePrompt,
|
||||
buildRepairPrompt,
|
||||
DEFAULT_AI_PROVIDER_BASE_URL,
|
||||
DEFAULT_GENERATOR_MODEL,
|
||||
DEFAULT_JUDGE_MODEL,
|
||||
getAiProviderChatCompletionsUrl,
|
||||
getDeterministicEvaluationIssues,
|
||||
getEvaluationResponseFixtureText,
|
||||
getJudgeResponseFormat,
|
||||
judgePasses,
|
||||
parseJudgeResult,
|
||||
resolveAiEvaluationProviderConfig,
|
||||
} from "../../scripts/ai-evaluation";
|
||||
import type { CustomWidgetJudgeResult } from "../../scripts/ai-evaluation";
|
||||
|
||||
@@ -178,6 +181,51 @@ describe("AI authoring evaluation", () => {
|
||||
expect(format.json_schema.schema).toMatchObject({ type: "object", additionalProperties: false });
|
||||
});
|
||||
|
||||
it("can run the same evaluation against the Homarr provider endpoint", () => {
|
||||
expect(getAiProviderChatCompletionsUrl("https://homarr.dev/api/ai/v1/")).toBe(
|
||||
"https://homarr.dev/api/ai/v1/chat/completions",
|
||||
);
|
||||
expect(getAiProviderChatCompletionsUrl()).toBe("https://openrouter.ai/api/v1/chat/completions");
|
||||
expect(
|
||||
resolveAiEvaluationProviderConfig({
|
||||
AI_PROVIDER_BASE_URL: "https://homarr.dev/api/ai/v1/",
|
||||
AI_PROVIDER_API_KEY: "workshop-token",
|
||||
}),
|
||||
).toEqual({
|
||||
apiKey: "workshop-token",
|
||||
baseUrl: "https://homarr.dev/api/ai/v1",
|
||||
generatorModel: "homarr/model",
|
||||
judgeModel: "homarr/model",
|
||||
});
|
||||
expect(
|
||||
resolveAiEvaluationProviderConfig({
|
||||
AI_PROVIDER_BASE_URL: " ",
|
||||
OPENROUTER_API_KEY: "legacy-key",
|
||||
OPENROUTER_GENERATOR_MODEL: "legacy-generator",
|
||||
OPENROUTER_JUDGE_MODEL: "legacy-judge",
|
||||
}),
|
||||
).toEqual({
|
||||
apiKey: "legacy-key",
|
||||
baseUrl: DEFAULT_AI_PROVIDER_BASE_URL,
|
||||
generatorModel: "legacy-generator",
|
||||
judgeModel: "legacy-judge",
|
||||
});
|
||||
expect(
|
||||
resolveAiEvaluationProviderConfig({
|
||||
AI_PROVIDER_BASE_URL: "https://homarr.dev/api/ai/v1",
|
||||
AI_PROVIDER_API_KEY: "workshop-token",
|
||||
OPENROUTER_API_KEY: "must-not-leak",
|
||||
OPENROUTER_GENERATOR_MODEL: "must-not-apply",
|
||||
OPENROUTER_JUDGE_MODEL: "must-not-apply",
|
||||
}),
|
||||
).toEqual({
|
||||
apiKey: "workshop-token",
|
||||
baseUrl: "https://homarr.dev/api/ai/v1",
|
||||
generatorModel: "homarr/model",
|
||||
judgeModel: "homarr/model",
|
||||
});
|
||||
});
|
||||
|
||||
it("requires exceptional goal, design, practicality, and complexity scores", () => {
|
||||
expect(judgePasses(makeJudgeResult(90))).toBe(true);
|
||||
expect(
|
||||
|
||||
Reference in new issue
Block a user