Giter VIP home page Giter VIP logo

automata's Introduction

Automata: The Future is Self-Written

Banner

codecov Documentation Status Type Checking Discord Twitter Follow

Automata's objective is to evolve into a fully autonomous, self-programming Artificial Intelligence system.

This project is inspired by the theory that code is essentially a form of memory, and when furnished with the right tools, AI can evolve real-time capabilities which can potentially lead to the creation of AGI. The word automata comes from the Greek word αὐτόματος, denoting "self-acting, self-willed, self-moving,", and Automata theory is the study of abstract machines and automata, as well as the computational problems that can be solved using them. More information follows below.


Demo

automata_demo_v3.mp4

Rough Schematic

Rough_Schematic_06_30_23_


Installation and Usage

Initial Setup

Follow these steps to setup the Automata environment

# Copy the env and setup files
cp .setup.sh.example setup.sh && cp .env.example .env

# Allow for execution  
chmod 755 setup.sh

# Update the setup and env files with your local paths
vim setup.sh
vim .env

# Run the setup script
./setup.sh

Indexing

SCIP indices are required to run the Automata Search. These indices are used to create the code graph which relates symbols by dependencies across the codebase. New indices are generated and uploaded periodically for the Automata codebase, but programmers must be generate them manually if necessary for their local development. If you encounter issues, we recommend referring to the instructions here.

# Install dependencies and run indexing on the local codebase
./install_indexing.sh && ./regenerate_index.sh

Build the embeddings + docs

The following commands will build the embeddings and docs for the Automata Interpreter codebase. This process can take a while, so we recommend running it in the background.

# Build/refresh the code embeddings
automata run-code-embedding

# "L1" docs are the docstrings written into the code
# "L2" docs are generated from the L1 docs + symbol context
automata run-doc-embedding-l2

# "L3" docs are generated from the L2 docs + symbol context
automata run-doc-embedding-l3

Run the system

The following commands illustrate how to run the system with a trivial instruction. It is recommended that your initial run is something of this sort to ensure the system is working as expected.

# Run a single agent w/ trivial instruction
automata run-agent --instructions="Return true" --model=gpt-3.5-turbo-0613

# Run a single agent w/ a non-trivial instruction
automata run-agent --instructions="Explain what AutomataAgent is and how it works, include an example to initialize an instance of AutomataAgent." --model=gpt-3.5-turbo-16k

Understanding Automata

Automata works by combining Large Language Models, such as GPT-4, with a vector database to form an integrated system capable of documenting, searching, and writing code. The procedure initiates with the generation of comprehensive documentation and code instances. This, coupled with search capabilities, forms the foundation for Automata's self-coding potential.

Automata employs downstream tooling to execute advanced coding tasks, continually building its expertise and autonomy. This self-coding approach mirrors an autonomous craftsman's work, where tools and techniques are consistently refined based on feedback and accumulated experience.

Example - Building your own agent

Sometimes the best way to understand a complicated system is to start by understanding a basic example. The following example illustrates how to run your own Automata agent. The agent will be initialized with a trivial instruction, and will then attempt to write code to fulfill the instruction. The agent will then return the result of its attempt.

import logging
from automata.config.openai_agent import AutomataOpenAIAgentConfigBuilder
from automata.core.agent.providers import OpenAIAutomataAgent
from automata.core.agent.tool.tool_utils import AgentToolFactory, dependency_factory
from automata.core.coding.py.module_loader import py_module_loader

logger = logging.getLogger(__name__)

# Initialize the module loader to the local directory
py_module_loader.initialize()

# Construct the set of all dependencies that will be used to build the tools
toolkit_list = ["context-oracle"]
tool_dependencies = dependency_factory.build_dependencies_for_tools(toolkit_list)

# Build the tools
tools = AgentToolFactory.build_tools(toolkit_list, **tool_dependencies)

# Build the agent config
agent_config = (
    AutomataOpenAIAgentConfigBuilder.from_name("automata-main")
    .with_tools(tools)
    .with_model("gpt-4")
    .build()
)

# Initialize and run the agent
instructions = "Explain how embeddings are used by the codebase"
agent = OpenAIAutomataAgent(instructions, config=agent_config)
result = agent.run()
Click to see the output

Embeddings in this codebase are represented by classes such as SymbolCodeEmbedding and SymbolDocEmbedding. These classes store information about a symbol and its respective embeddings which are vectors representing the symbol in high-dimensional space.

Examples of these classes are: SymbolCodeEmbedding a class used for storing embeddings related to the code of a symbol. SymbolDocEmbedding a class used for storing embeddings related to the documentation of a symbol.

Code example for creating an instance of 'SymbolCodeEmbedding':

import numpy as np
from automata.core.base.symbol_embedding import SymbolCodeEmbedding
from automata.core.symbol.parser import parse_symbol

symbol_str = 'scip-python python automata 75482692a6fe30c72db516201a6f47d9fb4af065 `automata.core.agent.agent_enums`/ActionIndicator#'
symbol = parse_symbol(symbol_str)
source_code = 'symbol_source'
vector = np.array([1, 0, 0, 0])

embedding = SymbolCodeEmbedding(symbol=symbol, source_code=source_code, vector=vector)

Code example for creating an instance of 'SymbolDocEmbedding':

from automata.core.base.symbol_embedding import SymbolDocEmbedding
from automata.core.symbol.parser import parse_symbol
import numpy as np

symbol = parse_symbol('your_symbol_here')
document = 'A document string containing information about the symbol.'
vector = np.random.rand(10)

symbol_doc_embedding = SymbolDocEmbedding(symbol, document, vector)

Contribution guidelines

If you want to contribute to Automata, be sure to review the contribution guidelines. This project adheres to Automata's code of conduct. By participating, you are expected to uphold this code.

We use GitHub issues for tracking requests and bugs, please see Automata Discussions for general questions and discussion, and please direct specific questions.

The Automata project strives to abide by generally accepted best practices in open-source software development.

Future

The ultimate goal of the Automata project is to achieve a level of proficiency where it can independently design, write, test, and refine complex software systems. This includes the ability to understand and navigate large codebases, reason about software architecture, optimize performance, and even invent new algorithms or data structures when necessary.

While the complete realization of this goal is likely to be a complex and long-term endeavor, each incremental step towards it not only has the potential to dramatically increase the productivity of human programmers, but also to shed light on fundamental questions in AI and computer science.

License

Automata is licensed under the Apache License 2.0.

Other

This project is an extension of an initial effort between emrgnt-cmplxty and maks-ivanov that began with this repository.

automata's People

Contributors

emrgnt-cmplxty avatar maks-ivanov avatar

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.