Skip to content
This repository has been archived by the owner on Jun 13, 2024. It is now read-only.

Commit

Permalink
docs: add docs site (#51)
Browse files Browse the repository at this point in the history
* docs: add docs site

* ci(docs): add docs ci

* style(docs): remove .docusaurus folder

* ci(docs): update ci watching files

---------

Co-authored-by: Yuhang Shi <[email protected]>
Co-authored-by: darmody <[email protected]>
  • Loading branch information
3 people authored Oct 11, 2023
1 parent 1075342 commit 3183280
Show file tree
Hide file tree
Showing 44 changed files with 14,322 additions and 2,950 deletions.
54 changes: 54 additions & 0 deletions .github/workflows/doc-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Docs Deployment

defaults:
run:
working-directory: ./docs

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

on:
push:
branches:
- main
paths:
- 'docs/**/*'
- '.github/workflows/doc-*'
# Review gh actions docs if you want to further define triggers, paths, etc
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#on

permissions:
contents: write

jobs:
deploy:
name: Deploy to GitHub Pages
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
cache: yarn

- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Build website
run: yarn build

# Popular action to deploy to GitHub Pages:
# Docs: https://github.com/peaceiris/actions-gh-pages#%EF%B8%8F-docusaurus
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
# Build output to publish to the `gh-pages` branch:
publish_dir: ./build
# The following lines assign commit authorship to the official
# GH-Actions bot for deploys to `gh-pages` branch:
# https://github.com/actions/checkout/issues/13#issuecomment-724415212
# The GH actions bot is used by default if you didn't specify the two fields.
# You can swap them out with your own user credentials.
user_name: github-actions[bot]
user_email: 41898282+github-actions[bot]@users.noreply.github.com
35 changes: 35 additions & 0 deletions .github/workflows/doc-test-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Docs Build

defaults:
run:
working-directory: ./docs

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

on:
pull_request:
branches:
- main
paths:
- 'docs/**/*'
- '.github/workflows/doc-*'
# Review gh actions docs if you want to further define triggers, paths, etc
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#on

jobs:
test-deploy:
name: Building Docs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
cache: yarn

- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Test build website
run: yarn build
2 changes: 1 addition & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ CHANGELOG.*
dist/
storybook-static/
target/

docs/**/*.mdx
/tools/helm-charts/**/*.yaml
44 changes: 34 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,57 @@

> :warning: **This project is still under development.** We're working hard to release the first version of Flappy as soon as possible. Stay tuned! Documentation and code examples will be available soon.
English | [简体中文](./README.zh-Hans.md) | [日本語](./README.ja.md)

This monorepo gathers all the Flappy libraries, each implemented in a different programming language. Flappy is a library developed to streamline the creation of AI applications and agents that use Large Language Models (LLMs).

## Overview

Flappy is thoughtfully designed to meet the increasing demand for LLM-based AI applications across various sectors. Our goal is to offer a library that manages the inputs and outputs of LLMs, ensuring **controlled**, consistent, and machine-readable data.
Flappy is a production-ready Language Learning Model (LLM) Application/Agent SDK designed to simplify AI integration in your projects. It is an easy-to-use, universally compatible, and production-ready solution that brings the power of AI to developers regardless of their preferred programming language.

## Key Features

- **Ease of Use**: Flappy is designed to be as user-friendly as CRUD application development, minimizing the learning curve for developers new to AI.
- **Production-Ready**: Beyond research, Flappy is a robust SDK that balances cost-efficiency and sandbox security to provide a stable platform for commercial environments.
- **Language-Agnostic**: Flappy integrates seamlessly with any programming language, eliminating the need for Python unless explicitly required by your application.

## Core Components

### Agent Functions

In Flappy's ecosystem, an agent operates as a versatile conduit for the LLM, performing a variety of tasks such as structuring data, invoking external APIs, or sandboxing LLM-generated Python code as needed. This design philosophy caters to the increasing demand for LLM-based AI applications across various sectors.

The agent functions in Flappy are built on two foundational types:

A unique feature of Flappy is its capability to transform abstract classes into JSON Schema schemas. The user can define these classes in their preferred programming language, such as Java, Python, PHP, or TypeScript. These definitions include type and function signatures.
1. **InvokeFunction**: This function allows agents to interact with the environment. It's defined by input and output parameters, facilitating efficient interaction with the LLM.
2. **SynthesizedFunction**: This function is processed by the LLM and only requires the definition of its description and the structure of its inputs and outputs.

To enhance machine readability and maintain interoperability, Flappy performs AST (Abstract Syntax Tree) parsing on the LLM outputs. This process ensures that the generated JSON data strictly adheres to the defined JSON Schema schema. By integrating the flexibility of programming languages with the standardization of JSON Schema, Flappy propels AI application development to new levels of reliability and efficiency.
#### Function Implementation Details

Flappy also offers features similar to OpenAI's Code Interpreter. It executes the Python or TypeScript code produced by LLMs in a **production-ready secure sandbox**. This strategy provides a safe environment for the execution of AI-generated code, minimizing the risk of runtime errors and potential security issues.
Flappy introduces unique implementation mechanisms to enhance these functions:

Lastly, Flappy provides an abstraction layer for different LLMs, allowing users to **easily switch between different LLMs**. Users can also designate fallback LLMs to ensure their applications' stability.
- **Unique JSON Schema Integration**: Users can define abstract classes in their preferred programming language, which Flappy then transforms into JSON Schema schemas. This feature enhances machine readability and interoperability and manages the inputs and outputs of LLMs, providing controlled, consistent, and machine-readable data.
- **AST Parsing**: Flappy performs Abstract Syntax Tree (AST) parsing on the LLM outputs to ensure that the generated JSON data strictly adheres to the defined JSON Schema schema.

### Code Interpreter

Flappy's Code Interpreter serves as a secure environment to execute Python or TypeScript code produced by LLMs. It provides a sandboxed safety feature that reduces runtime errors and potential security vulnerabilities, making it suitable for deployment in a production environment.

### LLM Abstraction Layer

To enhance the flexibility of application development, Flappy provides an abstraction layer for different LLMs. This feature allows users to easily switch between different LLMs and designate fallback LLMs, ensuring application stability.

Flappy empowers developers to build LLM-based applications in a language-agnostic way. Start your journey with Flappy today and harness the immense potential of AI in your preferred programming language.

## Getting Started

To begin with Flappy, select your preferred language implementation from the list below:

- [Node.js](./packages/nodejs/README.md)
- [Kotlin](./packages/kotlin/README.md)
- Python (coming soon)
- [Kotlin&Java](./packages/kotlin/README.md)
- Ruby (coming soon)
- PHP (coming soon)
- Java (coming soon)
- [C#](./packages/csharp/README.md)
- Go (coming soon)
- Python (coming soon)

## Contributing

Expand Down
4 changes: 4 additions & 0 deletions docs/.eslintrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
root: true

extends:
- plugin:@pleisto/eslint-plugin/react
4 changes: 4 additions & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# build
build/
41 changes: 41 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Flappy Document Site

This website is built using [Docusaurus 2](https://docusaurus.io/), a modern static website generator.

### Installation

```bash
yarn
```

### Local Development

```bash
yarn start
```

This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server.

### Build

```bash
yarn build
```

This command generates static content into the `build` directory and can be served using any static contents hosting service.

### Deployment

Using SSH:

```bash
USE_SSH=true yarn deploy
```

Not using SSH:

```bash
GIT_USER=<Your GitHub username> yarn deploy
```

If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch.
3 changes: 3 additions & 0 deletions docs/babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
presets: [require.resolve('@docusaurus/core/lib/babel/preset')],
};
57 changes: 57 additions & 0 deletions docs/docs/code-interpreter.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import Tabs from '@theme/Tabs'
import TabItem from '@theme/TabItem'

# Code Interpreter

The Code Interpreter in Flappy serves as an equivalent replacement for [ChatGPT Code Interpreter](https://openai.com/blog/chatgpt-plugins#code-interpreter), enabling the language model to fulfill complex user requirements through Python code. What sets Flappy's Code Interpreter apart from other open-source implementations in the market is its sandboxed safety feature. This ensures that it meets the stringent security needs necessary for deployment in a production environment.

## How it works

Flappy's Code Interpreter is built with Rust, featuring a WebAssembly runtime environment that complies with the [WASIX specifications](https://wasix.org/docs/api-reference). Unlike standard WebAssembly runtimes, this environment hosts a Python interpreter and supports nearly all POSIX interfaces, including socket, net, and filesystem IO operations. This means that even though the Python interpreter operates within a wasm sandbox, all functionalities remain fully intact.

The current version of the Python interpreter used in this environment is `Python 3.12`. All standard libraries (stdlib) work as expected. We are also in the process of adding support for the pip package manager, which will allow for further extension of capabilities.

## Security-First Design

Our core design principle is "safety first". By default, access to the external network is off to ensure a secure environment. Similarly, environment variables are sandbox-isolated. However, if required, these settings can be overridden using custom configurations.

## Usage

<Tabs>
<TabItem value="nodejs" label="NodeJS (TypeScript)" default>

```ts
import { env } from 'node:process'
import { createFlappyAgent, ChatGPT } from '@pleisto/node-flappy'
import OpenAI from 'openai'
const gpt35 = new ChatGPT(
new OpenAI({
apiKey: process.env.OPENAI_API_KEY!,
baseURL: process.env.OPENAI_API_BASE!
}),
'gpt-3.5-turbo'
)
const agent = createFlappyAgent({
llm: gpt35,
functions: [],
codeInterpreter: {
enableNetwork: true,
env: env as Record<string, string>
}
})
void agent.callCodeInterpreter(
'There are some rabbits and chickens in a barn. What is the number of chickens if there are 396 legs and 150 heads in the barn?'
)
```

</TabItem>
<TabItem value="java" label="Java" default>
Coming soon
</TabItem>
<TabItem value="csharp" label="C#" default>
Coming soon
</TabItem>
</Tabs>
8 changes: 8 additions & 0 deletions docs/docs/examples.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Examples

Our examples are in the GitHub repository, please look for your programming language from the list of links below:

* [Node.js - TypeScript](https://github.com/pleisto/flappy/tree/main/examples/nodejs)
* [Java](https://github.com/pleisto/flappy/tree/main/examples/java)
* [Kotlin](https://github.com/pleisto/flappy/tree/main/examples/kotlin)
* [C#](https://github.com/pleisto/flappy/tree/main/examples/csharp)
77 changes: 77 additions & 0 deletions docs/docs/introduction.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
---
sidebar_position: 1
slug: /
---

# Introduction

Flappy is a production-ready Language Learning Model (LLM) Application/Agent SDK designed to simplify AI integration in your projects. It is an easy-to-use, universally compatible, and production-ready solution that brings the power of AI to developers regardless of their preferred programming language.

## Key Features

- **Ease of Use**: Flappy is designed to be as user-friendly as CRUD application development, minimizing the learning curve for developers new to AI.
- **Production-Ready**: Beyond research, Flappy is a robust SDK that balances cost-efficiency and sandbox security to provide a stable platform for commercial environments.
- **Language-Agnostic**: Flappy integrates seamlessly with any programming language, eliminating the need for Python unless explicitly required by your application.

## Why Flappy?

Flappy is your key to unlocking the potential of large language learning models (LLMs) in everyday applications. It's not just about creating new data, but about transforming and synthesizing the existing data for meaningful insights.

Commercial value of LLMs lies in their application within industry-specific use cases. However, integrating these models into existing business systems is a significant challenge. This is where Flappy shines - acting as a production-ready LLM Agent SDK for every developer. It facilitates the interaction between LLMs and other software systems, ensuring high accuracy and specific output formatting that's crucial for efficient data exchange.

Flappy is not just about translation. It's about empowerment. It breaks down the high technical barriers, turning extensive and complicated work into streamlined processes. With Flappy, developers without an AI background can integrate AI applications into their software, contributing to the industry-specific application of large models.

Flappy surpasses alternatives like AutoGPT, TypeChat, and LangChain in delivering production-ready solutions. Designed with real-world applications in mind, Flappy prioritizes safety, cost-effectiveness, robustness, and maintainability.

In essence, Flappy is more than a tool. It's a revolution in the field of AI, bridging the gap between potential and practical application. It brings the power of AI into the hands of every developer, driving forward AI-driven innovation in a variety of applications.

Choose Flappy to be part of this revolution, to harness the full potential of AI, and to shape the future of AI together.

## Core Components

### Agent Functions

In Flappy's ecosystem, an agent operates as a versatile conduit for the LLM, performing a variety of tasks such as structuring data, invoking external APIs, or sandboxing LLM-generated Python code as needed. This design philosophy caters to the increasing demand for LLM-based AI applications across various sectors.

The agent functions in Flappy are built on two foundational types:

1. **InvokeFunction**: This function allows agents to interact with the environment. It's defined by input and output parameters, facilitating efficient interaction with the LLM.
2. **SynthesizedFunction**: This function is processed by the LLM and only requires the definition of its description and the structure of its inputs and outputs.

#### Function Implementation Details

Flappy introduces unique implementation mechanisms to enhance these functions:

- **Unique JSON Schema Integration**: Users can define abstract classes in their preferred programming language, which Flappy then transforms into JSON Schema schemas. This feature enhances machine readability and interoperability and manages the inputs and outputs of LLMs, providing controlled, consistent, and machine-readable data.
- **AST Parsing**: Flappy performs Abstract Syntax Tree (AST) parsing on the LLM outputs to ensure that the generated JSON data strictly adheres to the defined JSON Schema schema.

### Code Interpreter

Flappy's Code Interpreter serves as a secure environment to execute Python or TypeScript code produced by LLMs. It provides a sandboxed safety feature that reduces runtime errors and potential security vulnerabilities, making it suitable for deployment in a production environment.

### LLM Abstraction Layer

To enhance the flexibility of application development, Flappy provides an abstraction layer for different LLMs. This feature allows users to easily switch between different LLMs and designate fallback LLMs, ensuring application stability.

Flappy empowers developers to build LLM-based applications in a language-agnostic way. Start your journey with Flappy today and harness the immense potential of AI in your preferred programming language.

## Supported LLMs

- OpenAI ChatGPT & GPT-4
- HuggingFace Transformers (Llama, mistral, etc.) `Coming Soon`
- Google PaLM2 `Coming Soon`
- Baidu ERNIE `Coming Soon`
- Baichuan-53B `Coming Soon`
- iFly XingHuo `Coming Soon`
- MiniMax `Coming Soon`


## Supported Programming Languages

- Node.js (JavaScript/TypeScript)
- Kotlin & Java
- C# (.NET Core)
- Go `Coming Soon`
- PHP `Coming Soon`
- Ruby `Coming Soon`
- Python `Coming Soon`
Loading

0 comments on commit 3183280

Please sign in to comment.