benjamin-asdf / chat-iteration-engine

A chat iteration engine for building self evolving and agent like llm driven programs.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Concepts

The name chat comes from the current tool I use for this, the openai chat api. This is for building agent-like or self-evolving intelligences with large language models as drivers.

chat-iteration

The basic idea is that I have a program, the engine.

There is 1 function chat-iteration. It takes a context and a driver, a post-processor and a pre-processor.

We take the context, and produce a prompt for the driver (presumably a large language model), to respond with update data. The post-processer reads the output of the driver. Then we eval, which means updating the context with the output of the driver.

prompt -> driver -> driver-output -> read (post-processer) -> update context -> build next prompt from new context (iterate).

Side effects

My idea would be that output is allowed to be command-like, but this is up to the engine implementation what to do with that.

Implementation

(defn chat-iteration [{:keys [context pre-process post-process driver]}]
  (let [prompt (pre-process context)
        output (driver prompt)
        new-context (post-process context output)]
    new-context))

Examples

examples/

Notes

About

A chat iteration engine for building self evolving and agent like llm driven programs.


Languages

Language:Clojure 100.0%