@ai.ntellect/core 0.1.4 → 0.1.5

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.
@@ -45,7 +45,7 @@ class Evaluator {
45
45
  if (validatedResponse.isImportantToRemember) {
46
46
  for (const item of validatedResponse.importantToRemembers) {
47
47
  // Check if the item is already in the memory
48
- const memories = await this.memory.findBestMatches(item.hypotheticalQuery, {
48
+ const memories = await this.memory.searchSimilarQueries(item.hypotheticalQuery, {
49
49
  similarityThreshold: 95,
50
50
  });
51
51
  if (memories.length > 0) {
@@ -82,7 +82,7 @@ class Evaluator {
82
82
  if (error.value.importantToRemembers.length > 0) {
83
83
  for (const item of error.value.importantToRemembers) {
84
84
  // Check if the item is already in the memory
85
- const memories = await this.memory.findBestMatches(item.hypotheticalQuery);
85
+ const memories = await this.memory.searchSimilarQueries(item.hypotheticalQuery);
86
86
  if (memories.length === 0) {
87
87
  console.log("Adding to memory", {
88
88
  query: item.hypotheticalQuery,
@@ -9,6 +9,7 @@ exports.orchestratorContext = {
9
9
  "If there is no action to do, you must answer in the 'answer' field.",
10
10
  "If some parameters are not clear or missing, YOU MUST ask the user for them.",
11
11
  "ALWAYS use the same language as user request. (If it's English, use English, if it's French, use French, etc.)",
12
+ "Before executing multiple actions, you must search the memory for similar queries.",
12
13
  ],
13
14
  warnings: ["NEVER repeat same actions if the user doesn't ask for it."],
14
15
  },
@@ -18,7 +18,7 @@ class Orchestrator {
18
18
  query: zod_1.z.string(),
19
19
  }),
20
20
  execute: async (params) => {
21
- const memories = await this.memory.findBestMatches(params.value);
21
+ const memories = await this.memory.searchSimilarQueries(params.value);
22
22
  return memories;
23
23
  },
24
24
  },
@@ -45,7 +45,7 @@ export declare class PersistentMemory {
45
45
  /**
46
46
  * Find best matching memories
47
47
  */
48
- findBestMatches(query: string, options?: SearchOptions): Promise<{
48
+ searchSimilarQueries(query: string, options?: SearchOptions): Promise<{
49
49
  data: any;
50
50
  purpose: string;
51
51
  query: string;
@@ -121,7 +121,7 @@ class PersistentMemory {
121
121
  /**
122
122
  * Find best matching memories
123
123
  */
124
- async findBestMatches(query, options = {}) {
124
+ async searchSimilarQueries(query, options = {}) {
125
125
  console.log("\nšŸ” Searching in persistent memory:", query);
126
126
  // Generate embedding for the query
127
127
  const { embedding: queryEmbedding } = await (0, ai_1.embed)({
@@ -54,7 +54,7 @@ export class Evaluator {
54
54
  if (validatedResponse.isImportantToRemember) {
55
55
  for (const item of validatedResponse.importantToRemembers) {
56
56
  // Check if the item is already in the memory
57
- const memories = await this.memory.findBestMatches(
57
+ const memories = await this.memory.searchSimilarQueries(
58
58
  item.hypotheticalQuery,
59
59
  {
60
60
  similarityThreshold: 95,
@@ -94,7 +94,7 @@ export class Evaluator {
94
94
  if (error.value.importantToRemembers.length > 0) {
95
95
  for (const item of error.value.importantToRemembers) {
96
96
  // Check if the item is already in the memory
97
- const memories = await this.memory.findBestMatches(
97
+ const memories = await this.memory.searchSimilarQueries(
98
98
  item.hypotheticalQuery
99
99
  );
100
100
  if (memories.length === 0) {
@@ -8,6 +8,7 @@ export const orchestratorContext = {
8
8
  "If there is no action to do, you must answer in the 'answer' field.",
9
9
  "If some parameters are not clear or missing, YOU MUST ask the user for them.",
10
10
  "ALWAYS use the same language as user request. (If it's English, use English, if it's French, use French, etc.)",
11
+ "Before executing multiple actions, you must search the memory for similar queries.",
11
12
  ],
12
13
  warnings: ["NEVER repeat same actions if the user doesn't ask for it."],
13
14
  },
@@ -1,6 +1,7 @@
1
1
  import { openai } from "@ai-sdk/openai";
2
2
  import { generateObject } from "ai";
3
3
  import { z } from "zod";
4
+ import { CacheMemory } from "../../memory/cache";
4
5
  import { PersistentMemory } from "../../memory/persistent";
5
6
  import { ActionSchema, BaseLLM } from "../../types";
6
7
  import { orchestratorContext } from "./context";
@@ -9,7 +10,6 @@ export class Orchestrator implements BaseLLM {
9
10
  private readonly model = openai("gpt-4o");
10
11
  public tools: ActionSchema[];
11
12
  private memory: PersistentMemory;
12
-
13
13
  constructor(tools: ActionSchema[], memory: PersistentMemory) {
14
14
  this.memory = memory;
15
15
  this.tools = [
@@ -22,7 +22,7 @@ export class Orchestrator implements BaseLLM {
22
22
  query: z.string(),
23
23
  }),
24
24
  execute: async (params) => {
25
- const memories = await this.memory.findBestMatches(params.value);
25
+ const memories = await this.memory.searchSimilarQueries(params.value);
26
26
  return memories;
27
27
  },
28
28
  },
@@ -186,7 +186,7 @@ export class PersistentMemory {
186
186
  /**
187
187
  * Find best matching memories
188
188
  */
189
- async findBestMatches(query: string, options: SearchOptions = {}) {
189
+ async searchSimilarQueries(query: string, options: SearchOptions = {}) {
190
190
  console.log("\nšŸ” Searching in persistent memory:", query);
191
191
 
192
192
  // Generate embedding for the query
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai.ntellect/core",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {