{"id":14983568,"url":"https://github.com/ricardo-larosa/colbert-rag","last_synced_at":"2026-02-07T23:33:47.572Z","repository":{"id":250716296,"uuid":"835191347","full_name":"ricardo-larosa/colbert-rag","owner":"ricardo-larosa","description":"Index GitHub repositories to ColBERT models and serve them with GRPC or FastAPI","archived":false,"fork":false,"pushed_at":"2024-08-15T12:25:51.000Z","size":229,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-30T13:49:02.022Z","etag":null,"topics":["artificial-intelligence","colbert","fastapi","git","grpc","langchain","llms","machine-learning","rag"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ricardo-larosa.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-07-29T10:46:43.000Z","updated_at":"2024-08-22T13:47:36.000Z","dependencies_parsed_at":"2024-09-24T15:24:36.540Z","dependency_job_id":"fdc8f26a-434b-4c06-8f59-c8b7d6c2f584","html_url":"https://github.com/ricardo-larosa/colbert-rag","commit_stats":{"total_commits":58,"total_committers":1,"mean_commits":58.0,"dds":0.0,"last_synced_commit":"aa4af2351514e517fc87a876617faaa9052f3ccf"},"previous_names":["ricardo-larosa/colbert-rag"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/ricardo-larosa/colbert-rag","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ricardo-larosa%2Fcolbert-rag","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ricardo-larosa%2Fcolbert-rag/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ricardo-larosa%2Fcolbert-rag/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ricardo-larosa%2Fcolbert-rag/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ricardo-larosa","download_url":"https://codeload.github.com/ricardo-larosa/colbert-rag/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ricardo-larosa%2Fcolbert-rag/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29212669,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-07T23:14:30.912Z","status":"ssl_error","status_checked_at":"2026-02-07T23:14:17.253Z","response_time":63,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["artificial-intelligence","colbert","fastapi","git","grpc","langchain","llms","machine-learning","rag"],"created_at":"2024-09-24T14:07:26.961Z","updated_at":"2026-02-07T23:33:47.557Z","avatar_url":"https://github.com/ricardo-larosa.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ColBERT RAG\nIndex GitHub repositories to ColBERT models and serve them with GRPC or FastAPI.\n\n## Features\n\n- ColBERT-based retrieval for contextually influenced token-level embeddings\n- Support for indexing Git repositories with language specific chunking \n- GRPC and FastAPI server implementations\n- Flexible document processing and indexing\n\n## License\n\nThis project is licensed under the Apache License 2.0 - see the [LICENSE](LICENSE) file for details.\n\nThe Apache License 2.0 is a permissive license that also provides an express grant of patent rights from contributors to users. Key points:\n\n- It allows you to freely use, modify, distribute, and sell your software.\n- If you modify the code, you may distribute your modified version, but you must include a notice stating that you changed the files.\n- Any modifications or larger works may be distributed under different terms and without source code, but they must include a copy of the Apache 2.0 license.\n- You must retain all copyright, patent, trademark, and attribution notices from the original code.\n\n## Setup\n\n1. Install dependencies using Poetry:\n\n```sh\npoetry install\n```\n\n2. Generate protobuf files:\n\n```sh\npoetry run generate-protos\n```\n\n## Usage\n\n### Using Scripts\n\nThe project includes several utility scripts in the `/scripts` directory:\n\n1. Generate Protobuf Files:\n   ```sh\n   poetry run generate-protos\n   ```\n   This script generates the necessary Python files from the protobuf definition.\n\n2. Create Index:\n   ```sh\n   poetry run create-index --name \u003cindex_name\u003e  --repo_name username/repo-name --chunk_size 512\n   ```\n   This script creates an index from a specified Git repository.\n\n3. Run Server:\n   ```sh\n   poetry run server --type grpc|fastapi --index \u003cindex_name\u003e \n   ```\n\n4. Run Type Checking:\n   ```sh\n   poetry run type-check\n   ```\n   This script runs MyPy for type checking across the project.\n\n### Indexing a Git Repository\n\n```python\nfrom colbert_rag.indexer.git_repo import index_git_repo\n\nindex_path = index_git_repo(\n    model_name=\"colbert-ir/colbertv2.0\",\n    index_name=\"my-repo-index\",\n    repo_name=\"username/repo-name\",\n    max_document_length=512)\n```\n\n### Running the Server\n\n#### GRPC Server\n\n```python\nfrom ragatouille import RAGPretrainedModel\nfrom colbert_rag import GRPCServer\nfrom colbert_rag.config import COLBERTRAG_GRPC_PORT, COLBERTRAG_HOST\n\nmodel = RAGPretrainedModel.from_index(\"path/to/your/index\")\nserver = GRPCServer(model)\nserver.serve(COLBERTRAG_HOST, COLBERTRAG_GRPC_PORT)\n```\n\n#### FastAPI Server\n\n```python\nfrom ragatouille import RAGPretrainedModel\nfrom colbert_rag import FastAPIServer\nfrom colbert_rag.config import COLBERTRAG_FASTAPI_PORT, COLBERTRAG_HOST\n\nmodel = RAGPretrainedModel.from_index(\"path/to/your/index\")\nserver = FastAPIServer(model)\nserver.serve(COLBERTRAG_HOST, COLBERTRAG_FASTAPI_PORT)\n```\n\n### Client Examples\n\n#### GRPC Client\n\n```python\nimport grpc\nfrom colbert_rag.proto import colbertrag_pb2, colbertrag_pb2_grpc\n\ndef run():\n    with grpc.insecure_channel('localhost:50051') as channel:\n        stub = colbertrag_pb2_grpc.ColbertRAGStub(channel)\n        response = stub.Retrieve(colbertrag_pb2.Request(query=\"Your query here\", k=2))\n        print(\"ColbertRAG client received:\")\n        for doc in response.documents:\n            print(f\"Page content: {doc.page_content}\")\n            print(f\"Metadata: {doc.metadata}\")\n            print(\"---\")\n\nif __name__ == '__main__':\n    run()\n```\n\n#### FastAPI Client\n\nUsing Python with the `requests` library:\n\n```python\nimport requests\nimport json\n\nurl = \"http://localhost:8000/retrieve\"\npayload = {\n    \"query\": \"Your query here\",\n    \"k\": 2\n}\nheaders = {\n    \"Content-Type\": \"application/json\"\n}\n\nresponse = requests.post(url, data=json.dumps(payload), headers=headers)\n\nif response.status_code == 200:\n    data = response.json()\n    print(\"ColbertRAG client received:\")\n    for doc in data[\"documents\"]:\n        print(f\"Page content: {doc['page_content']}\")\n        print(f\"Metadata: {doc['metadata']}\")\n        print(\"---\")\nelse:\n    print(f\"Error: {response.status_code}\")\n    print(response.text)\n```\n\nUsing curl:\n\n```sh\ncurl -X POST \"http://localhost:8000/retrieve\" \\\n     -H \"Content-Type: application/json\" \\\n     -d '{\"query\": \"Your query here\", \"k\": 2}'\n```\n\n## Development\n\n### Type Checking\n\nRun MyPy for type checking:\n\n```sh\npoetry run type-check\n```\n\n### Running Tests\n\n```sh\npoetry run pytest\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fricardo-larosa%2Fcolbert-rag","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fricardo-larosa%2Fcolbert-rag","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fricardo-larosa%2Fcolbert-rag/lists"}