mirror of
https://github.com/openclaw/openclaw.git
synced 2026-07-17 22:51:35 +00:00
fix(provider): satisfy Featherless release checks
This commit is contained in:
@@ -115,6 +115,29 @@ describe("featherless provider plugin", () => {
|
||||
});
|
||||
});
|
||||
|
||||
it("applies provider compat to configured models without overriding explicit values", async () => {
|
||||
const provider = await registerSingleProviderPlugin(featherlessPlugin);
|
||||
const normalized = provider.normalizeResolvedModel?.({
|
||||
provider: "featherless",
|
||||
modelId: "google/gemma-3-27b-it",
|
||||
model: {
|
||||
...createDefaultRuntimeModel(),
|
||||
id: "google/gemma-3-27b-it",
|
||||
name: "Gemma 3 27B",
|
||||
compat: {
|
||||
supportsStore: true,
|
||||
thinkingFormat: "deepseek",
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
expect(normalized?.compat).toMatchObject({
|
||||
...FEATHERLESS_DYNAMIC_COMPAT,
|
||||
supportsStore: true,
|
||||
thinkingFormat: "deepseek",
|
||||
});
|
||||
});
|
||||
|
||||
it("defers the curated model to static catalog resolution", async () => {
|
||||
const provider = await registerSingleProviderPlugin(featherlessPlugin);
|
||||
const resolved = provider.resolveDynamicModel?.(
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
// Featherless plugin entrypoint registers its OpenClaw integration.
|
||||
import type { ProviderResolveDynamicModelContext } from "openclaw/plugin-sdk/plugin-entry";
|
||||
import type {
|
||||
ProviderResolveDynamicModelContext,
|
||||
ProviderRuntimeModel,
|
||||
} from "openclaw/plugin-sdk/plugin-entry";
|
||||
import { readConfiguredProviderCatalogEntries } from "openclaw/plugin-sdk/provider-catalog-shared";
|
||||
import { defineSingleProviderPluginEntry } from "openclaw/plugin-sdk/provider-entry";
|
||||
import {
|
||||
@@ -58,6 +61,16 @@ function resolveFeatherlessDynamicModel(ctx: ProviderResolveDynamicModelContext)
|
||||
);
|
||||
}
|
||||
|
||||
function normalizeFeatherlessResolvedModel(model: ProviderRuntimeModel): ProviderRuntimeModel {
|
||||
return {
|
||||
...model,
|
||||
compat: {
|
||||
...FEATHERLESS_DYNAMIC_COMPAT,
|
||||
...model.compat,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
export default defineSingleProviderPluginEntry({
|
||||
id: PROVIDER_ID,
|
||||
name: "Featherless AI Provider",
|
||||
@@ -94,6 +107,7 @@ export default defineSingleProviderPluginEntry({
|
||||
config,
|
||||
providerId: PROVIDER_ID,
|
||||
}),
|
||||
normalizeResolvedModel: ({ model }) => normalizeFeatherlessResolvedModel(model),
|
||||
...buildProviderReplayFamilyHooks({
|
||||
family: "openai-compatible",
|
||||
dropReasoningFromHistory: false,
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
// Featherless model catalog helpers derive their values from the plugin manifest.
|
||||
import { buildManifestModelProviderConfig } from "openclaw/plugin-sdk/provider-catalog-shared";
|
||||
import type { ModelDefinitionConfig } from "openclaw/plugin-sdk/provider-model-shared";
|
||||
import type {
|
||||
ModelCompatConfig,
|
||||
ModelDefinitionConfig,
|
||||
} from "openclaw/plugin-sdk/provider-model-shared";
|
||||
import manifest from "./openclaw.plugin.json" with { type: "json" };
|
||||
|
||||
const FEATHERLESS_MANIFEST_PROVIDER = buildManifestModelProviderConfig({
|
||||
@@ -26,10 +29,10 @@ const FEATHERLESS_DEFAULT_MODEL = requireFeatherlessManifestModel(FEATHERLESS_DE
|
||||
|
||||
export const FEATHERLESS_DEFAULT_CONTEXT_WINDOW = FEATHERLESS_DEFAULT_MODEL.contextWindow;
|
||||
export const FEATHERLESS_DEFAULT_MAX_TOKENS = FEATHERLESS_DEFAULT_MODEL.maxTokens;
|
||||
export const FEATHERLESS_DYNAMIC_COMPAT = {
|
||||
export const FEATHERLESS_DYNAMIC_COMPAT: ModelCompatConfig = {
|
||||
...FEATHERLESS_DEFAULT_MODEL.compat,
|
||||
thinkingFormat: "openai",
|
||||
} as const;
|
||||
};
|
||||
|
||||
export function isFeatherlessCatalogModelId(modelId: string): boolean {
|
||||
return FEATHERLESS_MANIFEST_PROVIDER.models.some((model) => model.id === modelId);
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
"provider": "featherless",
|
||||
"method": "api-key",
|
||||
"choiceId": "featherless-api-key",
|
||||
"appGuidedSecret": true,
|
||||
"choiceLabel": "Featherless AI API key",
|
||||
"choiceHint": "OpenAI-compatible access to open models",
|
||||
"groupId": "featherless",
|
||||
|
||||
Reference in New Issue
Block a user