{"_id":"@caretakerai/filters","name":"@caretakerai/filters","dist-tags":{"beta":"0.0.25-beta.2","latest":"0.0.25-beta.2"},"versions":{"0.0.25-beta.2":{"name":"@caretakerai/filters","version":"0.0.25-beta.2","description":"=====================================","main":"dist/index.js","types":"dist/index.d.ts","scripts":{"test":"echo \"Error: no test specified\" && exit 1","build":"rimraf dist tsconfig.tsbuildinfo && tsc","build:watch":"tsc --watch"},"author":{"name":"Viktor Zhakhalov","url":"zhakhalov@gmail.com"},"license":"Apache-2.0","dependencies":{"yaml":"^2.4.0"},"peerDependencies":{"@caretakerai/agent":"*"},"_id":"@caretakerai/filters@0.0.25-beta.2","gitHead":"c9bef367bc5e0dc418bbeeb1e7fbf19d390c4559","_nodeVersion":"22.12.0","_npmVersion":"10.9.0","dist":{"integrity":"sha512-R6s/6QOi0/W8b35b4ylQjhFBSzxnhVuICxgu0nSzyjJOYCii705kmLAuEp8BQdK+T6pf5Mmjdt0Ld90q7OL2Wg==","shasum":"2f05ecb1f3f6c663442b2c9ab2e134f7bc2f6e9e","tarball":"https://registry.npmjs.org/@caretakerai/filters/-/filters-0.0.25-beta.2.tgz","fileCount":12,"unpackedSize":13919,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIAbX8CDtMG1c8MOo0vmgyC2qFLK7k7wSTrBoupMaGCU4AiEAt1fQDgd/eiObcIp9ZH+mrDycEd6f+j9KmFR6vCgNcHw="}]},"_npmUser":{"name":"zhakhalov","email":"zhakhalov@gmail.com"},"directories":{},"maintainers":[{"name":"zhakhalov","email":"zhakhalov@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/filters_0.0.25-beta.2_1740574703123_0.08025770163831791"},"_hasShrinkwrap":false}},"time":{"created":"2025-02-26T12:58:23.071Z","0.0.25-beta.2":"2025-02-26T12:58:23.297Z","modified":"2025-02-26T12:58:23.527Z"},"maintainers":[{"name":"zhakhalov","email":"zhakhalov@gmail.com"}],"description":"=====================================","author":{"name":"Viktor Zhakhalov","url":"zhakhalov@gmail.com"},"license":"Apache-2.0","readme":"# Optimizer Framework Documentation\r\n=====================================\r\n\r\nThe Optimizer Framework provides a set of tools for improving the performance and efficiency of intelligent agents. It is designed to work seamlessly with the Agent Framework, allowing developers to easily integrate optimization techniques into their agent-based applications.\r\n\r\n## Key Components\r\n\r\n*   `Optimizer`: The core interface that defines the optimization process. Optimizers can be used to modify the agent's behavior, improve its decision-making, or enhance its overall performance.\r\n\r\n## Optimizers\r\n\r\n### RemoveErrorActivitiesOptimizer\r\n\r\nThis optimizer removes error activities from the agent's history, ensuring that the agent does not learn from or rely on faulty information.\r\n\r\n#### Usage\r\n\r\n```typescript\r\nimport { RemoveErrorActivitiesOptimizer } from '@caretakerai/optimizer';\r\n\r\nconst optimizer = new RemoveErrorActivitiesOptimizer();\r\nconst optimizedActivities = await optimizer.optimize(activities);\r\n```\r\n\r\n\r\n### LengthOptimizer\r\n\r\nThis optimizer limits the number of activities in the agent's context, preventing the agent from becoming overwhelmed with excessive information.\r\n\r\n#### Usage\r\n\r\n```typescript\r\nimport { LengthOptimizer } from '@caretakerai/optimizer';\r\n\r\nconst optimizer = new LengthOptimizer(10); // Limit the context to 10 activities\r\nconst optimizedActivities = await optimizer.optimize(activities);\r\n```\r\n\r\n\r\n## Creating Custom Optimizers\r\n\r\nDevelopers can create their own custom optimizers by implementing the `Optimizer` interface. This allows for the creation of specialized optimizers tailored to specific use cases or applications.\r\n\r\n#### Example\r\n\r\n```typescript\r\nimport { Activity, Optimizer } from '@caretakerai/agent';\r\n\r\nexport class CustomOptimizer implements Optimizer {\r\n  async optimize(activities: Activity[]): Promise<Activity[]> {\r\n    // Implement custom optimization logic here\r\n    return optimizedActivities;\r\n  }\r\n}\r\n```\r\n\r\n\r\n## Integration with the Agent Framework\r\n\r\nOptimizers can be easily integrated into the Agent Framework by passing an array of optimizers to the `Agent` constructor. The optimizers will be executed in the order they are provided, allowing for the creation of complex optimization pipelines.\r\n\r\n#### Example\r\n\r\n```typescript\r\nimport { Agent } from '@caretakerai/agent';\r\nimport { RemoveErrorActivitiesOptimizer } from '@caretakerai/optimizer';\r\nimport { LengthOptimizer } from '@caretakerai/optimizer';\r\n\r\nconst agent = new Agent({\r\n  // ... other parameters ...\r\n  optimizers: [\r\n    new RemoveErrorActivitiesOptimizer(), // Remove error activities\r\n    new LengthOptimizer(16), // Limit the context to 16 activities\r\n  ],\r\n});\r\n```\r\n\r\n\r\nBy leveraging the Optimizer Framework, developers can create more efficient, effective, and intelligent agents that can adapt to complex environments and tasks.","readmeFilename":"README.md"}