{"id":14971875,"url":"https://github.com/grafana/vectorapi","last_synced_at":"2025-10-19T10:31:39.602Z","repository":{"id":204662023,"uuid":"685120085","full_name":"grafana/vectorapi","owner":"grafana","description":"pgvector + embeddings API","archived":true,"fork":false,"pushed_at":"2023-12-14T13:00:07.000Z","size":572,"stargazers_count":19,"open_issues_count":3,"forks_count":4,"subscribers_count":115,"default_branch":"main","last_synced_at":"2025-01-29T11:52:08.036Z","etag":null,"topics":["document-retrieval","embeddings","llms","pgvector"],"latest_commit_sha":null,"homepage":"https://grafana.github.io/vectorapi/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/grafana.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":"2023-08-30T14:59:06.000Z","updated_at":"2025-01-24T10:48:58.000Z","dependencies_parsed_at":null,"dependency_job_id":"c93dc31a-2bde-4038-885b-64d1482687a6","html_url":"https://github.com/grafana/vectorapi","commit_stats":null,"previous_names":["grafana/vectorapi"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grafana%2Fvectorapi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grafana%2Fvectorapi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grafana%2Fvectorapi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grafana%2Fvectorapi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/grafana","download_url":"https://codeload.github.com/grafana/vectorapi/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":237110392,"owners_count":19257329,"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":["document-retrieval","embeddings","llms","pgvector"],"created_at":"2024-09-24T13:46:00.865Z","updated_at":"2025-10-19T10:31:39.014Z","avatar_url":"https://github.com/grafana.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"# VectorAPI\n\n[![License](https://img.shields.io/github/license/grafana/vectorapi)](LICENSE)\n[![Build Status](https://drone.grafana.net/api/badges/grafana/vectorapi/status.svg)](https://drone.grafana.net/grafana/vectorapi)\n[![Docker](https://img.shields.io/docker/v/grafana/vectorapi?logo=docker)](https://hub.docker.com/r/grafana/vectorapi/tags)\n[![API Docs](https://img.shields.io/badge/docs-api-blue)](https://grafana.github.io/vectorapi/)\n\nVectorAPI is a service for managing vector collections and performing vector similarity queries using a PostgreSQL vector database with the `pgvector` extension. Utilizes `fastapi` for the HTTP API, `pgvector` and SQLAlchemy for the vector database side and relies on `pytorch` for computing embeddings.\n\n## Getting started\n\n### Existing database\n\nTo get started with the VectorAPI, run:\n\n```sh\ndocker run -p 8889:8889 -e DB_URL=postgresql+asyncpg://\u003cuser\u003e:\u003cpassword\u003e@\u003chost\u003e:\u003cport\u003e/\u003cdbname\u003e grafana/vectorapi\n```\n\n### New database\n\nYou can bring up a postgres database (`ankane/pgvector`) and vectorapi instance using docker compose:\n\n```sh\ndocker compose up --build\n```\n\nTo populate the local DB instance with test data from HuggingFace (see [Grafana public datasets](https://huggingface.co/grafanalabs)) run:\n\n```sh\nmake populate-db\n```\n\n## Making requests\n\nSee [API docs](https://grafana.github.io/vectorapi/) for more details.\n\n### Embedding text\n\n```sh\ncurl -X POST \"http://localhost:8889/v1/embeddings\" \\\n    -H \"Content-Type: application/json\" \\\n    -d '{\"input\":\"I enjoy taking long walks along the beach.\", \"model\":\"BAAI/bge-small-en-v1.5\"}'\n```\n\n### Adding a vector to a collection\n\n1. Create a collection\n\n```sh\ncurl -X POST \"http://localhost:8889/v1/collections/create\" \\\n    -H \"Content-Type: application/json\" \\\n    -d '{\"collection_name\":\"my_collection\", \"dimension\":384}'\n```\n\n2. Add a vector to the collection\n\n```sh\ncurl -X POST \"http://localhost:8889/v1/collections/my_collection/upsert\" \\\n    -H \"Content-Type: application/json\" \\\n    -d '{\"id\":\"abc1\", \"metadata\":{\"key\":\"value\"}, \"input\":\"I enjoy taking long walks along the beach.\"}'\n```\n\n### Vector search\n\n```sh\ncurl -X POST \"http://localhost:8889/v1/collections/my_collection/search\" \\\n    -H \"Content-Type: application/json\" \\\n    -d '{\"input\":\"beach walks\"}'\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgrafana%2Fvectorapi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgrafana%2Fvectorapi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgrafana%2Fvectorapi/lists"}