{"id":18656417,"url":"https://github.com/cherninlab/vertex-rag-flask","last_synced_at":"2025-07-31T04:05:20.264Z","repository":{"id":261514875,"uuid":"883651484","full_name":"cherninlab/vertex-rag-flask","owner":"cherninlab","description":"Flask application for building RAG systems using Google Vertex AI. ","archived":false,"fork":false,"pushed_at":"2024-11-15T09:28:53.000Z","size":44,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-12-27T14:44:30.391Z","etag":null,"topics":["flask","vertex-ai"],"latest_commit_sha":null,"homepage":"","language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cherninlab.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-11-05T10:43:47.000Z","updated_at":"2024-11-15T09:28:56.000Z","dependencies_parsed_at":"2024-12-27T14:43:13.400Z","dependency_job_id":null,"html_url":"https://github.com/cherninlab/vertex-rag-flask","commit_stats":null,"previous_names":["cherninlab/vertex-rag-flask"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cherninlab%2Fvertex-rag-flask","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cherninlab%2Fvertex-rag-flask/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cherninlab%2Fvertex-rag-flask/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cherninlab%2Fvertex-rag-flask/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cherninlab","download_url":"https://codeload.github.com/cherninlab/vertex-rag-flask/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239471616,"owners_count":19644350,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["flask","vertex-ai"],"created_at":"2024-11-07T07:23:28.441Z","updated_at":"2025-02-18T12:33:08.682Z","avatar_url":"https://github.com/cherninlab.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Vertex RAG Flask\n\n[![Python 3.11+](https://img.shields.io/badge/python-3.11+-blue.svg)](https://www.python.org/downloads/)\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n![Tests](https://github.com/cherninlab/vertex-rag-flask/actions/workflows/ci.yml/badge.svg)\n\nFlask application for building RAG (Retrieval Augmented Generation) systems using Google Vertex AI. Process PDFs with layout-aware parsing, chat with documents in multiple languages, and build AI-powered document analysis systems.\n\n## Installation\n\n1. Clone the repository:\n\n```bash\ngit clone https://github.com/cherninlab/vertex-rag-flask.git\ncd vertex-rag-flask\n```\n\n2. Set up Python environment:\n\n```bash\npython -m venv .venv\nsource .venv/bin/activate  # On Windows: .venv\\Scripts\\activate\npip install --upgrade pip\n```\n\n3. Install the project:\n\n```bash\npip install -e \".[dev]\"\n```\n\n4. Configure environment:\n\n```bash\ncp .env.example .env\n# Edit .env with your configuration:\n# - Add your Google Cloud Project ID\n# - Set path to service account credentials\n```\n\n5. Run the application:\n\n```bash\nflask run\n```\n\n## Google Cloud Setup\n\n1. Create a new project in [Google Cloud Console](https://console.cloud.google.com/)\n\n2. Enable required APIs:\n\n```bash\n# Enable Vertex AI API\ngcloud services enable aiplatform.googleapis.com\n\n# Enable Cloud Storage API\ngcloud services enable storage.googleapis.com\n\n# Enable IAM API\ngcloud services enable iam.googleapis.com\n```\n\n3. Create and configure service account:\n\n```bash\n# Create service account\ngcloud iam service-accounts create vertex-rag-sa --display-name=\"Vertex RAG Service Account\"\n\n# Grant Vertex AI user role\ngcloud projects add-iam-policy-binding YOUR_PROJECT_ID --member=\"serviceAccount:vertex-rag-sa@YOUR_PROJECT_ID.iam.gserviceaccount.com\" --role=\"roles/aiplatform.user\"\n\n# Grant Storage Admin role (for bucket and file management)\ngcloud projects add-iam-policy-binding YOUR_PROJECT_ID --member=\"serviceAccount:vertex-rag-sa@YOUR_PROJECT_ID.iam.gserviceaccount.com\" --role=\"roles/storage.admin\"\n\n# Download credentials\ngcloud iam service-accounts keys create credentials.json --iam-account=vertex-rag-sa@YOUR_PROJECT_ID.iam.gserviceaccount.com\n```\n\n**Important Notes:**\n\n- Keep your credentials.json secure and never commit it to version control\n- The service account needs both Vertex AI and Storage permissions to function properly\n- You can use more granular permissions instead of storage.admin if needed\n\n## Usage \n\n1. Start the application:\n\n```bash\nflask run\n# FLASK_DEBUG=1 FLASK_APP=src/app flask run --debug\n```\n\n2. Open http://localhost:5000 in your browser\n\n3. Upload a document\n\n4. After processing, you'll be redirected to the chat interface\n\n## Development\n\n### Project Structure\n\n```\nvertex-rag-flask/\n├── src/\n│   ├── app/\n│   │   ├── routes/      # API and web routes\n│   │   ├── services/    # Business logic\n│   │   ├── templates/   # HTML templates\n│   │   └── utils/       # Helper functions\n│   └── config/          # Configuration\n├── tests/               # Test files\n├── uploads/             # Temporary upload directory\n├── credentials.json     # GCP service account key\n├── pyproject.toml       # Project dependencies\n└── README.md\n```\n\n### System Requirements\n\n- Python 3.11+\n- Google Cloud Project with enabled APIs\n- Service account with appropriate permissions\n\n### Running Tests\n\n```bash\n# Run pytest\npytest\n\n# Run type checking\nmypy .\n\n# Run linting\nflake8 .\n```\n\n### Code Style\n\nThe project uses several tools to maintain code quality:\n\n- **black**: Code formatting\n- **isort**: Import sorting\n- **flake8**: Style guide enforcement\n- **mypy**: Static type checking\n\nThese are automatically run as pre-commit hooks when you commit changes.\n\n### Using Dev Containers\n\nIf you use VS Code:\n\n1. Install the \"Remote - Containers\" extension\n2. Open the project\n3. Click \"Reopen in Container\" when prompted\n4. VS Code will set up the development environment automatically\n\n## Troubleshooting\n\n### Common Issues\n\n1. **Permission Denied Errors**\n\n   - Verify that your service account has all required roles\n   - Check if credentials.json is properly configured\n   - Ensure APIs are enabled in your project\n\n2. **Upload Failures**\n\n   - Verify the file format is supported\n   - Check if the selected bucket exists\n   - Ensure your service account has storage permissions\n\n3. **Chat Not Working**\n   - Verify Vertex AI API is enabled\n   - Check if the model has access to your document\n   - Ensure proper network connectivity\n\n## Contributing\n\nContributions are welcome!\n\n## License\n\nDistributed under the MIT License. See `LICENSE` for more information.\n\n---\n\n⭐ If you find this project useful, please consider giving it a star! It helps make the project more visible and encourages development.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcherninlab%2Fvertex-rag-flask","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcherninlab%2Fvertex-rag-flask","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcherninlab%2Fvertex-rag-flask/lists"}