Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: FereAI integration and ferePro plugin update #1566

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
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
4 changes: 4 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -356,3 +356,7 @@ CRONOSZKEVM_PRIVATE_KEY=

# Fuel Ecosystem (FuelVM)
FUEL_WALLET_PRIVATE_KEY=

# FereAI Configuration
FEREAI_USER_ID=
FEREAI_API_KEY=
1 change: 1 addition & 0 deletions agent/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
"@elizaos/plugin-3d-generation": "workspace:*",
"@elizaos/plugin-fuel": "workspace:*",
"@elizaos/plugin-avalanche": "workspace:*",
"@elizaos/plugin-ferepro": "workspace:*",
"readline": "1.3.0",
"ws": "8.18.0",
"yargs": "17.7.2"
Expand Down
10 changes: 10 additions & 0 deletions agent/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ import { zksyncEraPlugin } from "@elizaos/plugin-zksync-era";
import { cronosZkEVMPlugin } from "@elizaos/plugin-cronoszkevm";
import { abstractPlugin } from "@elizaos/plugin-abstract";
import { avalanchePlugin } from "@elizaos/plugin-avalanche";
import { fereProPlugin } from "@elizaos/plugin-ferepro";
import Database from "better-sqlite3";
import fs from "fs";
import path from "path";
Expand Down Expand Up @@ -346,6 +347,13 @@ export function getTokenForProvider(
character.settings?.secrets?.GOOGLE_GENERATIVE_AI_API_KEY ||
settings.GOOGLE_GENERATIVE_AI_API_KEY
);
case ModelProviderName.FEREAI:
return (
character.settings?.secrets?.FEREAI_API_KEY ||
settings.FEREAI_API_KEY &&
character.settings?.secrets?.FEREAI_USER_ID ||
settings.FEREAI_USER_ID
);
default:
const errorMessage = `Failed to get token - unsupported model provider: ${provider}`;
elizaLogger.error(errorMessage);
Expand Down Expand Up @@ -600,6 +608,8 @@ export async function createAgent(
getSecret(character, "AVALANCHE_PRIVATE_KEY")
? avalanchePlugin
: null,
getSecret(character, "FEREAI_USER_ID") ? fereProPlugin : null,
getSecret(character, "FEREAI_API_KEY") ? fereProPlugin : null,
sekmet marked this conversation as resolved.
Show resolved Hide resolved
].filter(Boolean),
providers: [],
actions: [],
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
"@vitest/eslint-plugin": "1.0.1",
"amqplib": "0.10.5",
"csv-parse": "5.6.0",
"fereai-provider": "0.1.2",
"ollama-ai-provider": "0.16.1",
"optional": "0.1.4",
"pnpm": "9.14.4",
Expand Down
1 change: 1 addition & 0 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
"anthropic-vertex-ai": "1.0.2",
"fastembed": "1.14.1",
"fastestsmallesttextencoderdecoder": "1.0.22",
"fereai-provider": "0.1.2",
"gaxios": "6.7.1",
"glob": "11.0.0",
"handlebars": "^4.7.8",
Expand Down
21 changes: 21 additions & 0 deletions packages/core/src/generation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
} from "ai";
import { Buffer } from "buffer";
import { createOllama } from "ollama-ai-provider";
import { fereai } from "fereai-provider";
import OpenAI from "openai";
import { encodingForModel, TiktokenModel } from "js-tiktoken";
import Together from "together-ai";
Expand Down Expand Up @@ -571,6 +572,26 @@ export async function generateText({
break;
}

case ModelProviderName.FEREAI:
{
elizaLogger.debug("Initializing FereAI model.");

elizaLogger.debug("****** MODEL\n", model);

const { text: fereaiResponse } = await aiGenerateText({
model: fereai(model),
prompt: context,
temperature: temperature,
maxTokens: max_response_length,
frequencyPenalty: frequency_penalty,
presencePenalty: presence_penalty,
});

response = fereaiResponse;
}
elizaLogger.debug("Received response from FereAI model:", model);
break;

default: {
const errorMessage = `Unsupported provider: ${provider}`;
elizaLogger.error(errorMessage);
Expand Down
13 changes: 13 additions & 0 deletions packages/core/src/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,19 @@ export const models: Models = {
[ModelClass.IMAGE]: settings.LIVEPEER_IMAGE_MODEL || "ByteDance/SDXL-Lightning",
},
},
[ModelProviderName.FEREAI]: {
settings: {
stop: [],
maxInputTokens: 128000,
maxOutputTokens: 8192,
temperature: 0.7,
},
model: {
[ModelClass.SMALL]: "MarketAnalyzerAgent",
[ModelClass.MEDIUM]: "ProAgent",
[ModelClass.LARGE]: "ProAgent"
},
},
};

export function getModel(provider: ModelProviderName, type: ModelClass) {
Expand Down
2 changes: 2 additions & 0 deletions packages/core/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ export type Models = {
[ModelProviderName.VENICE]: Model;
[ModelProviderName.AKASH_CHAT_API]: Model;
[ModelProviderName.LIVEPEER]: Model;
[ModelProviderName.FEREAI]: Model;
};

/**
Expand Down Expand Up @@ -240,6 +241,7 @@ export enum ModelProviderName {
VENICE = "venice",
AKASH_CHAT_API = "akash_chat_api",
LIVEPEER = "livepeer",
FEREAI = "fereai",
}

/**
Expand Down
150 changes: 0 additions & 150 deletions packages/plugin-ferePro/src/actions/FereProAction.ts

This file was deleted.

15 changes: 0 additions & 15 deletions packages/plugin-ferePro/src/index.ts

This file was deleted.

Loading
Loading