Giter Site home page Giter Site logo

qdrant_template's Introduction

Qdrant template in python

This project shows how to use Qdrant for vector search alongside OpenAI embeddings with docker version of qdrant.

Installation

  1. Clone this repo
  2. Run the following command to automatically detect your platform and install Docker:
curl -fsSL https://get.docker.com -o get-docker.sh
sh get-docker.sh
  1. Install requirements: pip install -r requirements.txt
  2. Get an OpenAI API key and add it to .env as OPENAI_API_KEY
  3. Start the Qdrant server:
docker compose up -d

This will run a Qdrant server on port 6333 with the provided config.

Usage

The main functions are:

  • insert_data - Takes a collection name, payload list, and data list. It embeds the data with OpenAI, structures it into Qdrant points, and inserts them into the collection.

  • search_data - Takes a search term, collection name, and result limit. It embeds the search term with OpenAI and searches the Qdrant collection, returning the top matches.

To insert data:

insert_data("test", [{"data":"doc1"}, {"data":"doc2"}], ["Text for doc1", "Text for doc2"]) 

To search:

results = search_data("search text", "test")

The results will contain score, vector, and payload for each match.

See the bottom of the main code sample for example usage.

Configuration

The Qdrant server uses the provided docker-compose.yml file and config. Environment variables are loaded from .env.

The default OpenAI model is text-embedding-ada-002 but this can be changed.

The Qdrant client connects to the server on port 6333 by default.

qdrant_template's People

Contributors

testpersonal avatar uussoop 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.