Skip to content

algora-io/ai

Repository files navigation

Algora AI

Algora AI

✨ Bounty and developer recommendations
Website · Discord · Twitter · YouTube · Issues

Open Bounties Rewarded Bounties

How It Works

Algora uses vector embeddings and LLMs to recommend bounty amounts for GitHub issues.

Process flow

  1. System receives GitHub issue URL and fetches details
  2. Uses vector search to find 10 semantically similar issues with bounty data
  3. GPT-4o analyzes patterns and generates USD recommendation based on similar issues

Core components

  1. Embeddings

Issues are stored in PostgreSQL with their metadata, content and comments. Vector embeddings are automatically created and managed by pg_vectorize.

-- priv/repo/migrations/20241107000612_create_issues.exs
SELECT vectorize.table(
   job_name => 'issue_search',
   "table" => 'issues',
   primary_key => 'id',
   columns => ARRAY['title', 'body', 'comments_text'],
   transformer => 'openai/text-embedding-3-small',
   schedule => 'realtime',
   update_col => 'updated_at'
);
  1. Search

We use vector search to find semantically similar issues.

-- lib/algora/workspace.ex
SELECT *
FROM vectorize.search(
   job_name => 'issue_search',
   query => ?,
   return_columns => ARRAY['id'],
   num_results => 10
)
  1. Recommendation

The final recommendation is generated by an LLM that takes a bounty prompt as input.

-- lib/algora/ai.ex
SELECT vectorize.generate(
   input => ?,
   model => 'openai/gpt-4o'
)

Getting Started

To get a local copy up and running, follow these steps.

Prerequisites

Setting up the project

  1. Clone the repo and go to the project folder

    git clone https://github.com/algora-io/ai.git; cd ai
  2. Initialize your .env file

    cp .env.example .env
  3. Create a Postgres database with pg_vectorize extension installed

  4. Paste your connection string into your .env file

    DATABASE_URL="postgresql://user:pass@localhost:5432/db"
  5. Open a psql shell and set the OpenAI API key

    psql <DATABASE_URL>
    ALTER SYSTEM SET vectorize.openai_key TO '<your api key>';
    SELECT pg_reload_conf();
  6. Fetch dependencies, run migrations and build assets

    env $(cat .env | xargs -L 1) mix setup

    Note: If you're using an Apple machine with an ARM-based chip, you might additionally need to install the Rust compiler and run mix compile.rambo

  7. Start your development server

    env $(cat .env | xargs -L 1) iex -S mix phx.server

Future work

  • Issue content chunking for improved search results
  • Pull request data integration for improved recommendations
  • Tech stack focused recommendations
  • Issue recommendations for new bounties
  • Developer recommendations

License

Distributed under the AGPLv3 License. See LICENSE for more information.

Acknowledgements

Special thanks to these amazing projects which help power Algora AI: