Skip to content

Commit

Permalink
Merge branch 'mistral-text-generation' into fishnu
Browse files Browse the repository at this point in the history
  • Loading branch information
brauliolomeli committed Jan 10, 2025
2 parents 4748f3c + a50c24f commit da99f55
Show file tree
Hide file tree
Showing 120 changed files with 12,716 additions and 4,998 deletions.
67 changes: 66 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,12 @@ MEDIUM_GOOGLE_MODEL= # Default: gemini-1.5-flash-latest
LARGE_GOOGLE_MODEL= # Default: gemini-1.5-pro-latest
EMBEDDING_GOOGLE_MODEL= # Default: text-embedding-004

# Mistral Configuration
MISTRAL_MODEL=
SMALL_MISTRAL_MODEL= # Default: mistral-small-latest
MEDIUM_MISTRAL_MODEL= # Default: mistral-large-latest
LARGE_MISTRAL_MODEL= # Default: mistral-large-latest

# Groq Configuration
GROQ_API_KEY= # Starts with gsk_
SMALL_GROQ_MODEL= # Default: llama-3.1-8b-instant
Expand Down Expand Up @@ -257,9 +263,12 @@ TOGETHER_API_KEY= # Together API Key
#### Crypto Plugin Configurations ####
######################################

# COIN DATA SOURCES
# CoinMarketCap / CMC
COINMARKETCAP_API_KEY=

# CoinGecko
COINGECKO_API_KEY=
COINGECKO_PRO_API_KEY=

# EVM
EVM_PRIVATE_KEY=
Expand Down Expand Up @@ -303,6 +312,10 @@ STARKNET_ADDRESS=
STARKNET_PRIVATE_KEY=
STARKNET_RPC_URL=

# Lens Network Configuration
LENS_ADDRESS=
LENS_PRIVATE_KEY=

# Coinbase
COINBASE_COMMERCE_KEY= # From Coinbase developer portal
COINBASE_API_KEY= # From Coinbase developer portal
Expand Down Expand Up @@ -438,6 +451,8 @@ GIPHY_API_KEY=
# OpenWeather
OPEN_WEATHER_API_KEY= # OpenWeather API key



# EchoChambers Configuration
ECHOCHAMBERS_API_URL=http://127.0.0.1:3333
ECHOCHAMBERS_API_KEY=testingkey0011
Expand Down Expand Up @@ -471,3 +486,53 @@ TAVILY_API_KEY=
# Verifiable Inference Configuration
VERIFIABLE_INFERENCE_ENABLED=false # Set to false to disable verifiable inference
VERIFIABLE_INFERENCE_PROVIDER=opacity # Options: opacity


# Autonome Configuration
AUTONOME_JWT_TOKEN=
AUTONOME_RPC=https://wizard-bff-rpc.alt.technology/v1/bff/aaa/apps

####################################
#### Akash Network Configuration ####
####################################
AKASH_ENV=mainnet
AKASH_NET=https://raw.githubusercontent.com/ovrclk/net/master/mainnet
RPC_ENDPOINT=https://rpc.akashnet.net:443
AKASH_GAS_PRICES=0.025uakt
AKASH_GAS_ADJUSTMENT=1.5
AKASH_KEYRING_BACKEND=os
AKASH_FROM=default
AKASH_FEES=20000uakt
AKASH_DEPOSIT=500000uakt
AKASH_MNEMONIC=
AKASH_WALLET_ADDRESS=
# Akash Pricing API
AKASH_PRICING_API_URL=https://console-api.akash.network/v1/pricing
# Default values # 1 CPU = 1000 1GB = 1000000000 1GB = 1000000000
AKASH_DEFAULT_CPU=1000
AKASH_DEFAULT_MEMORY=1000000000
AKASH_DEFAULT_STORAGE=1000000000
AKASH_SDL=example.sdl.yml
# Close deployment
# Close all deployments = closeAll
# Close a single deployment = dseq and add the value in AKASH_CLOSE_DSEQ
AKASH_CLOSE_DEP=closeAll
AKASH_CLOSE_DSEQ=19729929
# Provider Info we added one to check you will have to pass this into the action
AKASH_PROVIDER_INFO=akash1ccktptfkvdc67msasmesuy5m7gpc76z75kukpz
# Deployment Status
# AKASH_DEP_STATUS = dseq or param_passed when you are building you wil pass the dseq dinamically to test you
# you can pass the dseq using AKASH_DEP_DSEQ 19729929 is an example of a dseq we test while build.
AKASH_DEP_STATUS=dseq
AKASH_DEP_DSEQ=19729929
# Gas Estimation Options: close, create, or update
# qseq is required when operation is "close" 19729929 is an example of a dseq we test while build.
AKASH_GAS_OPERATION=close
AKASH_GAS_DSEQ=19729929
# Manifest
# Values: "auto" | "manual" | "validate_only" Default: "auto"
AKASH_MANIFEST_MODE=auto
# Default: Will use the SDL directory
AKASH_MANIFEST_PATH=
# Values: "strict" | "lenient" | "none" - Default: "strict"
AKASH_MANIFEST_VALIDATION_LEVEL=strict
15 changes: 6 additions & 9 deletions .github/workflows/integrationTests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ on:
push:
branches:
- "*"
pull_request_target:
pull_request:
branches:
- "*"

Expand Down Expand Up @@ -33,12 +33,9 @@ jobs:
- name: Build packages
run: pnpm build

- name: Check for API key
run: |
if [ -z "$OPENAI_API_KEY" ]; then
echo "Error: OPENAI_API_KEY is not set."
exit 1
fi
- name: Run integration tests
run: pnpm run integrationTests
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
COINBASE_COMMERCE_KEY: ${{ secrets.COINBASE_COMMERCE_KEY }}
run: |
pnpm run integrationTests
4 changes: 2 additions & 2 deletions .github/workflows/pnpm-lockfile-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Pnpm Lockfile Check

on:
pull_request:
branches: ["*"]
branches: [main]

jobs:
check-lockfile:
Expand Down Expand Up @@ -38,4 +38,4 @@ jobs:
owner: context.repo.owner,
repo: context.repo.repo,
body: '❌ The pnpm-lockfile is out of date. Please run `pnpm install --no-frozen-lockfile` and commit the updated pnpm-lock.yaml file.'
})
})
7 changes: 6 additions & 1 deletion agent/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"@elizaos/plugin-0g": "workspace:*",
"@elizaos/plugin-abstract": "workspace:*",
"@elizaos/plugin-aptos": "workspace:*",
"@elizaos/plugin-coingecko": "workspace:*",
"@elizaos/plugin-coinmarketcap": "workspace:*",
"@elizaos/plugin-coingecko": "workspace:*",
"@elizaos/plugin-binance": "workspace:*",
Expand All @@ -49,13 +50,15 @@
"@elizaos/plugin-gitbook": "workspace:*",
"@elizaos/plugin-story": "workspace:*",
"@elizaos/plugin-goat": "workspace:*",
"@elizaos/plugin-lensNetwork": "workspace:*",
"@elizaos/plugin-icp": "workspace:*",
"@elizaos/plugin-image-generation": "workspace:*",
"@elizaos/plugin-movement": "workspace:*",
"@elizaos/plugin-nft-generation": "workspace:*",
"@elizaos/plugin-node": "workspace:*",
"@elizaos/plugin-solana": "workspace:*",
"@elizaos/plugin-solana-agentkit": "workspace:*",
"@elizaos/plugin-autonome": "workspace:*",
"@elizaos/plugin-starknet": "workspace:*",
"@elizaos/plugin-stargaze": "workspace:*",
"@elizaos/plugin-giphy": "workspace:*",
Expand All @@ -73,6 +76,7 @@
"@elizaos/plugin-3d-generation": "workspace:*",
"@elizaos/plugin-fuel": "workspace:*",
"@elizaos/plugin-avalanche": "workspace:*",
"@elizaos/plugin-video-generation": "workspace:*",
"@elizaos/plugin-web-search": "workspace:*",
"@elizaos/plugin-letzai": "workspace:*",
"@elizaos/plugin-thirdweb": "workspace:*",
Expand All @@ -83,6 +87,7 @@
"@elizaos/plugin-arthera": "workspace:*",
"@elizaos/plugin-allora": "workspace:*",
"@elizaos/plugin-opacity": "workspace:*",
"@elizaos/plugin-akash": "workspace:*",
"readline": "1.3.0",
"ws": "8.18.0",
"yargs": "17.7.2"
Expand All @@ -94,4 +99,4 @@
"ts-node": "10.9.2",
"tsup": "8.3.5"
}
}
}
72 changes: 55 additions & 17 deletions agent/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,22 +64,25 @@ import { flowPlugin } from "@elizaos/plugin-flow";
import { fuelPlugin } from "@elizaos/plugin-fuel";
import { genLayerPlugin } from "@elizaos/plugin-genlayer";
import { imageGenerationPlugin } from "@elizaos/plugin-image-generation";
import { lensPlugin } from "@elizaos/plugin-lensNetwork";
import { multiversxPlugin } from "@elizaos/plugin-multiversx";
import { nearPlugin } from "@elizaos/plugin-near";
import { nftGenerationPlugin } from "@elizaos/plugin-nft-generation";
import { createNodePlugin } from "@elizaos/plugin-node";
import { obsidianPlugin } from "@elizaos/plugin-obsidian";
import { sgxPlugin } from "@elizaos/plugin-sgx";
import { solanaPlugin } from "@elizaos/plugin-solana";
import { solanaAgentkitPlguin } from "@elizaos/plugin-solana-agentkit";
import { autonomePlugin } from "@elizaos/plugin-autonome";
import { storyPlugin } from "@elizaos/plugin-story";
import { suiPlugin } from "@elizaos/plugin-sui";
import { sgxPlugin } from "@elizaos/plugin-sgx";
import { TEEMode, teePlugin } from "@elizaos/plugin-tee";
import { teeLogPlugin } from "@elizaos/plugin-tee-log";
import { teeMarlinPlugin } from "@elizaos/plugin-tee-marlin";
import { tonPlugin } from "@elizaos/plugin-ton";
import { webSearchPlugin } from "@elizaos/plugin-web-search";

import { coingeckoPlugin } from "@elizaos/plugin-coingecko";
import { giphyPlugin } from "@elizaos/plugin-giphy";
import { letzAIPlugin } from "@elizaos/plugin-letzai";
import { thirdwebPlugin } from "@elizaos/plugin-thirdweb";
Expand All @@ -89,6 +92,7 @@ import { zksyncEraPlugin } from "@elizaos/plugin-zksync-era";
import { OpacityAdapter } from "@elizaos/plugin-opacity";
import { openWeatherPlugin } from "@elizaos/plugin-open-weather";
import { stargazePlugin } from "@elizaos/plugin-stargaze";
import { akashPlugin } from "@elizaos/plugin-akash";
import Database from "better-sqlite3";
import fs from "fs";
import net from "net";
Expand Down Expand Up @@ -142,10 +146,6 @@ function tryLoadFile(filePath: string): string | null {
}
}

function isAllStrings(arr: unknown[]): boolean {
return Array.isArray(arr) && arr.every((item) => typeof item === "string");
}

export async function loadCharacters(
charactersArg: string
): Promise<Character[]> {
Expand Down Expand Up @@ -231,16 +231,9 @@ export async function loadCharacters(
}

// Handle plugins
if (isAllStrings(character.plugins)) {
elizaLogger.info("Plugins are: ", character.plugins);
const importedPlugins = await Promise.all(
character.plugins.map(async (plugin) => {
const importedPlugin = await import(plugin);
return importedPlugin.default;
})
);
character.plugins = importedPlugins;
}
character.plugins = await handlePluginImporting(
character.plugins
);

loadedCharacters.push(character);
elizaLogger.info(
Expand All @@ -263,6 +256,36 @@ export async function loadCharacters(
return loadedCharacters;
}

async function handlePluginImporting(plugins: string[]) {
if (plugins.length > 0) {
elizaLogger.info("Plugins are: ", plugins);
const importedPlugins = await Promise.all(
plugins.map(async (plugin) => {
try {
const importedPlugin = await import(plugin);
const functionName =
plugin
.replace("@elizaos/plugin-", "")
.replace(/-./g, (x) => x[1].toUpperCase()) +
"Plugin"; // Assumes plugin function is camelCased with Plugin suffix
return (
importedPlugin.default || importedPlugin[functionName]
);
} catch (importError) {
elizaLogger.error(
`Failed to import plugin: ${plugin}`,
importError
);
return []; // Return null for failed imports
}
})
);
return importedPlugins;
} else {
return [];
}
}

export function getTokenForProvider(
provider: ModelProviderName,
character: Character
Expand Down Expand Up @@ -623,6 +646,7 @@ export async function createAgent(
getSecret(character, "SOLANA_PRIVATE_KEY")
? solanaAgentkitPlguin
: null,
getSecret(character, "AUTONOME_JWT_TOKEN") ? autonomePlugin : null,
(getSecret(character, "NEAR_ADDRESS") ||
getSecret(character, "NEAR_WALLET_PUBLIC_KEY")) &&
getSecret(character, "NEAR_WALLET_SECRET_KEY")
Expand Down Expand Up @@ -684,7 +708,10 @@ export async function createAgent(
? webhookPlugin
: null,
goatPlugin,
getSecret(character, "COINGECKO_API_KEY") ? coingeckoPlugin : null,
getSecret(character, "COINGECKO_API_KEY") ||
getSecret(character, "COINGECKO_PRO_API_KEY")
? coingeckoPlugin
: null,
getSecret(character, "EVM_PROVIDER_URL") ? goatPlugin : null,
getSecret(character, "ABSTRACT_PRIVATE_KEY")
? abstractPlugin
Expand All @@ -697,6 +724,10 @@ export async function createAgent(
getSecret(character, "FLOW_PRIVATE_KEY")
? flowPlugin
: null,
getSecret(character, "LENS_ADDRESS") &&
getSecret(character, "LENS_PRIVATE_KEY")
? lensPlugin
: null,
getSecret(character, "APTOS_PRIVATE_KEY") ? aptosPlugin : null,
getSecret(character, "MVX_PRIVATE_KEY") ? multiversxPlugin : null,
getSecret(character, "ZKSYNC_PRIVATE_KEY") ? zksyncEraPlugin : null,
Expand Down Expand Up @@ -734,6 +765,10 @@ export async function createAgent(
? artheraPlugin
: null,
getSecret(character, "ALLORA_API_KEY") ? alloraPlugin : null,
getSecret(character, "AKASH_MNEMONIC") &&
getSecret(character, "AKASH_WALLET_ADDRESS")
? akashPlugin
: null,
].filter(Boolean),
providers: [],
actions: [],
Expand Down Expand Up @@ -923,7 +958,10 @@ const startAgents = async () => {
}

// upload some agent functionality into directClient
directClient.startAgent = async (character: Character) => {
directClient.startAgent = async (character) => {
// Handle plugins
character.plugins = await handlePluginImporting(character.plugins);

// wrap it so we don't have to inject directClient later
return startAgent(character, directClient);
};
Expand Down
1 change: 1 addition & 0 deletions docs/docs/advanced/fine-tuning.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ enum ModelProviderName {
LLAMACLOUD,
LLAMALOCAL,
GOOGLE,
MISTRAL,
REDPILL,
OPENROUTER,
HEURIST,
Expand Down
Loading

0 comments on commit da99f55

Please sign in to comment.