diff --git a/.env.example b/.env.example index 99a07b0108..c40911743d 100644 --- a/.env.example +++ b/.env.example @@ -18,6 +18,7 @@ GOOGLE_GENERATIVE_AI_API_KEY= # Gemini API key ALI_BAILIAN_API_KEY= # Ali Bailian API Key VOLENGINE_API_KEY= # VolEngine API Key +NANOGPT_API_KEY= # NanoGPT API Key HYPERBOLIC_API_KEY= # Hyperbolic API Key HYPERBOLIC_MODEL= @@ -96,6 +97,11 @@ MEDIUM_GROQ_MODEL= # Default: llama-3.3-70b-versatile LARGE_GROQ_MODEL= # Default: llama-3.2-90b-vision-preview EMBEDDING_GROQ_MODEL= # Default: llama-3.1-8b-instant +# NanoGPT Configuration +SMALL_NANOGPT_MODEL= # Default: gpt-4o-mini +MEDIUM_NANOGPT_MODEL= # Default: gpt-4o +LARGE_NANOGPT_MODEL= # Default: gpt-4o + #LlamaLocal Configuration LLAMALOCAL_PATH= # Default: "" which is the current directory in plugin-node/dist/ which gets destroyed and recreated on every build diff --git a/agent/src/index.ts b/agent/src/index.ts index 683a7bcf2c..9e030d3557 100644 --- a/agent/src/index.ts +++ b/agent/src/index.ts @@ -270,6 +270,11 @@ export function getTokenForProvider( character.settings?.secrets?.VOLENGINE_API_KEY || settings.VOLENGINE_API_KEY ); + case ModelProviderName.NANOGPT: + return ( + character.settings?.secrets?.NANOGPT_API_KEY || + settings.NANOGPT_API_KEY + ); case ModelProviderName.HYPERBOLIC: return ( character.settings?.secrets?.HYPERBOLIC_API_KEY || diff --git a/packages/core/src/generation.ts b/packages/core/src/generation.ts index 404f45896f..12ef211a65 100644 --- a/packages/core/src/generation.ts +++ b/packages/core/src/generation.ts @@ -151,6 +151,7 @@ export async function generateText({ case ModelProviderName.ALI_BAILIAN: case ModelProviderName.VOLENGINE: case ModelProviderName.LLAMACLOUD: + case ModelProviderName.NANOGPT: case ModelProviderName.HYPERBOLIC: case ModelProviderName.TOGETHER: { elizaLogger.debug("Initializing OpenAI model."); @@ -1243,6 +1244,7 @@ export async function handleProvider( case ModelProviderName.VOLENGINE: case ModelProviderName.LLAMACLOUD: case ModelProviderName.TOGETHER: + case ModelProviderName.NANOGPT: return await handleOpenAI(options); case ModelProviderName.ANTHROPIC: return await handleAnthropic(options); diff --git a/packages/core/src/models.ts b/packages/core/src/models.ts index 7f397d280d..16fa6391a6 100644 --- a/packages/core/src/models.ts +++ b/packages/core/src/models.ts @@ -410,6 +410,22 @@ export const models: Models = { [ModelClass.EMBEDDING]: "doubao-embedding", }, }, + [ModelProviderName.NANOGPT]: { + endpoint: "https://nano-gpt.com/api/v1", + settings: { + stop: [], + maxInputTokens: 128000, + maxOutputTokens: 8192, + frequency_penalty: 0.0, + presence_penalty: 0.0, + temperature: 0.6, + }, + model: { + [ModelClass.SMALL]: settings.SMALL_NANOGPT_MODEL || "gpt-4o-mini", + [ModelClass.MEDIUM]: settings.MEDIUM_NANOGPT_MODEL || "gpt-4o", + [ModelClass.LARGE]: settings.LARGE_NANOGPT_MODEL || "gpt-4o", + } + }, [ModelProviderName.HYPERBOLIC]: { endpoint: "https://api.hyperbolic.xyz/v1", settings: { diff --git a/packages/core/src/types.ts b/packages/core/src/types.ts index 7bea050fb3..d29d0b9805 100644 --- a/packages/core/src/types.ts +++ b/packages/core/src/types.ts @@ -205,6 +205,7 @@ export type Models = { [ModelProviderName.GAIANET]: Model; [ModelProviderName.ALI_BAILIAN]: Model; [ModelProviderName.VOLENGINE]: Model; + [ModelProviderName.NANOGPT]: Model; [ModelProviderName.HYPERBOLIC]: Model; }; @@ -231,6 +232,7 @@ export enum ModelProviderName { GAIANET = "gaianet", ALI_BAILIAN = "ali_bailian", VOLENGINE = "volengine", + NANOGPT = "nanogpt", HYPERBOLIC = "hyperbolic", }