Coder Social home page Coder Social logo

rust-vector-search's Introduction

Qdrant Client Example in Rust

This project demonstrates the integration and basic usage of the qdrant_client with Rust to interact with a Qdrant vector database. Qdrant is a vector search engine that allows for efficient storage and retrieval of high-dimensional vectors, making it suitable for tasks like similarity search, machine learning model outputs, or any scenario requiring nearest neighbor searches.

Overview

The provided Rust example covers a comprehensive workflow with the Qdrant vector database, including:

  • Establishing a connection with the Qdrant database.
  • Listing existing collections in the database.
  • Creating and deleting a collection.
  • Inserting vector data with associated JSON payloads.
  • Performing a vector similarity search with payload filtering.

This example showcases how to utilize asynchronous Rust programming with the tokio runtime to interact with Qdrant, handling vector data, and performing complex searches.

Requirements

To run this example, ensure you have the following:

  • Rust programming environment.
  • tokio runtime for asynchronous operations.
  • qdrant_client to interact with Qdrant.
  • serde_json for JSON serialization and deserialization.
  • A running Qdrant server (locally or hosted).

Usage

  1. Setting up Qdrant: Make sure you have a Qdrant server running and accessible. By default, this example assumes the server is available at http://localhost:6334.

  2. Dependencies: Add the necessary dependencies to your Cargo.toml:

    [dependencies]
    anyhow = "1.0"
    tokio = { version = "1", features = ["full"] }
    qdrant_client = "0.1"
    serde_json = "1.0"
  3. Running the Example: The provided Rust script can be executed as a standalone application. It performs the following operations in sequence:

    • Connection: Establishes a connection with the Qdrant server.
    • List Collections: Retrieves and displays a list of existing collections in the database.
    • Create/Delete Collection: Demonstrates how to create a new collection named test, and if it already exists, deletes it before recreation.
    • Insert Data: Inserts a point into the test collection with a 10-dimensional vector and an associated JSON payload.
    • Search: Performs a search for vectors similar to the given query vector, filtering results based on payload values, and retrieves the associated payload.
    • Display Result: Extracts and prints a specific part of the payload (baz) from the search results.
  4. Output: The example's execution will log various stages of interaction with Qdrant, including creating collections, inserting data, and the results of the vector search.

Conclusion

This Rust example offers a basic framework for integrating and leveraging the Qdrant vector database for vector similarity searches and managing vector data collections. It demonstrates essential operations like collection management, data insertion, and executing filtered search queries, providing a foundation for building more complex vector database interactions in Rust applications.

rust-vector-search's People

Contributors

sanjeev-one avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.