Skip to content

Commit 2a93d1d

Browse files
authored
Merge branch 'develop' into fix-plugin-import-error
2 parents af6fda3 + e1b7c80 commit 2a93d1d

17 files changed

+460
-26
lines changed

.env.example

+4
Original file line numberDiff line numberDiff line change
@@ -476,3 +476,7 @@ TAVILY_API_KEY=
476476
# Verifiable Inference Configuration
477477
VERIFIABLE_INFERENCE_ENABLED=false # Set to false to disable verifiable inference
478478
VERIFIABLE_INFERENCE_PROVIDER=opacity # Options: opacity
479+
480+
# Autonome Configuration
481+
AUTONOME_JWT_TOKEN=
482+
AUTONOME_RPC=https://wizard-bff-rpc.alt.technology/v1/bff/aaa/apps

agent/package.json

+2
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
"@elizaos/plugin-node": "workspace:*",
5858
"@elizaos/plugin-solana": "workspace:*",
5959
"@elizaos/plugin-solana-agentkit": "workspace:*",
60+
"@elizaos/plugin-autonome": "workspace:*",
6061
"@elizaos/plugin-starknet": "workspace:*",
6162
"@elizaos/plugin-stargaze": "workspace:*",
6263
"@elizaos/plugin-giphy": "workspace:*",
@@ -74,6 +75,7 @@
7475
"@elizaos/plugin-3d-generation": "workspace:*",
7576
"@elizaos/plugin-fuel": "workspace:*",
7677
"@elizaos/plugin-avalanche": "workspace:*",
78+
"@elizaos/plugin-video-generation": "workspace:*",
7779
"@elizaos/plugin-web-search": "workspace:*",
7880
"@elizaos/plugin-letzai": "workspace:*",
7981
"@elizaos/plugin-thirdweb": "workspace:*",

agent/src/index.ts

+36-5
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ import { obsidianPlugin } from "@elizaos/plugin-obsidian";
7171
import { sgxPlugin } from "@elizaos/plugin-sgx";
7272
import { solanaPlugin } from "@elizaos/plugin-solana";
7373
import { solanaAgentkitPlguin } from "@elizaos/plugin-solana-agentkit";
74+
import { autonomePlugin } from "@elizaos/plugin-autonome";
7475
import { storyPlugin } from "@elizaos/plugin-story";
7576
import { suiPlugin } from "@elizaos/plugin-sui";
7677
import { TEEMode, teePlugin } from "@elizaos/plugin-tee";
@@ -143,10 +144,6 @@ function tryLoadFile(filePath: string): string | null {
143144
}
144145
}
145146

146-
function isAllStrings(arr: unknown[]): boolean {
147-
return Array.isArray(arr) && arr.every((item) => typeof item === "string");
148-
}
149-
150147
export async function loadCharacters(
151148
charactersArg: string
152149
): Promise<Character[]> {
@@ -314,6 +311,36 @@ export async function loadCharacters(
314311
return loadedCharacters;
315312
}
316313

314+
async function handlePluginImporting(plugins: string[]) {
315+
if (plugins.length > 0) {
316+
elizaLogger.info("Plugins are: ", plugins);
317+
const importedPlugins = await Promise.all(
318+
plugins.map(async (plugin) => {
319+
try {
320+
const importedPlugin = await import(plugin);
321+
const functionName =
322+
plugin
323+
.replace("@elizaos/plugin-", "")
324+
.replace(/-./g, (x) => x[1].toUpperCase()) +
325+
"Plugin"; // Assumes plugin function is camelCased with Plugin suffix
326+
return (
327+
importedPlugin.default || importedPlugin[functionName]
328+
);
329+
} catch (importError) {
330+
elizaLogger.error(
331+
`Failed to import plugin: ${plugin}`,
332+
importError
333+
);
334+
return []; // Return null for failed imports
335+
}
336+
})
337+
);
338+
return importedPlugins;
339+
} else {
340+
return [];
341+
}
342+
}
343+
317344
export function getTokenForProvider(
318345
provider: ModelProviderName,
319346
character: Character
@@ -669,6 +696,7 @@ export async function createAgent(
669696
getSecret(character, "SOLANA_PRIVATE_KEY")
670697
? solanaAgentkitPlguin
671698
: null,
699+
getSecret(character, "AUTONOME_JWT_TOKEN") ? autonomePlugin : null,
672700
(getSecret(character, "NEAR_ADDRESS") ||
673701
getSecret(character, "NEAR_WALLET_PUBLIC_KEY")) &&
674702
getSecret(character, "NEAR_WALLET_SECRET_KEY")
@@ -972,7 +1000,10 @@ const startAgents = async () => {
9721000
}
9731001

9741002
// upload some agent functionality into directClient
975-
directClient.startAgent = async (character: Character) => {
1003+
directClient.startAgent = async (character) => {
1004+
// Handle plugins
1005+
character.plugins = await handlePluginImporting(character.plugins);
1006+
9761007
// wrap it so we don't have to inject directClient later
9771008
return startAgent(character, directClient);
9781009
};
+83
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
---
2+
sidebar_position: 18
3+
---
4+
5+
# 🪪 Verified Inference
6+
7+
## Overview
8+
9+
With verified inference, you can turn your Eliza agent fully verifiable on-chain on Solana with an OpenAI compatible TEE API. This proves that your agent’s thoughts and outputs are free from human control thus increasing the trust of the agent.
10+
11+
Compared to [fully deploying the agent in a TEE](https://elizaos.github.io/eliza/docs/advanced/eliza-in-tee/), this is a more light-weight solution which only verifies the inference calls and only needs a single line of code change.
12+
13+
The API supports all OpenAI models out of the box, including your fine-tuned models. The following guide will walk you through how to use verified inference API with Eliza.
14+
15+
## Background
16+
17+
The API is built on top of [Sentience Stack](https://github.com/galadriel-ai/Sentience), which cryptographically verifies agent's LLM inferences inside TEEs, posts those proofs on-chain on Solana, and makes the verified inference logs available to read and display to users.
18+
19+
Here’s how it works:
20+
![](https://i.imgur.com/SNwSHam.png)
21+
22+
1. The agent sends a request containing a message with the desired LLM model to the TEE.
23+
2. The TEE securely processes the request by calling the LLM API.
24+
3. The TEE sends back the `{Message, Proof}` to the agent.
25+
4. The TEE submits the attestation with `{Message, Proof}` to Solana.
26+
5. The Proof of Sentience SDK is used to read the attestation from Solana and verify it with `{Message, Proof}`. The proof log can be added to the agent website/app.
27+
28+
To verify the code running inside the TEE, use instructions [from here](https://github.com/galadriel-ai/sentience/tree/main/verified-inference/verify).
29+
30+
## Tutorial
31+
32+
1. **Create a free API key on [Galadriel dashboard](https://dashboard.galadriel.com/login)**
33+
2. **Configure the environment variables**
34+
```bash
35+
GALADRIEL_API_KEY=gal-* # Get from https://dashboard.galadriel.com/
36+
# Use any model supported by OpenAI
37+
SMALL_GALADRIEL_MODEL= # Default: gpt-4o-mini
38+
MEDIUM_GALADRIEL_MODEL= # Default: gpt-4o
39+
LARGE_GALADRIEL_MODEL= # Default: gpt-4o
40+
# If you wish to use a fine-tuned model you will need to provide your own OpenAI API key
41+
GALADRIEL_FINE_TUNE_API_KEY= # starting with sk-
42+
```
43+
3. **Configure your character to use `galadriel`**
44+
45+
In your character file set the `modelProvider` as `galadriel`.
46+
```
47+
"modelProvider": "galadriel"
48+
```
49+
4. **Run your agent.**
50+
51+
Reminder how to run an agent is [here](https://elizaos.github.io/eliza/docs/quickstart/#create-your-first-agent).
52+
```bash
53+
pnpm start --character="characters/<your_character>.json"
54+
pnpm start:client
55+
```
56+
5. **Get the history of all of your verified inference calls**
57+
```javascript
58+
const url = 'https://api.galadriel.com/v1/verified/chat/completions?limit=100&filter=mine';
59+
const headers = {
60+
'accept': 'application/json',
61+
'Authorization': 'Bearer <GALADRIEL_API_KEY>'// Replace with your Galadriel API key
62+
};
63+
64+
const response = await fetch(url, { method: 'GET', headers });
65+
const data = await response.json();
66+
console.log(data);
67+
```
68+
69+
Use this to build a verified logs terminal to your agent front end, for example:
70+
![](https://i.imgur.com/yejIlao.png)
71+
72+
6. **Check your inferences in the explorer.**
73+
74+
You can also see your inferences with proofs in the [Galadriel explorer](https://explorer.galadriel.com/). For specific inference responses use `https://explorer.galadriel.com/details/<hash>`
75+
76+
The `hash` param is returned with every inference request.
77+
![](https://i.imgur.com/QazDxbE.png)
78+
79+
7. **Check proofs posted on Solana.**
80+
81+
You can also see your inferences with proofs on Solana. For specific inference responses: `https://explorer.solana.com/tx/<>tx_hash?cluster=devnet`
82+
83+
The `tx_hash` param is returned with every inference request.

docs/docs/packages/clients.md

+15-15
Original file line numberDiff line numberDiff line change
@@ -35,31 +35,31 @@ graph TD
3535

3636
## Available Clients
3737

38-
- **Discord** (`@eliza/client-discord`) - Full Discord bot integration
39-
- **Twitter** (`@eliza/client-twitter`) - Twitter bot and interaction handling
40-
- **Telegram** (`@eliza/client-telegram`) - Telegram bot integration
41-
- **Direct** (`@eliza/client-direct`) - Direct API interface for custom integrations
42-
- **Auto** (`@eliza/client-auto`) - Automated trading and interaction client
38+
- **Discord** (`@elizaos/client-discord`) - Full Discord bot integration
39+
- **Twitter** (`@elizaos/client-twitter`) - Twitter bot and interaction handling
40+
- **Telegram** (`@elizaos/client-telegram`) - Telegram bot integration
41+
- **Direct** (`@elizaos/client-direct`) - Direct API interface for custom integrations
42+
- **Auto** (`@elizaos/client-auto`) - Automated trading and interaction client
4343

4444
---
4545

4646
## Installation
4747

4848
```bash
4949
# Discord
50-
pnpm add @eliza/client-discord
50+
pnpm add @elizaos/client-discord
5151

5252
# Twitter
53-
pnpm add @eliza/client-twitter
53+
pnpm add @elizaos/client-twitter
5454

5555
# Telegram
56-
pnpm add @eliza/client-telegram
56+
pnpm add @elizaos/client-telegram
5757

5858
# Direct API
59-
pnpm add @eliza/client-direct
59+
pnpm add @elizaos/client-direct
6060

6161
# Auto Client
62-
pnpm add @eliza/client-auto
62+
pnpm add @elizaos/client-auto
6363
```
6464

6565
---
@@ -71,7 +71,7 @@ The Discord client provides full integration with Discord's features including v
7171
### Basic Setup
7272

7373
```typescript
74-
import { DiscordClientInterface } from "@eliza/client-discord";
74+
import { DiscordClientInterface } from "@elizaos/client-discord";
7575

7676
// Initialize client
7777
const client = await DiscordClientInterface.start(runtime);
@@ -133,7 +133,7 @@ The Twitter client enables posting, searching, and interacting with Twitter user
133133
### Basic Setup
134134

135135
```typescript
136-
import { TwitterClientInterface } from "@eliza/client-twitter";
136+
import { TwitterClientInterface } from "@elizaos/client-twitter";
137137
// Initialize client
138138
const client = await TwitterClientInterface.start(runtime);
139139

@@ -192,7 +192,7 @@ The Telegram client provides messaging and bot functionality for Telegram.
192192
### Basic Setup
193193

194194
```typescript
195-
import { TelegramClientInterface } from "@eliza/client-telegram";
195+
import { TelegramClientInterface } from "@elizaos/client-telegram";
196196

197197
// Initialize client
198198
const client = await TelegramClientInterface.start(runtime);
@@ -225,7 +225,7 @@ The Direct client provides a REST API interface for custom integrations.
225225
### Basic Setup
226226

227227
```typescript
228-
import { DirectClientInterface } from "@eliza/client-direct";
228+
import { DirectClientInterface } from "@elizaos/client-direct";
229229

230230
// Initialize client
231231
const client = await DirectClientInterface.start(runtime);
@@ -258,7 +258,7 @@ The Auto client enables automated interactions and trading.
258258
### Basic Setup
259259

260260
```typescript
261-
import { AutoClientInterface } from "@eliza/client-auto";
261+
import { AutoClientInterface } from "@elizaos/client-auto";
262262

263263
// Initialize client
264264
const client = await AutoClientInterface.start(runtime);

docs/sidebars.js

+5
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,11 @@ const sidebars = {
117117
id: "advanced/eliza-in-tee",
118118
label: "Eliza in TEE",
119119
},
120+
{
121+
type: "doc",
122+
id: "advanced/verified-inference",
123+
label: "Verified Inference",
124+
},
120125
],
121126
},
122127
{

packages/client-telegram/src/messageManager.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,7 @@ export class MessageManager {
507507

508508
// Check if team member has direct interest first
509509
if (
510-
this.runtime.character.clientConfig?.discord?.isPartOfTeam &&
510+
this.runtime.character.clientConfig?.telegram?.isPartOfTeam &&
511511
!this._isTeamLeader() &&
512512
this._isRelevantToTeamMember(messageText, chatId)
513513
) {

packages/core/src/embedding.ts

+25-3
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ export const EmbeddingProvider = {
1818
OpenAI: "OpenAI",
1919
Ollama: "Ollama",
2020
GaiaNet: "GaiaNet",
21+
Heurist: "Heurist",
2122
BGE: "BGE",
2223
} as const;
2324

@@ -39,23 +40,30 @@ export const getEmbeddingConfig = (): EmbeddingConfig => ({
3940
: settings.USE_GAIANET_EMBEDDING?.toLowerCase() === "true"
4041
? getEmbeddingModelSettings(ModelProviderName.GAIANET)
4142
.dimensions
42-
: 384, // BGE
43+
: settings.USE_HEURIST_EMBEDDING?.toLowerCase() === "true"
44+
? getEmbeddingModelSettings(ModelProviderName.HEURIST)
45+
.dimensions
46+
: 384, // BGE
4347
model:
4448
settings.USE_OPENAI_EMBEDDING?.toLowerCase() === "true"
4549
? getEmbeddingModelSettings(ModelProviderName.OPENAI).name
4650
: settings.USE_OLLAMA_EMBEDDING?.toLowerCase() === "true"
4751
? getEmbeddingModelSettings(ModelProviderName.OLLAMA).name
4852
: settings.USE_GAIANET_EMBEDDING?.toLowerCase() === "true"
4953
? getEmbeddingModelSettings(ModelProviderName.GAIANET).name
50-
: "BGE-small-en-v1.5",
54+
: settings.USE_HEURIST_EMBEDDING?.toLowerCase() === "true"
55+
? getEmbeddingModelSettings(ModelProviderName.HEURIST).name
56+
: "BGE-small-en-v1.5",
5157
provider:
5258
settings.USE_OPENAI_EMBEDDING?.toLowerCase() === "true"
5359
? "OpenAI"
5460
: settings.USE_OLLAMA_EMBEDDING?.toLowerCase() === "true"
5561
? "Ollama"
5662
: settings.USE_GAIANET_EMBEDDING?.toLowerCase() === "true"
5763
? "GaiaNet"
58-
: "BGE",
64+
: settings.USE_HEURIST_EMBEDDING?.toLowerCase() === "true"
65+
? "Heurist"
66+
: "BGE",
5967
});
6068

6169
async function getRemoteEmbedding(
@@ -126,6 +134,7 @@ export function getEmbeddingType(runtime: IAgentRuntime): "local" | "remote" {
126134
isNode &&
127135
runtime.character.modelProvider !== ModelProviderName.OPENAI &&
128136
runtime.character.modelProvider !== ModelProviderName.GAIANET &&
137+
runtime.character.modelProvider !== ModelProviderName.HEURIST &&
129138
!settings.USE_OPENAI_EMBEDDING;
130139

131140
return isLocal ? "local" : "remote";
@@ -146,6 +155,10 @@ export function getEmbeddingZeroVector(): number[] {
146155
embeddingDimension = getEmbeddingModelSettings(
147156
ModelProviderName.GAIANET
148157
).dimensions; // GaiaNet dimension
158+
} else if (settings.USE_HEURIST_EMBEDDING?.toLowerCase() === "true") {
159+
embeddingDimension = getEmbeddingModelSettings(
160+
ModelProviderName.HEURIST
161+
).dimensions; // Heurist dimension
149162
}
150163

151164
return Array(embeddingDimension).fill(0);
@@ -229,6 +242,15 @@ export async function embed(runtime: IAgentRuntime, input: string) {
229242
});
230243
}
231244

245+
if (config.provider === EmbeddingProvider.Heurist) {
246+
return await getRemoteEmbedding(input, {
247+
model: config.model,
248+
endpoint: getEndpoint(ModelProviderName.HEURIST),
249+
apiKey: runtime.token,
250+
dimensions: config.dimensions,
251+
});
252+
}
253+
232254
// BGE - try local first if in Node
233255
if (isNode) {
234256
try {

packages/core/src/models.ts

+6-2
Original file line numberDiff line numberDiff line change
@@ -545,17 +545,21 @@ export const models: Models = {
545545
[ModelClass.LARGE]: {
546546
name:
547547
settings.LARGE_HEURIST_MODEL ||
548-
"meta-llama/llama-3.1-405b-instruct",
548+
"meta-llama/llama-3.3-70b-instruct",
549549
stop: [],
550550
maxInputTokens: 128000,
551551
maxOutputTokens: 8192,
552552
repetition_penalty: 0.4,
553553
temperature: 0.7,
554554
},
555555
[ModelClass.IMAGE]: {
556-
name: settings.HEURIST_IMAGE_MODEL || "PepeXL",
556+
name: settings.HEURIST_IMAGE_MODEL || "FLUX.1-dev",
557557
steps: 20,
558558
},
559+
[ModelClass.EMBEDDING]: {
560+
name: "BAAI/bge-large-en-v1.5",
561+
dimensions: 1024,
562+
},
559563
},
560564
},
561565
[ModelProviderName.GALADRIEL]: {

0 commit comments

Comments
 (0)