Giter VIP home page Giter VIP logo

qdrant's Introduction

Qdrant Elixir Client

⚠️ This library is under active development and is subject to change. Please use the latest version from GitHub ⚠️

An Elixir client for the Qdrant vector similarity search engine. This library provides a convenient way to interact with the Qdrant API, offering functionality to create collections, insert vectors, search, delete data, and more.

Hex.pm Hex.pm Hex.pm

Installation

It's available in Hex, the package can be installed by adding qdrant to your list of dependencies in mix.exs:

def deps do
  [
    {:qdrant, "~> 0.8.0"}
    # Or use the latest version from GitHub | Recommended during development phase
    {:qdrant, git: "[email protected]:marinac-dev/qdrant.git"},
  ]
end

Config

config :qdrant,
  port: 6333,
  interface: "rest", # gRPC not yet supported
  database_url: System.get_env("QDRANT_DATABASE_URL"),
  # If you are using cloud version of Qdrant, add API key
  api_key: System.get_env("QDRANT_API_KEY")

Usage

The Qdrant Elixir Client provides a simple interface for interacting with the Qdrant API. For example, you can create a new collection, insert vectors, search, and delete data using the provided functions.

collection_name = "my-collection"

# Create a new collection
# The vectors are 1536-dimensional (because of OpenAi embedding) and use the Cosine distance metric
Qdrant.create_collection(collection_name, %{vectors: %{size: 1536, distance: "Cosine"}})

# Create embeddings for some text
vector1 = OpenAi.embed_text("Hello world")
vector2 = OpenAi.embed_text("This is OpenAI")

# Now we can insert the vectors with batch
Qdrant.upsert_points(collection_name, %{batch: %{ids: [1,2], vectors: [vector1, vector2]}})
# Or one by one
Qdrant.upsert_point(collection_name, %{points: [%{id: 1, vector: vector1}, %{id: 2, vector: vector2}]})

# Search for similar vectors
vector3 = OpenAi.embed_text("Hello world!")
Qdrant.search(collection_name, %{vector: vector3, limit: 3})

Contributing

  • Fork the repository
  • Create a branch for your changes
  • Make your changes
  • Run mix format to format your code

Change Log

Generate change log with git-chglog -o CHANGELOG.md

License

This project is licensed under the MIT License - see the LICENSE file for details

qdrant's People

Contributors

marinac-dev avatar yusefmosiah 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.