Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
505 changes: 0 additions & 505 deletions packages/core/script/generate-friendli.ts

This file was deleted.

23 changes: 20 additions & 3 deletions packages/core/src/sync/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { deepinfra } from "./providers/deepinfra.js";
import { digitalocean } from "./providers/digitalocean.js";
import { edenai } from "./providers/edenai.js";
import { empiriolabs } from "./providers/empiriolabs.js";
import { friendli } from "./providers/friendli.js";
import { githubCopilot } from "./providers/github-copilot.js";
import { google } from "./providers/google.js";
import { hyper } from "./providers/hyper.js";
Expand Down Expand Up @@ -96,6 +97,12 @@ export interface SyncProvider<SourceModel> {
* undefined to skip silently (no notice, no missing-model issue).
*/
sourceID?(model: SourceModel): string | undefined;
/**
* Return the ID when a source model skipped by translateModel needs a
* missing-model issue. Existing local metadata for that ID is preserved.
* Return undefined for intentional skips.
*/
missingModelID?(model: SourceModel): string | undefined;
skippedNotice?(ids: string[]): string[];
fetchModels(): Promise<unknown>;
parseModels(raw: unknown): SourceModel[];
Expand Down Expand Up @@ -143,6 +150,7 @@ export const providers: {
digitalocean: SyncProvider<any>;
edenai: SyncProvider<any>;
empiriolabs: SyncProvider<any>;
friendli: SyncProvider<any>;
"github-copilot": SyncProvider<any>;
google: SyncProvider<any>;
hyper: SyncProvider<any>;
Expand Down Expand Up @@ -179,6 +187,7 @@ export const providers: {
digitalocean,
edenai,
empiriolabs,
friendli,
"github-copilot": githubCopilot,
google,
hyper,
Expand Down Expand Up @@ -222,7 +231,7 @@ export const groups = {
"vercel",
],
cloudflare: ["cloudflare-ai-gateway", "cloudflare-workers-ai"],
direct: ["ambient", "anthropic", "baseten", "chutes", "cortecs", "deepinfra", "digitalocean", "github-copilot", "google", "hyper", "meta", "ollama-cloud", "openai", "ovhcloud", "pioneer", "tinfoil", "venice", "wandb", "xai"],
direct: ["ambient", "anthropic", "baseten", "chutes", "cortecs", "deepinfra", "digitalocean", "friendli", "github-copilot", "google", "hyper", "meta", "ollama-cloud", "openai", "ovhcloud", "pioneer", "tinfoil", "venice", "wandb", "xai"],
} as const;

type ProviderID = keyof typeof providers;
Expand Down Expand Up @@ -255,6 +264,7 @@ export async function syncProvider<SourceModel>(
const caseNormalizedDesiredPaths = new Map<string, string>();
const desiredMetadata = new Map<string, { model: z.infer<typeof ModelMetadata>; content: string }>();
const skippedRemote: string[] = [];
const missingRemote = new Set<string>();
const missingReasoning = new Map<string, string>();

for (const sourceModel of sourceModels) {
Expand All @@ -277,6 +287,8 @@ export async function syncProvider<SourceModel>(
if (translated === undefined) {
const skippedID = provider.sourceID?.(sourceModel);
if (skippedID !== undefined) skippedRemote.push(skippedID);
const missingID = provider.missingModelID?.(sourceModel);
if (missingID !== undefined) missingRemote.add(missingID);
continue;
}

Expand Down Expand Up @@ -456,6 +468,10 @@ export async function syncProvider<SourceModel>(
const missingLocal: string[] = [];
for (const relativePath of new Set([...existing.keys(), ...brokenSymlinks])) {
if (desired.has(relativePath)) continue;
if (missingRemote.has(relativePath.slice(0, -5))) {
unchanged++;
continue;
}
if (missingReasoning.has(relativePath.slice(0, -5))) {
unchanged++;
continue;
Expand Down Expand Up @@ -487,10 +503,11 @@ export async function syncProvider<SourceModel>(
...provider.missingNotice?.(missingLocal) ?? [],
];

const issueModels = [
const issueModels = [...new Set([
...missingRemote.values(),
...(provider.skipCreates === true ? skippedRemote : []),
...missingReasoning.keys(),
];
])];
if (
provider.trackMissingModels !== false
&& issueModels.length > 0
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/sync/missing-issues.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function issueBody(provider: MissingModelIssueTarget, modelId: string, reason?:
`| Expected path | \`${provider.modelsDir}/${modelId}.toml\` |`,
"",
reason === undefined
? "This provider uses `skipCreates` because the remote source is not enough to auto-author a full TOML."
? "Automatic creation was skipped because the remote source is not enough to auto-author a complete catalog entry."
: `Sync diagnostic: ${reason}`,
"Add the model manually (prefer `base_model` when matching `models/` metadata exists).",
...(reason === undefined ? [] : [
Expand Down
Loading
Loading