{"data":{"slug":"danny-avila-rag-api","name":"rag_api","tagline":"ID-based RAG FastAPI: Integration with Langchain and PostgreSQL/pgvector","github_url":"https://github.com/danny-avila/rag_api","owner":"danny-avila","repo":"rag_api","owner_avatar_url":"https://avatars.githubusercontent.com/u/110412045?v=4","primary_language":"Python","stars":885,"forks":387,"topics":["api","api-rest","embeddings","fastapi","langchain","pgvector","postgresql","psql","python","rag","vector","vector-database"],"archived":false,"github_pushed_at":"2026-08-15T17:09:36+00:00","maintenance_label":"Very active","stars_delta_30d":19,"url":"https://www.graphcanon.com/tools/danny-avila-rag-api","markdown_url":"https://www.graphcanon.com/tools/danny-avila-rag-api.md","api_url":"https://www.graphcanon.com/api/graphcanon/tools/danny-avila-rag-api","graph_url":"https://www.graphcanon.com/api/graphcanon/graph?tool=danny-avila-rag-api","description":"ID-based RAG FastAPI: Integration with Langchain and PostgreSQL/pgvector","homepage_url":"https://librechat.ai/","license":"MIT","open_issues":44,"watchers":7,"ai_summary":"A FastAPI-based API for ID-based retrieval-augmented generation (RAG) systems, integrated with Langchain and using PostgreSQL/pgvector as the vector database.","readme_excerpt":"### Getting Started\n\n- **Configure `.env` file based on [section below](#environment-variables)**\n- **Setup pgvector database:**\n  - Run an existing PSQL/PGVector setup, or,\n  - Docker: `docker compose up` (also starts RAG API)\n    - or, use docker just for DB: `docker compose -f ./db-compose.yaml up`\n- **Run API**:\n  - Docker: `docker compose up` (also starts PSQL/pgvector)\n    - or, use docker just for RAG API: `docker compose -f ./api-compose.yaml up`\n  - Local:\n    - Make sure to setup `DB_HOST` to the correct database hostname\n    - Run the following commands (preferably in a [virtual environment](https://realpython.com/python-virtual-environments-a-primer/))\n```bash\npip install -r requirements.txt\nuvicorn main:app\n```\n\n---\n\n### Clean Install (Local Development)\n\nTo do a clean reinstall of all dependencies (e.g., after updating `requirements.txt`):\n\n```bash\n\n---\n\n### Cloud Installation Settings:\n\n#### AWS:\nMake sure your RDS Postgres instance adheres to this requirement:\n\n`The pgvector extension version 0.5.0 is available on database instances in Amazon RDS running PostgreSQL 15.4-R2 and higher, 14.9-R2 and higher, 13.12-R2 and higher, and 12.16-R2 and higher in all applicable AWS Regions, including the AWS GovCloud (US) Regions.`\n\nIn order to setup RDS Postgres with RAG API, you can follow these steps:\n\n* Create a RDS Instance/Cluster using the provided [AWS Documentation](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_CreateDBInstance.html).\n* Login to the RDS Cluster using the Endpoint connection string from the RDS Console or from your IaC Solution output.\n* The login is via the *Master User*.\n* Create a dedicated database for rag_api:\n``` create database rag_api;```.\n* Create a dedicated user\\role for that database:\n``` create role rag;```\n\n* Switch to the database you just created: ```\\c rag_api```\n* Enable the Vector extension: ```create extension vector;```\n* Use the documentation provided above to set up the connection string to the RDS Postgres Instance\\Cluster.\n\nNotes:\n  * Even though you're logging with a Master user, it doesn't have all the super user privileges, that's why we cannot use the command: ```create role x with superuser;```\n  * If you do not enable the extension, rag_api service will throw an error that it cannot create the extension due to the note above.","github_created_at":"2024-03-17T12:20:35+00:00","created_at":"2026-07-11T11:27:02.411328+00:00","updated_at":"2026-08-21T18:02:22.440063+00:00","categories":[{"slug":"data-retrieval","name":"Data & Retrieval","url":"https://www.graphcanon.com/categories/data-retrieval","markdown_url":"https://www.graphcanon.com/categories/data-retrieval.md","api_url":"https://www.graphcanon.com/api/graphcanon/categories/data-retrieval"},{"slug":"vector-databases","name":"Vector Databases","url":"https://www.graphcanon.com/categories/vector-databases","markdown_url":"https://www.graphcanon.com/categories/vector-databases.md","api_url":"https://www.graphcanon.com/api/graphcanon/categories/vector-databases"}],"tags":[{"slug":"api","name":"api"},{"slug":"api-rest","name":"api-rest"},{"slug":"embeddings","name":"embeddings"},{"slug":"fastapi","name":"fastapi"},{"slug":"langchain","name":"langchain"},{"slug":"pgvector","name":"pgvector"},{"slug":"postgresql","name":"postgresql"},{"slug":"psql","name":"psql"}],"trust":{"provenance":{"is_fork":false,"github_id":773345074,"owner_type":"User","methodology":"github_public_v1","parent_repo":null,"near_duplicate_slugs":[]},"computed_at":"2026-08-21T18:02:21.381Z","maintenance":{"label":"Very active","score":96,"methodology":"github_public_v1","releases_90d":1,"days_since_push":6,"last_release_at":"2026-07-31T18:15:09Z","stars_delta_30d":19,"open_issues_delta_30d":-3},"security_summary":{"status":"no_lockfile","scanner":null,"low_count":0,"high_count":0,"last_scan_at":"2026-07-11T11:27:03.477Z","medium_count":0,"scan_profile":"none","critical_count":0}},"capability_facts":{"scan":{"source":"repo_scan","observed_at":"2026-08-21T18:02:22.039Z"},"deploy":{"source":"dockerfile:Dockerfile","self_host":true,"observed_at":"2026-08-21T18:02:22.039Z","managed_saas":false},"languages":{"value":["python"],"source":"github.language","observed_at":"2026-08-21T18:02:22.039Z"},"has_docker":{"value":true,"source":"dockerfile:Dockerfile","observed_at":"2026-08-21T18:02:22.039Z"},"license_spdx":{"value":"MIT","source":"github.license","observed_at":"2026-08-21T18:02:22.039Z"}},"decision_facts":{"hosting":null,"pricing":null,"requirements":null,"constraints":null,"when_to_use":["When you need rapid integration of REST API services for Retrieval-Augmented Generation (RAG) with robust vector storage.","If your use case benefits from the efficiency of PostgreSQL/pgvector combination, where scalable vector search operations are required."],"when_not_to_use":["Avoid using if your project cannot leverage PostgreSQL/pgvector due to license or compatibility constraints.","Not recommended for scenarios where high-level orchestration of multiple APIs and services is necessary without a direct need for FastAPI's simplicity."],"source":"enrich:decision_facts","observed_at":"2026-07-11T20:49:08.428Z"},"constraint_facets":null,"decision_summary":[{"label":"Adopt for","value":"Key Insights for Using rag_api as an ID-based RAG FastAPI Tool with Langchain and PostgreSQL/pgvector Integration"}]}}