• Stars
    star
    341
  • Rank 121,581 (Top 3 %)
  • Language
    Python
  • License
    Apache License 2.0
  • Created over 1 year ago
  • Updated 5 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Search docs.voxel51.com with an LLM!

Search the FiftyOne Docs with an LLM

This repository contains the code to enable semantic search on the Voxel51 documentation from Python or the command line. The search is powered by FiftyOne, OpenAI's text-embedding-ada-002 model, and Qdrant vector search.

'fiftyone-docs-search-cli'

Installation

  1. Clone the repository:
git clone https://github.com/voxel51/fiftyone-docs-search
cd fiftyone-docs-search
  1. Install the package:
pip install -e .
  1. Register your OpenAI API key (create one):
export OPENAI_API_KEY=XXXXXXXX
  1. Launch a Qdrant server:
docker pull qdrant/qdrant
docker run -d -p 6333:6333 qdrant/qdrant

Usage

Command line

The fiftyone-docs-search package provides a command line interface for searching the Voxel51 documentation. To use it, run:

fiftyone-docs-search query <query>

where <query> is the search query. For example:

fiftyone-docs-search query "how to load a dataset"

The following flags can give you control over the search behavior:

  • --num_results: the number of results returned
  • --open_url: whether to open the top result in your browser
  • --score: whether to return the score of each result
  • --doc_types: the types of docs to search over (e.g., "tutorials", "api", "guides")
  • --block_types: the types of blocks to search over (e.g., "code", "text")

You can also use the --help flag to see all available options:

fiftyone-docs-search --help

Aliasing the command

If you find fiftyone-docs-search query cumbersome, you can alias the command, by adding the following to your ~/.bashrc or ~/.zshrc file:

alias fosearch='fiftyone-docs-search query'

Python

'fiftyone-docs-search-python'

The fiftyone-docs-search package also provides a Python API for searching the Voxel51 documentation. To use it, run:

from fiftyone.docs_search import FiftyOneDocsSearch

fods = FiftyOneDocsSearch()
results = fods("how to load a dataset")

You can set defaults for the search behavior by passing arguments to the constructor:

fods = FiftyOneDocsSearch(
    num_results=5,
    open_url=True,
    score=True,
    doc_types=["tutorials", "api", "guides"],
    block_types=["code", "text"],
)

For any individual search, you can override these defaults by passing arguments.

Versioning

The fiftyone-docs-search package is versioned to match the version of the Voxel51 FiftyOne documentation that it is searching. For example, the v0.20.1 version of the fiftyone-docs-search package is designed to search the v0.20.1 version of the Voxel51 FiftyOne documentation.

Building the index from scratch

By default, if you do not have a Qdrant collection instantiated yet, when you run a search, the fiftyone-docs-search package will automatically download a JSON file containing a vector indexing of the latest version of the Voxel51 FiftyOne documentation.

If you would like, you can also build the index yourself from a local copy of the Voxel51 FiftyOne documentation. To do so, first clone the FiftyOne repo if you haven't already:

git clone https://github.com/voxel51/fiftyone

and install FiftyOne, as described in the detailed installation instructions here.

Build a local version of the docs by running:

bash docs/generate_docs.bash

Then, set a FIFTYONE_DIR environment variable to the path to the local FiftyOne repo. For example, if you cloned the repo to ~/fiftyone, you would run:

export FIFTYONE_DIR=~/fiftyone

Finally, run the following command to build the index:

fiftyone-docs-search create

If you would like to save the Qdrant index to JSON, you can run:

fiftyone-docs-search save -o <path to JSON file>

Contributing

Contributions are welcome!

About FiftyOne

If you've made it this far, we'd greatly appreciate if you'd take a moment to check out FiftyOne and give us a star!

FiftyOne is an open source library for building high-quality datasets and computer vision models. It's the engine that powers this project.

Thanks for visiting! 😊

Join the Community

If you want join a fast-growing community of engineers, researchers, and practitioners who love computer vision, join the FiftyOne Slack community! πŸš€πŸš€πŸš€

More Repositories

1

fiftyone

The open-source tool for building high-quality datasets and computer vision models
Python
6,888
star
2

voxelgpt

AI assistant that can query visual datasets, search the FiftyOne docs, and answer general computer vision questions
Python
223
star
3

fiftyone-examples

Examples of using FiftyOne
Python
191
star
4

papers-with-data

A curated list of papers that released datasets along with their work
Python
124
star
5

fiftyone-plugins

A curated list of plugins that you can add to your FiftyOne install!
Python
93
star
6

eta

ETA: Extensible Toolkit for Analytics
Python
29
star
7

badger

Python CLI for creating, saving, and managing custom badges
Python
9
star
8

platform-sdk

SDK for the Voxel51 Platform
Python
6
star
9

pandemic51

Voxel51's website for monitoring the impact of the Coronavirus pandemic
Jupyter Notebook
6
star
10

api-py

Python Client Library for the Voxel51 Platform
Python
4
star
11

player51

Player51 is a client-side JavaScript media player that can render metadata overlays on images and video
JavaScript
4
star
12

cvpr-mobile-hdr

Python
4
star
13

platform-integrations

Example Integrations for the Voxel51 Platform
Python
3
star
14

fiftyone_mlflow_plugin

Track model training experiments with MLflow and FiftyOne!
Python
3
star
15

api-js

JavaScript Client Library for the Voxel51 Platform
JavaScript
2
star
16

fiftyone_mlflow_integration

A repo that shows a demo of a mlflow and fiftyone integration
Jupyter Notebook
2
star
17

fiftyone-teams-app-deploy

Deployment Assets for the Fiftyone Teams App
Go
1
star
18

upptime

URL Monitoring for Voxel51
Markdown
1
star
19

fiftyone-huggingface-plugins

Hugging Face Plugins for FiftyOne
Python
1
star