GithubHelp home page GithubHelp logo

Comments (7)

eumemic avatar eumemic commented on August 15, 2024 1

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.

eumemic avatar eumemic commented on August 15, 2024 1

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.

MalikMAlna avatar MalikMAlna commented on August 15, 2024 1

Makes sense. Gonna close this out then. No point in getting it to improve upon things that aren't really bottlenecks.

from ai-legion.

eumemic avatar eumemic commented on August 15, 2024 1

It was an interesting experiment though!

from ai-legion.

MalikMAlna avatar MalikMAlna commented on August 15, 2024

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.

MalikMAlna avatar MalikMAlna commented on August 15, 2024

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.

MalikMAlna avatar MalikMAlna commented on August 15, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.