Giter VIP home page Giter VIP logo

babel's Introduction

Babel ๐Ÿ—ผ

Babel is an innovative framework designed for constructing autonomous agent-driven applications leveraging TypeScript. It establishes itself as a modern counterpart to OpenAI functions, providing an LLM-agnostic solution compatible with any available model.

Built upon the latest research insights from Microsoft, Babel employs TypeScript type definitions to guide the LLM output. This framework allows developers to define functions (and in the future, serverless lambda functions and other endpoints) as available procedures and then harnesses the power of Claude 2 to generate a runtime that functions as an autonomous agent.

For its initial iteration, Babel has utilized Claude 2 as a reference implementation, integrating its precision, steerability, and coding capabilities to produce a straightforward, agentic runtime for your functions.

Note: Babel is not ready for production yet and is intended for research purposes at this stage. We are working on the prerelease and should be out there in the nearest future. If you wish to participate in the development, please open up an issue or contact me via my email [Mike]

๐Ÿš€ Getting Started

  1. Create .env file and set CLAUDE_KEY as an environment variable.
  2. Install all necessary dependencies by running the command:
$ yarn
  1. Execute the following command:
$ yarn tsx example/temperature/index.ts
  1. Ask it a question!

Note: Our default example is best at giving you weather update and sending it over an email (if you want to!)

๐Ÿงฉ Implementation

1. Define Your Runtime

Babel requires a TypeScript file with the functions that are available in your environment. To make a function accessible, you must export it.

export const getCurrentLocation = (): Location => {
  return {
    lat: 37.773972,
    lng: -122.431297,
  }
}

2. Generate Types for Your Runtime

Babel leverages the TypeScript compiler to transform your file into TypeScript type definitions (.d.ts).

type Location = {
  lat: number;
  lng: number;
};
export declare const getCurrentLocation: () => Location;

3. Prompt Claude 2 to Create the Agent

Babel produces a prompt, instructing Claude 2 to create a runtime TypeScript file. Given the available functions, this file will attempt to solve the task at hand.

The response is an XML object adhering to the following high-level format:

<response>
  <code><![CDATA[
    async function main(): Promise<string> {
      // code
    }
    main()
  ]]></code>
  <error></error>
</response>

If is present, it indicates a problem with generating runtime code, signifying that it cannot be safely executed.

We have noticed that allowing Claude 2 to produce potentially invalid code and return an error message often proves more predictable than requiring it to return either code or a message. This approach is a fundamental aspect of our underlying implementation, though it's subject to further research.

๐Ÿ‘ฅ Team

This project was initiated at the Anthropic hackathon in San Francisco by our dedicated team:

Mike Grabowski Shalini Ananda

We appreciate your interest in Babel and welcome your feedback, contributions, and questions. Let's create a better future with AI together! ๐ŸŽ‰

babel's People

Contributors

grabbou avatar harshav17 avatar shalinianandaphd avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 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.