@elizaos/core 0.1.7 → 0.1.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -109,42 +109,52 @@ declare enum ModelClass {
109
109
  EMBEDDING = "embedding",
110
110
  IMAGE = "image"
111
111
  }
112
+ /**
113
+ * Model settings
114
+ */
115
+ type ModelSettings$1 = {
116
+ /** Model name */
117
+ name: string;
118
+ /** Maximum input tokens */
119
+ maxInputTokens: number;
120
+ /** Maximum output tokens */
121
+ maxOutputTokens: number;
122
+ /** Optional frequency penalty */
123
+ frequency_penalty?: number;
124
+ /** Optional presence penalty */
125
+ presence_penalty?: number;
126
+ /** Optional repetition penalty */
127
+ repetition_penalty?: number;
128
+ /** Stop sequences */
129
+ stop: string[];
130
+ /** Temperature setting */
131
+ temperature: number;
132
+ /** Optional telemetry configuration (experimental) */
133
+ experimental_telemetry?: TelemetrySettings;
134
+ };
135
+ /** Image model settings */
136
+ type ImageModelSettings = {
137
+ name: string;
138
+ steps?: number;
139
+ };
140
+ /** Embedding model settings */
141
+ type EmbeddingModelSettings = {
142
+ name: string;
143
+ dimensions?: number;
144
+ };
112
145
  /**
113
146
  * Configuration for an AI model
114
147
  */
115
148
  type Model = {
116
149
  /** Optional API endpoint */
117
150
  endpoint?: string;
118
- /** Model settings */
119
- settings: {
120
- /** Maximum input tokens */
121
- maxInputTokens: number;
122
- /** Maximum output tokens */
123
- maxOutputTokens: number;
124
- /** Optional frequency penalty */
125
- frequency_penalty?: number;
126
- /** Optional presence penalty */
127
- presence_penalty?: number;
128
- /** Optional repetition penalty */
129
- repetition_penalty?: number;
130
- /** Stop sequences */
131
- stop: string[];
132
- /** Temperature setting */
133
- temperature: number;
134
- /** Optional telemetry configuration (experimental) */
135
- experimental_telemetry?: TelemetrySettings;
136
- };
137
- /** Optional image generation settings */
138
- imageSettings?: {
139
- steps?: number;
140
- };
141
151
  /** Model names by size class */
142
152
  model: {
143
- [ModelClass.SMALL]: string;
144
- [ModelClass.MEDIUM]: string;
145
- [ModelClass.LARGE]: string;
146
- [ModelClass.EMBEDDING]?: string;
147
- [ModelClass.IMAGE]?: string;
153
+ [ModelClass.SMALL]?: ModelSettings$1;
154
+ [ModelClass.MEDIUM]?: ModelSettings$1;
155
+ [ModelClass.LARGE]?: ModelSettings$1;
156
+ [ModelClass.EMBEDDING]?: EmbeddingModelSettings;
157
+ [ModelClass.IMAGE]?: ImageModelSettings;
148
158
  };
149
159
  };
150
160
  /**
@@ -160,6 +170,7 @@ type Models = {
160
170
  [ModelProviderName.TOGETHER]: Model;
161
171
  [ModelProviderName.LLAMALOCAL]: Model;
162
172
  [ModelProviderName.GOOGLE]: Model;
173
+ [ModelProviderName.MISTRAL]: Model;
163
174
  [ModelProviderName.CLAUDE_VERTEX]: Model;
164
175
  [ModelProviderName.REDPILL]: Model;
165
176
  [ModelProviderName.OPENROUTER]: Model;
@@ -173,8 +184,11 @@ type Models = {
173
184
  [ModelProviderName.NANOGPT]: Model;
174
185
  [ModelProviderName.HYPERBOLIC]: Model;
175
186
  [ModelProviderName.VENICE]: Model;
187
+ [ModelProviderName.NINETEEN_AI]: Model;
176
188
  [ModelProviderName.AKASH_CHAT_API]: Model;
177
189
  [ModelProviderName.LIVEPEER]: Model;
190
+ [ModelProviderName.DEEPSEEK]: Model;
191
+ [ModelProviderName.INFERA]: Model;
178
192
  };
179
193
  /**
180
194
  * Available model providers
@@ -189,6 +203,7 @@ declare enum ModelProviderName {
189
203
  TOGETHER = "together",
190
204
  LLAMALOCAL = "llama_local",
191
205
  GOOGLE = "google",
206
+ MISTRAL = "mistral",
192
207
  CLAUDE_VERTEX = "claude_vertex",
193
208
  REDPILL = "redpill",
194
209
  OPENROUTER = "openrouter",
@@ -202,8 +217,12 @@ declare enum ModelProviderName {
202
217
  NANOGPT = "nanogpt",
203
218
  HYPERBOLIC = "hyperbolic",
204
219
  VENICE = "venice",
220
+ NINETEEN_AI = "nineteen_ai",
205
221
  AKASH_CHAT_API = "akash_chat_api",
206
- LIVEPEER = "livepeer"
222
+ LIVEPEER = "livepeer",
223
+ LETZAI = "letzai",
224
+ DEEPSEEK = "deepseek",
225
+ INFERA = "infera"
207
226
  }
208
227
  /**
209
228
  * Represents the current state/context of a conversation
@@ -261,6 +280,8 @@ interface State {
261
280
  knowledge?: string;
262
281
  /** Optional knowledge data */
263
282
  knowledgeData?: KnowledgeItem[];
283
+ /** Optional knowledge data */
284
+ ragKnowledgeData?: RAGKnowledgeItem[];
264
285
  /** Additional dynamic properties */
265
286
  [key: string]: unknown;
266
287
  }
@@ -480,7 +501,8 @@ declare enum Clients {
480
501
  FARCASTER = "farcaster",
481
502
  LENS = "lens",
482
503
  AUTO = "auto",
483
- SLACK = "slack"
504
+ SLACK = "slack",
505
+ GITHUB = "github"
484
506
  }
485
507
  interface IAgentConfig {
486
508
  [key: string]: string;
@@ -517,6 +539,9 @@ interface ModelConfiguration {
517
539
  maxInputTokens?: number;
518
540
  experimental_telemetry?: TelemetrySettings;
519
541
  }
542
+ type TemplateType = string | ((options: {
543
+ state: State;
544
+ }) => string);
520
545
  /**
521
546
  * Configuration for an agent character
522
547
  */
@@ -539,30 +564,30 @@ type Character = {
539
564
  modelEndpointOverride?: string;
540
565
  /** Optional prompt templates */
541
566
  templates?: {
542
- goalsTemplate?: string;
543
- factsTemplate?: string;
544
- messageHandlerTemplate?: string;
545
- shouldRespondTemplate?: string;
546
- continueMessageHandlerTemplate?: string;
547
- evaluationTemplate?: string;
548
- twitterSearchTemplate?: string;
549
- twitterActionTemplate?: string;
550
- twitterPostTemplate?: string;
551
- twitterMessageHandlerTemplate?: string;
552
- twitterShouldRespondTemplate?: string;
553
- farcasterPostTemplate?: string;
554
- lensPostTemplate?: string;
555
- farcasterMessageHandlerTemplate?: string;
556
- lensMessageHandlerTemplate?: string;
557
- farcasterShouldRespondTemplate?: string;
558
- lensShouldRespondTemplate?: string;
559
- telegramMessageHandlerTemplate?: string;
560
- telegramShouldRespondTemplate?: string;
561
- discordVoiceHandlerTemplate?: string;
562
- discordShouldRespondTemplate?: string;
563
- discordMessageHandlerTemplate?: string;
564
- slackMessageHandlerTemplate?: string;
565
- slackShouldRespondTemplate?: string;
567
+ goalsTemplate?: TemplateType;
568
+ factsTemplate?: TemplateType;
569
+ messageHandlerTemplate?: TemplateType;
570
+ shouldRespondTemplate?: TemplateType;
571
+ continueMessageHandlerTemplate?: TemplateType;
572
+ evaluationTemplate?: TemplateType;
573
+ twitterSearchTemplate?: TemplateType;
574
+ twitterActionTemplate?: TemplateType;
575
+ twitterPostTemplate?: TemplateType;
576
+ twitterMessageHandlerTemplate?: TemplateType;
577
+ twitterShouldRespondTemplate?: TemplateType;
578
+ farcasterPostTemplate?: TemplateType;
579
+ lensPostTemplate?: TemplateType;
580
+ farcasterMessageHandlerTemplate?: TemplateType;
581
+ lensMessageHandlerTemplate?: TemplateType;
582
+ farcasterShouldRespondTemplate?: TemplateType;
583
+ lensShouldRespondTemplate?: TemplateType;
584
+ telegramMessageHandlerTemplate?: TemplateType;
585
+ telegramShouldRespondTemplate?: TemplateType;
586
+ discordVoiceHandlerTemplate?: TemplateType;
587
+ discordShouldRespondTemplate?: TemplateType;
588
+ discordMessageHandlerTemplate?: TemplateType;
589
+ slackMessageHandlerTemplate?: TemplateType;
590
+ slackShouldRespondTemplate?: TemplateType;
566
591
  };
567
592
  /** Character biography */
568
593
  bio: string | string[];
@@ -577,7 +602,10 @@ type Character = {
577
602
  /** Character traits */
578
603
  adjectives: string[];
579
604
  /** Optional knowledge base */
580
- knowledge?: string[];
605
+ knowledge?: (string | {
606
+ path: string;
607
+ shared?: boolean;
608
+ })[];
581
609
  /** Supported client platforms */
582
610
  clients: Clients[];
583
611
  /** Available plugins */
@@ -623,6 +651,7 @@ type Character = {
623
651
  [key: string]: any[];
624
652
  };
625
653
  transcription?: TranscriptionProvider;
654
+ ragKnowledge?: boolean;
626
655
  };
627
656
  /** Optional client-specific config */
628
657
  clientConfig?: {
@@ -678,6 +707,8 @@ type Character = {
678
707
  nft?: {
679
708
  prompt: string;
680
709
  };
710
+ /**Optinal Parent characters to inherit information from */
711
+ extends?: string[];
681
712
  };
682
713
  /**
683
714
  * Interface for database operations
@@ -708,6 +739,7 @@ interface IDatabaseAdapter {
708
739
  tableName: string;
709
740
  agentId: UUID;
710
741
  roomIds: UUID[];
742
+ limit?: number;
711
743
  }): Promise<Memory[]>;
712
744
  getCachedEmbeddings(params: {
713
745
  query_table_name: string;
@@ -789,6 +821,23 @@ interface IDatabaseAdapter {
789
821
  getRelationships(params: {
790
822
  userId: UUID;
791
823
  }): Promise<Relationship[]>;
824
+ getKnowledge(params: {
825
+ id?: UUID;
826
+ agentId: UUID;
827
+ limit?: number;
828
+ query?: string;
829
+ conversationContext?: string;
830
+ }): Promise<RAGKnowledgeItem[]>;
831
+ searchKnowledge(params: {
832
+ agentId: UUID;
833
+ embedding: Float32Array;
834
+ match_threshold: number;
835
+ match_count: number;
836
+ searchText?: string;
837
+ }): Promise<RAGKnowledgeItem[]>;
838
+ createKnowledge(knowledge: RAGKnowledgeItem): Promise<void>;
839
+ removeKnowledge(id: UUID): Promise<void>;
840
+ clearKnowledge(agentId: UUID, shared?: boolean): Promise<void>;
792
841
  }
793
842
  interface IDatabaseCacheAdapter {
794
843
  getCache(params: {
@@ -824,6 +873,7 @@ interface IMemoryManager {
824
873
  getMemoryById(id: UUID): Promise<Memory | null>;
825
874
  getMemoriesByRoomIds(params: {
826
875
  roomIds: UUID[];
876
+ limit?: number;
827
877
  }): Promise<Memory[]>;
828
878
  searchMemoriesByEmbedding(embedding: number[], opts: {
829
879
  match_threshold?: number;
@@ -836,6 +886,33 @@ interface IMemoryManager {
836
886
  removeAllMemories(roomId: UUID): Promise<void>;
837
887
  countMemories(roomId: UUID, unique?: boolean): Promise<number>;
838
888
  }
889
+ interface IRAGKnowledgeManager {
890
+ runtime: IAgentRuntime;
891
+ tableName: string;
892
+ getKnowledge(params: {
893
+ query?: string;
894
+ id?: UUID;
895
+ limit?: number;
896
+ conversationContext?: string;
897
+ agentId?: UUID;
898
+ }): Promise<RAGKnowledgeItem[]>;
899
+ createKnowledge(item: RAGKnowledgeItem): Promise<void>;
900
+ removeKnowledge(id: UUID): Promise<void>;
901
+ searchKnowledge(params: {
902
+ agentId: UUID;
903
+ embedding: Float32Array | number[];
904
+ match_threshold?: number;
905
+ match_count?: number;
906
+ searchText?: string;
907
+ }): Promise<RAGKnowledgeItem[]>;
908
+ clearKnowledge(shared?: boolean): Promise<void>;
909
+ processFile(file: {
910
+ path: string;
911
+ content: string;
912
+ type: "pdf" | "md" | "txt";
913
+ isShared: boolean;
914
+ }): Promise<void>;
915
+ }
839
916
  type CacheOptions = {
840
917
  expires?: number;
841
918
  };
@@ -874,10 +951,12 @@ interface IAgentRuntime {
874
951
  descriptionManager: IMemoryManager;
875
952
  documentsManager: IMemoryManager;
876
953
  knowledgeManager: IMemoryManager;
954
+ ragKnowledgeManager: IRAGKnowledgeManager;
877
955
  loreManager: IMemoryManager;
878
956
  cacheManager: ICacheManager;
879
957
  services: Map<ServiceType, Service>;
880
958
  clients: Record<string, any>;
959
+ verifiableInferenceAdapter?: IVerifiableInferenceAdapter | null;
881
960
  initialize(): Promise<void>;
882
961
  registerMemoryManager(manager: IMemoryManager): void;
883
962
  getMemoryManager(name: string): IMemoryManager | null;
@@ -886,7 +965,7 @@ interface IAgentRuntime {
886
965
  getSetting(key: string): string | null;
887
966
  getConversationLength(): number;
888
967
  processActions(message: Memory, responses: Memory[], state?: State, callback?: HandlerCallback): Promise<void>;
889
- evaluate(message: Memory, state?: State, didRespond?: boolean, callback?: HandlerCallback): Promise<string[]>;
968
+ evaluate(message: Memory, state?: State, didRespond?: boolean, callback?: HandlerCallback): Promise<string[] | null>;
890
969
  ensureParticipantExists(userId: UUID, roomId: UUID): Promise<void>;
891
970
  ensureUserExists(userId: UUID, userName: string | null, name: string | null, source: string | null): Promise<void>;
892
971
  registerAction(action: Action): void;
@@ -946,6 +1025,44 @@ interface IAwsS3Service extends Service {
946
1025
  }>;
947
1026
  generateSignedUrl(fileName: string, expiresIn: number): Promise<string>;
948
1027
  }
1028
+ interface UploadIrysResult {
1029
+ success: boolean;
1030
+ url?: string;
1031
+ error?: string;
1032
+ data?: any;
1033
+ }
1034
+ interface DataIrysFetchedFromGQL {
1035
+ success: boolean;
1036
+ data: any;
1037
+ error?: string;
1038
+ }
1039
+ interface GraphQLTag {
1040
+ name: string;
1041
+ values: any[];
1042
+ }
1043
+ declare const enum IrysMessageType {
1044
+ REQUEST = "REQUEST",
1045
+ DATA_STORAGE = "DATA_STORAGE",
1046
+ REQUEST_RESPONSE = "REQUEST_RESPONSE"
1047
+ }
1048
+ declare const enum IrysDataType {
1049
+ FILE = "FILE",
1050
+ IMAGE = "IMAGE",
1051
+ OTHER = "OTHER"
1052
+ }
1053
+ interface IrysTimestamp {
1054
+ from: number;
1055
+ to: number;
1056
+ }
1057
+ interface IIrysService extends Service {
1058
+ getDataFromAnAgent(agentsWalletPublicKeys: string[], tags: GraphQLTag[], timestamp: IrysTimestamp): Promise<DataIrysFetchedFromGQL>;
1059
+ workerUploadDataOnIrys(data: any, dataType: IrysDataType, messageType: IrysMessageType, serviceCategory: string[], protocol: string[], validationThreshold: number[], minimumProviders: number[], testProvider: boolean[], reputation: number[]): Promise<UploadIrysResult>;
1060
+ providerUploadDataOnIrys(data: any, dataType: IrysDataType, serviceCategory: string[], protocol: string[]): Promise<UploadIrysResult>;
1061
+ }
1062
+ interface ITeeLogService extends Service {
1063
+ getInstance(): ITeeLogService;
1064
+ log(agentId: string, roomId: string, userId: string, type: string, content: string): Promise<boolean>;
1065
+ }
949
1066
  type SearchImage = {
950
1067
  url: string;
951
1068
  description?: string;
@@ -976,7 +1093,10 @@ declare enum ServiceType {
976
1093
  INTIFACE = "intiface",
977
1094
  AWS_S3 = "aws_s3",
978
1095
  BUTTPLUG = "buttplug",
979
- SLACK = "slack"
1096
+ SLACK = "slack",
1097
+ IRYS = "irys",
1098
+ TEE_LOG = "tee_log",
1099
+ GOPLUS_SECURITY = "goplus_security"
980
1100
  }
981
1101
  declare enum LoggingLevel {
982
1102
  DEBUG = "debug",
@@ -987,6 +1107,27 @@ type KnowledgeItem = {
987
1107
  id: UUID;
988
1108
  content: Content;
989
1109
  };
1110
+ interface RAGKnowledgeItem {
1111
+ id: UUID;
1112
+ agentId: UUID;
1113
+ content: {
1114
+ text: string;
1115
+ metadata?: {
1116
+ isMain?: boolean;
1117
+ isChunk?: boolean;
1118
+ originalId?: UUID;
1119
+ chunkIndex?: number;
1120
+ source?: string;
1121
+ type?: string;
1122
+ isShared?: boolean;
1123
+ [key: string]: unknown;
1124
+ };
1125
+ };
1126
+ embedding?: Float32Array;
1127
+ createdAt?: number;
1128
+ similarity?: number;
1129
+ score?: number;
1130
+ }
990
1131
  interface ActionResponse {
991
1132
  like: boolean;
992
1133
  retweet: boolean;
@@ -996,6 +1137,60 @@ interface ActionResponse {
996
1137
  interface ISlackService extends Service {
997
1138
  client: any;
998
1139
  }
1140
+ /**
1141
+ * Available verifiable inference providers
1142
+ */
1143
+ declare enum VerifiableInferenceProvider {
1144
+ RECLAIM = "reclaim",
1145
+ OPACITY = "opacity",
1146
+ PRIMUS = "primus"
1147
+ }
1148
+ /**
1149
+ * Options for verifiable inference
1150
+ */
1151
+ interface VerifiableInferenceOptions {
1152
+ /** Custom endpoint URL */
1153
+ endpoint?: string;
1154
+ /** Custom headers */
1155
+ headers?: Record<string, string>;
1156
+ /** Provider-specific options */
1157
+ providerOptions?: Record<string, unknown>;
1158
+ }
1159
+ /**
1160
+ * Result of a verifiable inference request
1161
+ */
1162
+ interface VerifiableInferenceResult {
1163
+ /** Generated text */
1164
+ text: string;
1165
+ /** Proof */
1166
+ proof: any;
1167
+ /** Proof id */
1168
+ id?: string;
1169
+ /** Provider information */
1170
+ provider: VerifiableInferenceProvider;
1171
+ /** Timestamp */
1172
+ timestamp: number;
1173
+ }
1174
+ /**
1175
+ * Interface for verifiable inference adapters
1176
+ */
1177
+ interface IVerifiableInferenceAdapter {
1178
+ options: any;
1179
+ /**
1180
+ * Generate text with verifiable proof
1181
+ * @param context The input text/prompt
1182
+ * @param modelClass The model class/name to use
1183
+ * @param options Additional provider-specific options
1184
+ * @returns Promise containing the generated text and proof data
1185
+ */
1186
+ generateText(context: string, modelClass: string, options?: VerifiableInferenceOptions): Promise<VerifiableInferenceResult>;
1187
+ /**
1188
+ * Verify the proof of a generated response
1189
+ * @param result The result containing response and proof to verify
1190
+ * @returns Promise indicating if the proof is valid
1191
+ */
1192
+ verifyProof(result: VerifiableInferenceResult): Promise<boolean>;
1193
+ }
999
1194
  declare enum TokenizerType {
1000
1195
  Auto = "auto",
1001
1196
  TikToken = "tiktoken"
@@ -1005,6 +1200,10 @@ declare enum TranscriptionProvider {
1005
1200
  Deepgram = "deepgram",
1006
1201
  Local = "local"
1007
1202
  }
1203
+ declare enum ActionTimelineType {
1204
+ ForYou = "foryou",
1205
+ Following = "following"
1206
+ }
1008
1207
 
1009
1208
  /**
1010
1209
  * Composes a set of example conversations based on provided actions and a specified count.
@@ -1038,7 +1237,7 @@ declare function formatActions(actions: Action[]): string;
1038
1237
  *
1039
1238
  * @param {Object} params - The parameters for composing the context.
1040
1239
  * @param {State} params.state - The state object containing values to replace the placeholders in the template.
1041
- * @param {string} params.template - The template string containing placeholders to be replaced with state values.
1240
+ * @param {TemplateType} params.template - The template string or function containing placeholders to be replaced with state values.
1042
1241
  * @param {"handlebars" | undefined} [params.templatingEngine] - The templating engine to use for compiling and evaluating the template (optional, default: `undefined`).
1043
1242
  * @returns {string} The composed context string with placeholders replaced by corresponding state values.
1044
1243
  *
@@ -1050,10 +1249,17 @@ declare function formatActions(actions: Action[]): string;
1050
1249
  * // Composing the context with simple string replacement will result in:
1051
1250
  * // "Hello, Alice! You are 30 years old."
1052
1251
  * const contextSimple = composeContext({ state, template });
1252
+ *
1253
+ * // Using composeContext with a template function for dynamic template
1254
+ * const template = ({ state }) => {
1255
+ * const tone = Math.random() > 0.5 ? "kind" : "rude";
1256
+ * return `Hello, {{userName}}! You are {{userAge}} years old. Be ${tone}`;
1257
+ * };
1258
+ * const contextSimple = composeContext({ state, template });
1053
1259
  */
1054
1260
  declare const composeContext: ({ state, template, templatingEngine, }: {
1055
1261
  state: State;
1056
- template: string;
1262
+ template: TemplateType;
1057
1263
  templatingEngine?: "handlebars";
1058
1264
  }) => string;
1059
1265
  /**
@@ -1190,6 +1396,7 @@ declare abstract class DatabaseAdapter<DB = any> implements IDatabaseAdapter {
1190
1396
  agentId: UUID;
1191
1397
  roomIds: UUID[];
1192
1398
  tableName: string;
1399
+ limit?: number;
1193
1400
  }): Promise<Memory[]>;
1194
1401
  abstract getMemoryById(id: UUID): Promise<Memory | null>;
1195
1402
  /**
@@ -1422,6 +1629,43 @@ declare abstract class DatabaseAdapter<DB = any> implements IDatabaseAdapter {
1422
1629
  abstract getRelationships(params: {
1423
1630
  userId: UUID;
1424
1631
  }): Promise<Relationship[]>;
1632
+ /**
1633
+ * Retrieves knowledge items based on specified parameters.
1634
+ * @param params Object containing search parameters
1635
+ * @returns Promise resolving to array of knowledge items
1636
+ */
1637
+ abstract getKnowledge(params: {
1638
+ id?: UUID;
1639
+ agentId: UUID;
1640
+ limit?: number;
1641
+ query?: string;
1642
+ conversationContext?: string;
1643
+ }): Promise<RAGKnowledgeItem[]>;
1644
+ abstract searchKnowledge(params: {
1645
+ agentId: UUID;
1646
+ embedding: Float32Array;
1647
+ match_threshold: number;
1648
+ match_count: number;
1649
+ searchText?: string;
1650
+ }): Promise<RAGKnowledgeItem[]>;
1651
+ /**
1652
+ * Creates a new knowledge item in the database.
1653
+ * @param knowledge The knowledge item to create
1654
+ * @returns Promise resolving when creation is complete
1655
+ */
1656
+ abstract createKnowledge(knowledge: RAGKnowledgeItem): Promise<void>;
1657
+ /**
1658
+ * Removes a knowledge item and its associated chunks from the database.
1659
+ * @param id The ID of the knowledge item to remove
1660
+ * @returns Promise resolving when removal is complete
1661
+ */
1662
+ abstract removeKnowledge(id: UUID): Promise<void>;
1663
+ /**
1664
+ * Removes an agents full knowledge database and its associated chunks from the database.
1665
+ * @param agentId The Agent ID of the knowledge items to remove
1666
+ * @returns Promise resolving when removal is complete
1667
+ */
1668
+ abstract clearKnowledge(agentId: UUID, shared?: boolean): Promise<void>;
1425
1669
  /**
1426
1670
  * Executes an operation with circuit breaker protection.
1427
1671
  * @param operation A function that returns a Promise to be executed with circuit breaker protection
@@ -1439,6 +1683,7 @@ declare const EmbeddingProvider: {
1439
1683
  readonly OpenAI: "OpenAI";
1440
1684
  readonly Ollama: "Ollama";
1441
1685
  readonly GaiaNet: "GaiaNet";
1686
+ readonly Heurist: "Heurist";
1442
1687
  readonly BGE: "BGE";
1443
1688
  };
1444
1689
  type EmbeddingProviderType = (typeof EmbeddingProvider)[keyof typeof EmbeddingProvider];
@@ -1531,15 +1776,18 @@ declare function trimTokens(context: string, maxTokens: number, runtime: IAgentR
1531
1776
  * @param opts.max_context_length The maximum length of the context to apply to the generateText.
1532
1777
  * @returns The completed message.
1533
1778
  */
1534
- declare function generateText({ runtime, context, modelClass, tools, onStepFinish, maxSteps, stop, customSystemPrompt, }: {
1779
+ declare function generateText({ runtime, context, modelClass, tools, onStepFinish, maxSteps, stop, customSystemPrompt, verifiableInference, verifiableInferenceOptions, }: {
1535
1780
  runtime: IAgentRuntime;
1536
1781
  context: string;
1537
- modelClass: string;
1782
+ modelClass: ModelClass;
1538
1783
  tools?: Record<string, Tool>;
1539
1784
  onStepFinish?: (event: StepResult) => Promise<void> | void;
1540
1785
  maxSteps?: number;
1541
1786
  stop?: string[];
1542
1787
  customSystemPrompt?: string;
1788
+ verifiableInference?: boolean;
1789
+ verifiableInferenceAdapter?: IVerifiableInferenceAdapter;
1790
+ verifiableInferenceOptions?: VerifiableInferenceOptions;
1543
1791
  }): Promise<string>;
1544
1792
  /**
1545
1793
  * Sends a message to the model to determine if it should respond to the given context.
@@ -1558,7 +1806,7 @@ declare function generateText({ runtime, context, modelClass, tools, onStepFinis
1558
1806
  declare function generateShouldRespond({ runtime, context, modelClass, }: {
1559
1807
  runtime: IAgentRuntime;
1560
1808
  context: string;
1561
- modelClass: string;
1809
+ modelClass: ModelClass;
1562
1810
  }): Promise<"RESPOND" | "IGNORE" | "STOP" | null>;
1563
1811
  /**
1564
1812
  * Splits content into chunks of specified size with optional overlapping bleed sections
@@ -1586,7 +1834,7 @@ declare function splitChunks(content: string, chunkSize?: number, bleed?: number
1586
1834
  declare function generateTrueOrFalse({ runtime, context, modelClass, }: {
1587
1835
  runtime: IAgentRuntime;
1588
1836
  context: string;
1589
- modelClass: string;
1837
+ modelClass: ModelClass;
1590
1838
  }): Promise<boolean>;
1591
1839
  /**
1592
1840
  * Send a message to the model and parse the response as a string array
@@ -1606,17 +1854,17 @@ declare function generateTrueOrFalse({ runtime, context, modelClass, }: {
1606
1854
  declare function generateTextArray({ runtime, context, modelClass, }: {
1607
1855
  runtime: IAgentRuntime;
1608
1856
  context: string;
1609
- modelClass: string;
1857
+ modelClass: ModelClass;
1610
1858
  }): Promise<string[]>;
1611
1859
  declare function generateObjectDeprecated({ runtime, context, modelClass, }: {
1612
1860
  runtime: IAgentRuntime;
1613
1861
  context: string;
1614
- modelClass: string;
1862
+ modelClass: ModelClass;
1615
1863
  }): Promise<any>;
1616
1864
  declare function generateObjectArray({ runtime, context, modelClass, }: {
1617
1865
  runtime: IAgentRuntime;
1618
1866
  context: string;
1619
- modelClass: string;
1867
+ modelClass: ModelClass;
1620
1868
  }): Promise<any[]>;
1621
1869
  /**
1622
1870
  * Send a message to the model for generateText.
@@ -1633,7 +1881,7 @@ declare function generateObjectArray({ runtime, context, modelClass, }: {
1633
1881
  declare function generateMessageResponse({ runtime, context, modelClass, }: {
1634
1882
  runtime: IAgentRuntime;
1635
1883
  context: string;
1636
- modelClass: string;
1884
+ modelClass: ModelClass;
1637
1885
  }): Promise<Content>;
1638
1886
  declare const generateImage: (data: {
1639
1887
  prompt: string;
@@ -1673,6 +1921,9 @@ interface GenerationOptions {
1673
1921
  stop?: string[];
1674
1922
  mode?: "auto" | "json" | "tool";
1675
1923
  experimental_providerMetadata?: Record<string, unknown>;
1924
+ verifiableInference?: boolean;
1925
+ verifiableInferenceAdapter?: IVerifiableInferenceAdapter;
1926
+ verifiableInferenceOptions?: VerifiableInferenceOptions;
1676
1927
  }
1677
1928
  /**
1678
1929
  * Base settings for model generation.
@@ -1693,7 +1944,7 @@ interface ModelSettings {
1693
1944
  * @returns {Promise<any[]>} - A promise that resolves to an array of generated objects.
1694
1945
  * @throws {Error} - Throws an error if the provider is unsupported or if generation fails.
1695
1946
  */
1696
- declare const generateObject: ({ runtime, context, modelClass, schema, schemaName, schemaDescription, stop, mode, }: GenerationOptions) => Promise<GenerateObjectResult<unknown>>;
1947
+ declare const generateObject: ({ runtime, context, modelClass, schema, schemaName, schemaDescription, stop, mode, verifiableInference, verifiableInferenceAdapter, verifiableInferenceOptions, }: GenerationOptions) => Promise<GenerateObjectResult<unknown>>;
1697
1948
  /**
1698
1949
  * Interface for provider-specific generation options.
1699
1950
  */
@@ -1708,8 +1959,11 @@ interface ProviderOptions {
1708
1959
  mode?: "auto" | "json" | "tool";
1709
1960
  experimental_providerMetadata?: Record<string, unknown>;
1710
1961
  modelOptions: ModelSettings;
1711
- modelClass: string;
1962
+ modelClass: ModelClass;
1712
1963
  context: string;
1964
+ verifiableInference?: boolean;
1965
+ verifiableInferenceAdapter?: IVerifiableInferenceAdapter;
1966
+ verifiableInferenceOptions?: VerifiableInferenceOptions;
1713
1967
  }
1714
1968
  /**
1715
1969
  * Handles AI generation based on the specified provider.
@@ -1721,7 +1975,7 @@ declare function handleProvider(options: ProviderOptions): Promise<GenerateObjec
1721
1975
  declare function generateTweetActions({ runtime, context, modelClass, }: {
1722
1976
  runtime: IAgentRuntime;
1723
1977
  context: string;
1724
- modelClass: string;
1978
+ modelClass: ModelClass;
1725
1979
  }): Promise<ActionResponse | null>;
1726
1980
 
1727
1981
  declare const getGoals: ({ runtime, roomId, userId, onlyInProgress, count, }: {
@@ -1824,6 +2078,7 @@ declare class MemoryManager implements IMemoryManager {
1824
2078
  createMemory(memory: Memory, unique?: boolean): Promise<void>;
1825
2079
  getMemoriesByRoomIds(params: {
1826
2080
  roomIds: UUID[];
2081
+ limit?: number;
1827
2082
  }): Promise<Memory[]>;
1828
2083
  getMemoryById(id: UUID): Promise<Memory | null>;
1829
2084
  /**
@@ -1875,8 +2130,10 @@ declare const formatMessages: ({ messages, actors, }: {
1875
2130
  declare const formatTimestamp: (messageDate: number) => string;
1876
2131
 
1877
2132
  declare const models: Models;
1878
- declare function getModel(provider: ModelProviderName, type: ModelClass): string;
1879
- declare function getEndpoint(provider: ModelProviderName): string;
2133
+ declare function getModelSettings(provider: ModelProviderName, type: ModelClass): ModelSettings$1 | undefined;
2134
+ declare function getImageModelSettings(provider: ModelProviderName): ImageModelSettings | undefined;
2135
+ declare function getEmbeddingModelSettings(provider: ModelProviderName): EmbeddingModelSettings | undefined;
2136
+ declare function getEndpoint(provider: ModelProviderName): any;
1880
2137
 
1881
2138
  declare const formatPosts: ({ messages, actors, conversationHeader, }: {
1882
2139
  messages: Memory[];
@@ -1956,8 +2213,8 @@ declare class AgentRuntime implements IAgentRuntime {
1956
2213
  */
1957
2214
  imageModelProvider: ModelProviderName;
1958
2215
  /**
1959
- * The model to use for describing images.
1960
- */
2216
+ * The model to use for describing images.
2217
+ */
1961
2218
  imageVisionModelProvider: ModelProviderName;
1962
2219
  /**
1963
2220
  * Fetch function to use
@@ -1988,10 +2245,12 @@ declare class AgentRuntime implements IAgentRuntime {
1988
2245
  * Searchable document fragments
1989
2246
  */
1990
2247
  knowledgeManager: IMemoryManager;
2248
+ ragKnowledgeManager: IRAGKnowledgeManager;
1991
2249
  services: Map<ServiceType, Service>;
1992
2250
  memoryManagers: Map<string, IMemoryManager>;
1993
2251
  cacheManager: ICacheManager;
1994
2252
  clients: Record<string, any>;
2253
+ verifiableInferenceAdapter?: IVerifiableInferenceAdapter;
1995
2254
  registerMemoryManager(manager: IMemoryManager): void;
1996
2255
  getMemoryManager(tableName: string): IMemoryManager | null;
1997
2256
  getService<T extends Service>(service: ServiceType): T | null;
@@ -2031,6 +2290,7 @@ declare class AgentRuntime implements IAgentRuntime {
2031
2290
  speechModelPath?: string;
2032
2291
  cacheManager: ICacheManager;
2033
2292
  logging?: boolean;
2293
+ verifiableInferenceAdapter?: IVerifiableInferenceAdapter;
2034
2294
  });
2035
2295
  initialize(): Promise<void>;
2036
2296
  stop(): Promise<void>;
@@ -2041,6 +2301,13 @@ declare class AgentRuntime implements IAgentRuntime {
2041
2301
  * @param knowledge An array of knowledge items containing id, path, and content.
2042
2302
  */
2043
2303
  private processCharacterKnowledge;
2304
+ /**
2305
+ * Processes character knowledge by creating document memories and fragment memories.
2306
+ * This function takes an array of knowledge items, creates a document knowledge for each item if it doesn't exist,
2307
+ * then chunks the content into fragments, embeds each fragment, and creates fragment knowledge.
2308
+ * An array of knowledge items or objects containing id, path, and content.
2309
+ */
2310
+ private processCharacterRAGKnowledge;
2044
2311
  getSetting(key: string): any;
2045
2312
  /**
2046
2313
  * Get the number of messages that are kept in the conversation buffer.
@@ -2076,7 +2343,7 @@ declare class AgentRuntime implements IAgentRuntime {
2076
2343
  * @param callback The handler callback
2077
2344
  * @returns The results of the evaluation.
2078
2345
  */
2079
- evaluate(message: Memory, state?: State, didRespond?: boolean, callback?: HandlerCallback): Promise<string[]>;
2346
+ evaluate(message: Memory, state: State, didRespond?: boolean, callback?: HandlerCallback): Promise<string[]>;
2080
2347
  /**
2081
2348
  * Ensure the existence of a participant in the room. If the participant does not exist, they are added to the room.
2082
2349
  * @param userId - The user ID to ensure the existence of.
@@ -2109,6 +2376,8 @@ declare class AgentRuntime implements IAgentRuntime {
2109
2376
  [key: string]: unknown;
2110
2377
  }): Promise<State>;
2111
2378
  updateRecentMessageState(state: State): Promise<State>;
2379
+ getVerifiableInferenceAdapter(): IVerifiableInferenceAdapter | undefined;
2380
+ setVerifiableInferenceAdapter(adapter: IVerifiableInferenceAdapter): void;
2112
2381
  }
2113
2382
 
2114
2383
  interface Settings {
@@ -2215,7 +2484,13 @@ declare const postActionResponseFooter = "Choose any combination of [LIKE], [RET
2215
2484
  declare const parseActionResponseFromText: (text: string) => {
2216
2485
  actions: ActionResponse;
2217
2486
  };
2487
+ /**
2488
+ * Truncate text to fit within the character limit, ensuring it ends at a complete sentence.
2489
+ */
2490
+ declare function truncateToCompleteSentence(text: string, maxLength: number): string;
2218
2491
 
2492
+ declare const uuidSchema: z.ZodType<UUID>;
2493
+ declare function validateUuid(value: unknown): UUID | null;
2219
2494
  declare function stringToUuid(target: string | number): UUID;
2220
2495
 
2221
2496
  declare const envSchema: z.ZodObject<{
@@ -2302,7 +2577,16 @@ declare const CharacterSchema: z.ZodObject<{
2302
2577
  postExamples: z.ZodArray<z.ZodString, "many">;
2303
2578
  topics: z.ZodArray<z.ZodString, "many">;
2304
2579
  adjectives: z.ZodArray<z.ZodString, "many">;
2305
- knowledge: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
2580
+ knowledge: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodObject<{
2581
+ path: z.ZodString;
2582
+ shared: z.ZodOptional<z.ZodBoolean>;
2583
+ }, "strip", z.ZodTypeAny, {
2584
+ path?: string;
2585
+ shared?: boolean;
2586
+ }, {
2587
+ path?: string;
2588
+ shared?: boolean;
2589
+ }>]>, "many">>;
2306
2590
  clients: z.ZodArray<z.ZodNativeEnum<typeof Clients>, "many">;
2307
2591
  plugins: z.ZodUnion<[z.ZodArray<z.ZodString, "many">, z.ZodArray<z.ZodObject<{
2308
2592
  name: z.ZodString;
@@ -2436,10 +2720,14 @@ declare const CharacterSchema: z.ZodObject<{
2436
2720
  }, {
2437
2721
  prompt?: string;
2438
2722
  }>>;
2723
+ extends: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
2439
2724
  }, "strip", z.ZodTypeAny, {
2440
2725
  bio?: string | string[];
2441
2726
  lore?: string[];
2442
- knowledge?: string[];
2727
+ knowledge?: (string | {
2728
+ path?: string;
2729
+ shared?: boolean;
2730
+ })[];
2443
2731
  settings?: {
2444
2732
  model?: string;
2445
2733
  secrets?: Record<string, string>;
@@ -2503,10 +2791,14 @@ declare const CharacterSchema: z.ZodObject<{
2503
2791
  nft?: {
2504
2792
  prompt?: string;
2505
2793
  };
2794
+ extends?: string[];
2506
2795
  }, {
2507
2796
  bio?: string | string[];
2508
2797
  lore?: string[];
2509
- knowledge?: string[];
2798
+ knowledge?: (string | {
2799
+ path?: string;
2800
+ shared?: boolean;
2801
+ })[];
2510
2802
  settings?: {
2511
2803
  model?: string;
2512
2804
  secrets?: Record<string, string>;
@@ -2570,6 +2862,7 @@ declare const CharacterSchema: z.ZodObject<{
2570
2862
  nft?: {
2571
2863
  prompt?: string;
2572
2864
  };
2865
+ extends?: string[];
2573
2866
  }>;
2574
2867
  type CharacterConfig = z.infer<typeof CharacterSchema>;
2575
2868
  declare function validateCharacterConfig(json: unknown): CharacterConfig;
@@ -2618,4 +2911,68 @@ declare const _default: {
2618
2911
  preprocess: typeof preprocess;
2619
2912
  };
2620
2913
 
2621
- export { type Account, type Action, type ActionExample, type ActionResponse, type Actor, AgentRuntime, CacheManager, type CacheOptions, CacheStore, type Character, type CharacterConfig, CharacterSchema, type Client, Clients, type Content, type ConversationExample, DatabaseAdapter, DbCacheAdapter, type EmbeddingConfig, EmbeddingProvider, type EmbeddingProviderType, type EnvConfig, type EvaluationExample, type Evaluator, FsCacheAdapter, type GenerationOptions, type Goal, GoalStatus, type Handler, type HandlerCallback, type IAgentConfig, type IAgentRuntime, type IAwsS3Service, type IBrowserService, type ICacheAdapter, type ICacheManager, type IDatabaseAdapter, type IDatabaseCacheAdapter, type IImageDescriptionService, type IMemoryManager, type IPdfService, type ISlackService, type ISpeechService, type ITextGenerationService, type ITranscriptionService, type IVideoService, type KnowledgeItem, LoggingLevel, type Media, type Memory, MemoryCacheAdapter, MemoryManager, type MessageExample, type Model, ModelClass, type ModelConfiguration, ModelProviderName, type Models, type Objective, type Participant, type Plugin, type Provider, type Relationship, type Room, type SearchImage, type SearchResponse, type SearchResult, Service, ServiceType, type State, type TelemetrySettings, TokenizerType, TranscriptionProvider, type UUID, type Validator, addHeader, booleanFooter, composeActionExamples, composeContext, composeRandomUser, configureSettings, createGoal, createRelationship, defaultCharacter, elizaLogger, embed, envSchema, evaluationTemplate, findNearestEnvFile, formatActionNames, formatActions, formatActors, formatEvaluatorExampleDescriptions, formatEvaluatorExamples, formatEvaluatorNames, formatEvaluators, formatGoalsAsString, formatMessages, formatPosts, formatRelationships, formatTimestamp, generateCaption, generateImage, generateMessageResponse, generateObject, generateObjectArray, generateObjectDeprecated, generateShouldRespond, generateText, generateTextArray, generateTrueOrFalse, generateTweetActions, generateWebSearch, getActorDetails, getEmbeddingConfig, getEmbeddingType, getEmbeddingZeroVector, getEndpoint, getEnvVariable, getGoals, getModel, getProviders, getRelationship, getRelationships, handleProvider, hasEnvVariable, _default as knowledge, loadEnvConfig, messageCompletionFooter, models, parseActionResponseFromText, parseBooleanFromText, parseJSONObjectFromText, parseJsonArrayFromText, parseShouldRespondFromText, postActionResponseFooter, settings, shouldRespondFooter, splitChunks, stringArrayFooter, stringToUuid, trimTokens, updateGoal, validateCharacterConfig, validateEnv };
2914
+ /**
2915
+ * Manage knowledge in the database.
2916
+ */
2917
+ declare class RAGKnowledgeManager implements IRAGKnowledgeManager {
2918
+ /**
2919
+ * The AgentRuntime instance associated with this manager.
2920
+ */
2921
+ runtime: IAgentRuntime;
2922
+ /**
2923
+ * The name of the database table this manager operates on.
2924
+ */
2925
+ tableName: string;
2926
+ /**
2927
+ * Constructs a new KnowledgeManager instance.
2928
+ * @param opts Options for the manager.
2929
+ * @param opts.tableName The name of the table this manager will operate on.
2930
+ * @param opts.runtime The AgentRuntime instance associated with this manager.
2931
+ */
2932
+ constructor(opts: {
2933
+ tableName: string;
2934
+ runtime: IAgentRuntime;
2935
+ });
2936
+ private readonly defaultRAGMatchThreshold;
2937
+ private readonly defaultRAGMatchCount;
2938
+ /**
2939
+ * Common English stop words to filter out from query analysis
2940
+ */
2941
+ private readonly stopWords;
2942
+ /**
2943
+ * Filters out stop words and returns meaningful terms
2944
+ */
2945
+ private getQueryTerms;
2946
+ /**
2947
+ * Preprocesses text content for better RAG performance.
2948
+ * @param content The text content to preprocess.
2949
+ * @returns The preprocessed text.
2950
+ */
2951
+ private preprocess;
2952
+ private hasProximityMatch;
2953
+ getKnowledge(params: {
2954
+ query?: string;
2955
+ id?: UUID;
2956
+ conversationContext?: string;
2957
+ limit?: number;
2958
+ agentId?: UUID;
2959
+ }): Promise<RAGKnowledgeItem[]>;
2960
+ createKnowledge(item: RAGKnowledgeItem): Promise<void>;
2961
+ searchKnowledge(params: {
2962
+ agentId: UUID;
2963
+ embedding: Float32Array | number[];
2964
+ match_threshold?: number;
2965
+ match_count?: number;
2966
+ searchText?: string;
2967
+ }): Promise<RAGKnowledgeItem[]>;
2968
+ removeKnowledge(id: UUID): Promise<void>;
2969
+ clearKnowledge(shared?: boolean): Promise<void>;
2970
+ processFile(file: {
2971
+ path: string;
2972
+ content: string;
2973
+ type: "pdf" | "md" | "txt";
2974
+ isShared?: boolean;
2975
+ }): Promise<void>;
2976
+ }
2977
+
2978
+ export { type Account, type Action, type ActionExample, type ActionResponse, ActionTimelineType, type Actor, AgentRuntime, CacheManager, type CacheOptions, CacheStore, type Character, type CharacterConfig, CharacterSchema, type Client, Clients, type Content, type ConversationExample, type DataIrysFetchedFromGQL, DatabaseAdapter, DbCacheAdapter, type EmbeddingConfig, type EmbeddingModelSettings, EmbeddingProvider, type EmbeddingProviderType, type EnvConfig, type EvaluationExample, type Evaluator, FsCacheAdapter, type GenerationOptions, type Goal, GoalStatus, type GraphQLTag, type Handler, type HandlerCallback, type IAgentConfig, type IAgentRuntime, type IAwsS3Service, type IBrowserService, type ICacheAdapter, type ICacheManager, type IDatabaseAdapter, type IDatabaseCacheAdapter, type IImageDescriptionService, type IIrysService, type IMemoryManager, type IPdfService, type IRAGKnowledgeManager, type ISlackService, type ISpeechService, type ITeeLogService, type ITextGenerationService, type ITranscriptionService, type IVerifiableInferenceAdapter, type IVideoService, type ImageModelSettings, IrysDataType, IrysMessageType, type IrysTimestamp, type KnowledgeItem, LoggingLevel, type Media, type Memory, MemoryCacheAdapter, MemoryManager, type MessageExample, type Model, ModelClass, type ModelConfiguration, ModelProviderName, type ModelSettings$1 as ModelSettings, type Models, type Objective, type Participant, type Plugin, type Provider, type RAGKnowledgeItem, RAGKnowledgeManager, type Relationship, type Room, type SearchImage, type SearchResponse, type SearchResult, Service, ServiceType, type State, type TelemetrySettings, type TemplateType, TokenizerType, TranscriptionProvider, type UUID, type UploadIrysResult, type Validator, type VerifiableInferenceOptions, VerifiableInferenceProvider, type VerifiableInferenceResult, addHeader, booleanFooter, composeActionExamples, composeContext, composeRandomUser, configureSettings, createGoal, createRelationship, defaultCharacter, elizaLogger, embed, envSchema, evaluationTemplate, findNearestEnvFile, formatActionNames, formatActions, formatActors, formatEvaluatorExampleDescriptions, formatEvaluatorExamples, formatEvaluatorNames, formatEvaluators, formatGoalsAsString, formatMessages, formatPosts, formatRelationships, formatTimestamp, generateCaption, generateImage, generateMessageResponse, generateObject, generateObjectArray, generateObjectDeprecated, generateShouldRespond, generateText, generateTextArray, generateTrueOrFalse, generateTweetActions, generateWebSearch, getActorDetails, getEmbeddingConfig, getEmbeddingModelSettings, getEmbeddingType, getEmbeddingZeroVector, getEndpoint, getEnvVariable, getGoals, getImageModelSettings, getModelSettings, getProviders, getRelationship, getRelationships, handleProvider, hasEnvVariable, _default as knowledge, loadEnvConfig, messageCompletionFooter, models, parseActionResponseFromText, parseBooleanFromText, parseJSONObjectFromText, parseJsonArrayFromText, parseShouldRespondFromText, postActionResponseFooter, settings, shouldRespondFooter, splitChunks, stringArrayFooter, stringToUuid, trimTokens, truncateToCompleteSentence, updateGoal, uuidSchema, validateCharacterConfig, validateEnv, validateUuid };