{"id":23655938,"url":"https://github.com/rupeshtr78/pg-vector-embed-rust","last_synced_at":"2025-09-01T06:33:03.535Z","repository":{"id":269108987,"uuid":"900545754","full_name":"rupeshtr78/pg-vector-embed-rust","owner":"rupeshtr78","description":"Pg Vector Embedding Rust","archived":false,"fork":false,"pushed_at":"2024-12-28T05:06:13.000Z","size":96,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-12-28T06:18:20.089Z","etag":null,"topics":["embeddings","llm","model","pg-vector","postgresql","rust","rust-lang","vector-database"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rupeshtr78.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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-12-09T02:31:47.000Z","updated_at":"2024-12-28T05:06:17.000Z","dependencies_parsed_at":"2024-12-21T01:24:55.075Z","dependency_job_id":"234604ca-7026-4793-9345-f8ca3220d1df","html_url":"https://github.com/rupeshtr78/pg-vector-embed-rust","commit_stats":null,"previous_names":["rupeshtr78/pg-vector-embed-rust"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rupeshtr78%2Fpg-vector-embed-rust","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rupeshtr78%2Fpg-vector-embed-rust/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rupeshtr78%2Fpg-vector-embed-rust/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rupeshtr78%2Fpg-vector-embed-rust/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rupeshtr78","download_url":"https://codeload.github.com/rupeshtr78/pg-vector-embed-rust/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":231670580,"owners_count":18408702,"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":["embeddings","llm","model","pg-vector","postgresql","rust","rust-lang","vector-database"],"created_at":"2024-12-28T20:16:57.499Z","updated_at":"2024-12-28T20:16:57.939Z","avatar_url":"https://github.com/rupeshtr78.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PG Vector Embedding and Query Rust\n\nThis repository contains a Rust-based system for managing vector embeddings and querying them using a PostgreSQL-backed vector database. The system is designed to handle embedding generation, storage, and querying.\n\n## Table of Contents\n\n- [Overview](#overview)\n- [Features](#features)\n- [Directory Structure](#directory-structure)\n- [Getting Started](#getting-started)\n  - [Prerequisites](#prerequisites)\n  - [Installation](#installation)\n  - [Running the Application](#running-the-application)\n- [Usage](#usage)\n  - [Commands](#commands)\n  - [Configuration](#configuration)\n  - [Embedding and Querying](#embedding-and-querying)\n- [Testing](#testing)\n- [Contributing](#contributing)\n- [License](#license)\n\n## Overview\n\nThe system is composed of several modules that handle different aspects of the embedding and querying process:\n\n- **Commands**: Handles command-line arguments and subcommands.\n- **Config**: Manages configuration settings for embedding requests and database connections.\n- **Constants**: Provides constant values used throughout the application.\n- **Embedding**: Contains logic for generating embeddings and persisting them to the database.\n- **VectorDB**: Handles interactions with the PostgreSQL database for storing and querying vector embeddings.\n\n## Features\n\n- **Embedding Generation**: Generate vector embeddings from input data.\n- **Database Persistence**: Store embeddings in a PostgreSQL database.\n- **Querying**: Query the database to find nearest neighbors based on vector embeddings.\n\n## Directory Structure\n\n```\nsrc/\n├── app/\n│   ├── commands.rs\n│   ├── config.rs\n│   └── constants.rs\n├── embedding/\n│   ├── run_embedding.rs\n│   └── vector_embedding.rs\n├── main.rs\n├── tests/\n│   ├── setup_docker.rs\n│   ├── test_pgclient.rs\n│   ├── test_query_vector.rs\n│   ├── test_run_embedding.rs\n│   └── test_vector_embedding.rs\n├── vectordb/\n│   ├── pg_vector.rs\n│   └── query_vector.rs\n├── lib.rs\n├── vectordb/mod.rs\n├── tests/mod.rs\n├── embedding/mod.rs\n└── app/mod.rs\n```\n\n## Getting Started\n\n### Prerequisites\n\n- Rust (latest stable version)\n- PostgreSQL Vector Db.\n- Docker (for running tests)\n- Active Ollama Service with `nomic-embed-text` or similar model. \n\n### Installation\n\n1. Clone the repository:\n   ```sh\n   git clone https://github.com/rupeshtr78/pg-vector-embed-rust.git\n   cd pg-vector-embed-rust\n   ```\n\n2. Install dependencies:\n   ```sh\n   cargo build\n   ```\n\n### Running the Application\n\n1. Start the PostgreSQL vector database (if not already running).\n2. Ollama service should be running with the specified model.\n\n3. Run the application:\n   ```sh\n   cargo run\n      \n\n   ```\n\n## Usage\n\n### Commands\n\nThe application supports various commands and subcommands. Use the `--help` flag to see available options:\n\n```sh\n   cargo run -- --help\n   cargo run -- write --input \"dog sound is called bark\" --input \"cat sounds is called purr\" --model \"nomic-embed-text\" --table \"from_rust2\" --dim 768 --log-level \"debug\"\n   cargo run -- query --input \"who is barking\" --model \"nomic-embed-text\" --table \"from_rust2\"  \n```\n\n### Configuration\n\nConfiguration settings for embedding requests and database connections are managed in `src/app/config.rs`. You can modify these settings as needed.\n\n### Embedding and Querying\n\n- **Generate Embeddings**: Use the `run_embedding` function to generate embeddings and persist them to the database.\n- **Query Embeddings**: Use the `run_query` function to query the database for nearest neighbors based on vector embeddings.\n\n## Testing\n\nThe test suite requires postgres vectordb and ollama with embedding model to be running in the correct configuration.\n\n```sh\ncargo test\n```\n\n## Contributing\n\nContributions are welcome! Please read the [CONTRIBUTING.md](CONTRIBUTING.md) file for details on how to contribute to this project.\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n---\n\nFeel free to customize this README further based on your specific needs and project details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frupeshtr78%2Fpg-vector-embed-rust","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frupeshtr78%2Fpg-vector-embed-rust","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frupeshtr78%2Fpg-vector-embed-rust/lists"}