Comments (7)
Unfortunately I don't think most of these are good suggestions. These agents are fairly dumb and do better with more focused instructions after an in-depth design discussion with a knowledgeable coder.
from ai-legion.
That being said, you said most weren't good suggestions. Are there any that you noticed that were good?
No... lol. It's all pretty much premature optimization. There's absolutely no memory, disk or algorithmic inefficiency bottleneck that is hurting performance right now, the heavy lifting is all done in OpenAI's cloud and we're just providing some light scripting to orchestrate it.
from ai-legion.
Makes sense. Gonna close this out then. No point in getting it to improve upon things that aren't really bottlenecks.
from ai-legion.
It was an interesting experiment though!
from ai-legion.
Okay, set up a PR for the first change. Attempted the second change. Not confident enough with memory compression to know if this makes any sense, but these are the contents of each of the files created in the memory-compression
folder the Agent created for the second improvement:
bloom-filter.ts
class BloomFilter {
private size: number;
private storage: Uint8Array;
constructor(size: number) {
this.size = size;
this.storage = new Uint8Array(size);
}
private hash1(value: string): number {
let hash = 0;
for (let i = 0; i < value.length; i++) {
hash = (hash * 31 + value.charCodeAt(i)) % this.size;
}
return hash;
}
private hash2(value: string): number {
let hash = 0;
for (let i = 0; i < value.length; i++) {
hash = (hash * 37 + value.charCodeAt(i)) % this.size;
}
return hash;
}
add(value: string): void {
this.storage[this.hash1(value)] = 1;
this.storage[this.hash2(value)] = 1;
}
contains(value: string): boolean {
return (
this.storage[this.hash1(value)] === 1 &&
this.storage[this.hash2(value)] === 1
);
}
remove(value: string): void {
this.storage[this.hash1(value)] = 0;
this.storage[this.hash2(value)] = 0;
}
}
export default BloomFilter;
efficient-serialization.ts
import { Event } from '../src/memory';
function serializeEvent(event: Event): string {
const serializedEvent = JSON.stringify(event);
// Implement a more efficient serialization method here
return serializedEvent;
}
function deserializeEvent(serializedEvent: string): Event {
const event = JSON.parse(serializedEvent);
// Implement a more efficient deserialization method here
return event;
}
export { serializeEvent, deserializeEvent };
memory-compression-integration.ts
import Memory from '../src/memory';
import BloomFilter from './bloom-filter';
import { serializeEvent, deserializeEvent } from './efficient-serialization';
class CompressedMemory extends Memory {
private bloomFilter: BloomFilter;
constructor(size: number) {
super();
this.bloomFilter = new BloomFilter(size);
}
addEvent(event: Event): void {
const serializedEvent = serializeEvent(event);
this.bloomFilter.add(serializedEvent);
super.addEvent(event);
}
hasEvent(event: Event): boolean {
const serializedEvent = serializeEvent(event);
return this.bloomFilter.contains(serializedEvent);
}
// Override other Memory methods to integrate the Bloom filter and efficient serialization methods
}
export default CompressedMemory;
from ai-legion.
Yeah, that makes sense. I didn't give it a lot of context to work off from and I'm not strong enough with TypeScript to know whether the suggestions make any sense.
from ai-legion.
That being said, you said most weren't good suggestions. Are there any that you noticed that were good?
from ai-legion.
Related Issues (13)
- OPENAI_API_KEY not set HOT 2
- Consider adding a license
- Cannot find module 'fs/promises' HOT 1
- Agent stuck in a loop HOT 3
- Endless stream of error logs with 401 HOT 1
- Stuck in a multi-line delimiter error loop. HOT 3
- Adding Temperature Option to ChatCompletion
- Error: Model 'gpt-4' is unavailable in openai.ts HOT 2
- Add โlearnedโ as a type of persistent memory HOT 1
- Restrict Agent file editing/viewing to only the ".store" folder
- Vercel deploy
- What am i doing wrong?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ai-legion.