Add Together AI model catalog and improve discovery formatting
This commit is contained in:
parent
90e1c4f801
commit
f4745aa5e6
@ -13,7 +13,11 @@ import {
|
|||||||
SYNTHETIC_MODEL_CATALOG,
|
SYNTHETIC_MODEL_CATALOG,
|
||||||
} from "./synthetic-models.js";
|
} from "./synthetic-models.js";
|
||||||
import { discoverVeniceModels, VENICE_BASE_URL } from "./venice-models.js";
|
import { discoverVeniceModels, VENICE_BASE_URL } from "./venice-models.js";
|
||||||
import { discoverTogetherModels, TOGETHER_BASE_URL } from "./together-models.js";
|
import {
|
||||||
|
discoverTogetherModels,
|
||||||
|
TOGETHER_BASE_URL,
|
||||||
|
TOGETHER_MODEL_CATALOG,
|
||||||
|
} from "./together-models.js";
|
||||||
|
|
||||||
type ModelsConfig = NonNullable<ClawdbotConfig["models"]>;
|
type ModelsConfig = NonNullable<ClawdbotConfig["models"]>;
|
||||||
export type ProviderConfig = NonNullable<ModelsConfig["providers"]>[string];
|
export type ProviderConfig = NonNullable<ModelsConfig["providers"]>[string];
|
||||||
@ -362,7 +366,7 @@ async function buildOllamaProvider(): Promise<ProviderConfig> {
|
|||||||
|
|
||||||
async function buildTogetherProvider(apiKey?: string): Promise<ProviderConfig> {
|
async function buildTogetherProvider(apiKey?: string): Promise<ProviderConfig> {
|
||||||
// Only discover models if we have an API key, otherwise use static catalog
|
// Only discover models if we have an API key, otherwise use static catalog
|
||||||
const models = apiKey ? await discoverTogetherModels(apiKey) : [];
|
const models = apiKey ? await discoverTogetherModels(apiKey) : TOGETHER_MODEL_CATALOG;
|
||||||
|
|
||||||
// If we successfully discovered models, return them and let the merge logic handle conflicts
|
// If we successfully discovered models, return them and let the merge logic handle conflicts
|
||||||
// If discovery failed, return empty array to fallback to static catalog
|
// If discovery failed, return empty array to fallback to static catalog
|
||||||
@ -399,7 +403,10 @@ export async function resolveImplicitProviders(params: {
|
|||||||
resolveEnvApiKeyVarName("kimi-code") ??
|
resolveEnvApiKeyVarName("kimi-code") ??
|
||||||
resolveApiKeyFromProfiles({ provider: "kimi-code", store: authStore });
|
resolveApiKeyFromProfiles({ provider: "kimi-code", store: authStore });
|
||||||
if (kimiCodeKey) {
|
if (kimiCodeKey) {
|
||||||
providers["kimi-code"] = { ...buildKimiCodeProvider(), apiKey: kimiCodeKey };
|
providers["kimi-code"] = {
|
||||||
|
...buildKimiCodeProvider(),
|
||||||
|
apiKey: kimiCodeKey,
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
const syntheticKey =
|
const syntheticKey =
|
||||||
@ -436,7 +443,10 @@ export async function resolveImplicitProviders(params: {
|
|||||||
resolveEnvApiKeyVarName("together") ??
|
resolveEnvApiKeyVarName("together") ??
|
||||||
resolveApiKeyFromProfiles({ provider: "together", store: authStore });
|
resolveApiKeyFromProfiles({ provider: "together", store: authStore });
|
||||||
if (togetherKey) {
|
if (togetherKey) {
|
||||||
providers.together = { ...(await buildTogetherProvider(togetherKey)), apiKey: togetherKey };
|
providers.together = {
|
||||||
|
...(await buildTogetherProvider(togetherKey)),
|
||||||
|
apiKey: togetherKey,
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
return providers;
|
return providers;
|
||||||
@ -447,7 +457,9 @@ export async function resolveImplicitCopilotProvider(params: {
|
|||||||
env?: NodeJS.ProcessEnv;
|
env?: NodeJS.ProcessEnv;
|
||||||
}): Promise<ProviderConfig | null> {
|
}): Promise<ProviderConfig | null> {
|
||||||
const env = params.env ?? process.env;
|
const env = params.env ?? process.env;
|
||||||
const authStore = ensureAuthProfileStore(params.agentDir, { allowKeychainPrompt: false });
|
const authStore = ensureAuthProfileStore(params.agentDir, {
|
||||||
|
allowKeychainPrompt: false,
|
||||||
|
});
|
||||||
const hasProfile = listProfilesForProvider(authStore, "github-copilot").length > 0;
|
const hasProfile = listProfilesForProvider(authStore, "github-copilot").length > 0;
|
||||||
const envToken = env.COPILOT_GITHUB_TOKEN ?? env.GH_TOKEN ?? env.GITHUB_TOKEN;
|
const envToken = env.COPILOT_GITHUB_TOKEN ?? env.GH_TOKEN ?? env.GITHUB_TOKEN;
|
||||||
const githubToken = (envToken ?? "").trim();
|
const githubToken = (envToken ?? "").trim();
|
||||||
@ -512,7 +524,10 @@ export async function resolveImplicitBedrockProvider(params: {
|
|||||||
if (enabled !== true && !hasAwsCreds) return null;
|
if (enabled !== true && !hasAwsCreds) return null;
|
||||||
|
|
||||||
const region = discoveryConfig?.region ?? env.AWS_REGION ?? env.AWS_DEFAULT_REGION ?? "us-east-1";
|
const region = discoveryConfig?.region ?? env.AWS_REGION ?? env.AWS_DEFAULT_REGION ?? "us-east-1";
|
||||||
const models = await discoverBedrockModels({ region, config: discoveryConfig });
|
const models = await discoverBedrockModels({
|
||||||
|
region,
|
||||||
|
config: discoveryConfig,
|
||||||
|
});
|
||||||
if (models.length === 0) return null;
|
if (models.length === 0) return null;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|||||||
@ -11,7 +11,7 @@ export const TOGETHER_DEFAULT_COST = {
|
|||||||
cacheWrite: 0.5,
|
cacheWrite: 0.5,
|
||||||
};
|
};
|
||||||
|
|
||||||
export const TOGETHER_MODEL_CATALOG = [
|
export const TOGETHER_MODEL_CATALOG: ModelDefinitionConfig[] = [
|
||||||
{
|
{
|
||||||
id: "zai-org/GLM-4.7",
|
id: "zai-org/GLM-4.7",
|
||||||
name: "GLM 4.7 Fp8",
|
name: "GLM 4.7 Fp8",
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user