Giter Site home page Giter Site logo

rickachiu / superagent Goto Github PK

View Code? Open in Web Editor NEW

This project forked from superagent-ai/superagent

0.0 0.0 0.0 61.33 MB

πŸ₯· The open framework for building AI Assistants

Home Page: https://docs.superagent.sh

License: MIT License

Shell 0.69% JavaScript 35.46% Python 28.35% TypeScript 32.52% CSS 0.22% Nix 0.10% Makefile 0.09% HTML 0.19% Smarty 0.37% PLpgSQL 0.31% Dockerfile 0.40% MDX 1.28%

superagent's Introduction

Superagent πŸ₯·

The open framework for building AI Assistants

GitHub Contributors GitHub Last Commit GitHub Issues GitHub Pull Requests Github License Discord


Superagent is an open source agent framework that enables any developer to integrate production ready AI Assistants into any application in a matter of minutes.


πŸŽ₯ Demo

demo.mp4

🧐 Tutorials

We post tutorials regularly on our Youtube channel. Make sure to check them out!

✨ Use cases

Superagent allows you to build any AI application/micro service you want, including:

  • Question/Answering over Documents (LLM Finetunes/Vectorstores)
  • Chatbots
  • Co-pilots & AI assistants
  • Content generation
  • Data aggregation
  • Workflow automation

πŸ‘€ Features

  • Memory
  • Streaming
  • Custom finetuning πŸ†•
  • Python/Typescript SDKs
  • REST API
  • API connectivity
  • Vectorization
  • Support for proprietary and OSS LLMs
  • API concurrency

πŸ“‹ Documentation

For full documentation, visit docs.superagent.sh

To see how to contribute, visit Contribution guidelines

☁️ Run on Replit

  1. Create a Replit REPL by importing the Superagent Github Repository. Link

  2. Set the REPL language to Python

  3. Replace the contents of the .replit file in your REPL with the following

    run = "chmod 777 ./libs/superagent/replit.sh && cd ./libs/superagent && ./replit.sh"
    modules = ["python-3.10:v18-20230807-322e88b", "nodejs-18:v3-20230608-f4cd419"]
    
    hidden = [".pythonlibs"]
    
    [nix]
    channel = "stable-23_05"
    
    [deployment]
    run = ["sh", "-c", "chmod 777 ./libs/superagent/replit.sh && cd ./libs/superagent && ./replit.sh"]
    deploymentTarget = "cloudrun"
  4. Add all necessary .env variables as Replit Secrets. Also add the following additional secret:

    TZ = Etc/UTC
  5. Deploy the REPL using Replit Autoscale

πŸ› οΈ Run locally

Clone the Superagent repository into a public GitHub repository or fork it from https://github.com/homanp/superagent/fork.

If you plan to distribute the code, keep the source code public.

Both the API and UI require a database in order to work. We recommend settings this up on Supabase.

Setting up Supabase

Create a Supabase account and project. We have seperated the ui and api into two sepearate Supabase projects which is recommended due the fact that the api runs on prisma.

Supabase setup for Superagent UI project

  1. Run the migrations (checkout Superagent UI section for this)

    supabase migration up (locally)
    supabase db push (cloud)
  2. Run the following query to setup authentication:

    -- inserts a row into public.profiles
    create function public.handle_new_user()
    returns trigger
    language plpgsql
    security definer set search_path = public
    as $$
    begin
    insert into public.profiles (user_id)
    values (new.id);
    return new;
    end;
    $$;
    
    -- trigger the function every time a user is created
    create trigger on_auth_user_created
    after insert on auth.users
    for each row execute procedure public.handle_new_user();
  3. Create a Supabase storage

  4. Set storate permissions: Set the following policy for storage.objects Screenshot 2023-09-14 at 23 27 35

Setting up Github OAuth in UI
  1. Create a new Github OAuth app in your Github account

  2. Copy the CLIENT_ID and CLIENT_SECRETΒ and paste them into the .envΒ variabels in the Superagent UI project.

  3. Set the following callback URL

    <YOUR_SUPABASE_URL>/auth/v1/callback
  4. Navigate to your Supabase project you have created for Superagent UI and paste the CLIENT_ID and CLIENT_SECRET

Screenshot 2023-09-15 at 09 08 52

NOTE: You can enable any provider using the steps above.

Superagent API
  1. Navigate to /libs/superagent

  2. Rename the env.example to .env and make sure you have all mandatory values set

  3. Create a virtual environment

    virtualenv venv
    source venv/bin/activate
  4. Install dependencies

    poetry install
  5. Run database migrations

    poetry run prisma migrate dev
  6. Start the server

    uvicorn app.main:app --reload
Superagent UI
  1. Navigate to /libs/ui

  2. Rename the env.example to .env and make sure you have all mandatory values set

  3. Install the dependencies:

    npm install
  4. Run migrations:

    supabase migrate up (local)
    supabase db push (cloud)
  5. Run the development server

    npm run dev
    
Superagent legacy

Please refer to the README in /libs/legacy for further instructions.

Run locally with docker and docker compose

In the .docker folder there are multiple docker-compose files.

The main docker-compose.yml file will start up the API and a Postgres DB in docker.

The other docker compose files can be used individually, or in combination to start up just the bits you need.

follow the guide in .docker/README.md file to get started

πŸ”— SDKs

If you are planing on integrating Superagent into your stack, you can use one of the following SDKs:

🫢 Contributions

Superagent is an open-source project, and contributions are welcome. If you would like to contribute, you can create new features, fix bugs, or improve the infrastructure. Please refer to the CONTRIBUTING.md file in the repository for more information on how to contribute.

⭐ Acknowledgements

We want to give a big shout out to following open source projects, without which Superagent wouldn't be possible.

superagent's People

Contributors

homanp avatar dsinghvi avatar simjak avatar heresandyboy avatar vhugoobject avatar yusofy avatar simonweniger avatar thesushilsharma avatar jakubno avatar bdqfork avatar michaelsieminski avatar shannonrdunn avatar src200 avatar shubham184 avatar tjdharani avatar tobiastornros avatar bbfred avatar eltociear avatar elliot-construct avatar dannysheridan avatar dantheman0207 avatar carlos-marques avatar kafkas avatar mrahmadt avatar a1cnore 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.