Ocean.
Project description
Ocean 🌊🐠
Ocean is a powerful, flexible, and easy-to-use library for cross-modal and modality-specific searching. It provides a unified interface for embedding and querying text, images, and audio. Ocean leverages the latest advancements in deep learning and the power of the ImageBind Embedding model to deliver unparalleled search accuracy and performance.
pip install https://github.com/kyegomez/Ocean.git # python client
# for javascript, npm install oceandb!
# for client-server mode, docker-compose up -d --build
The core API is only 4 functions (run our 💡 Google Colab or Replit template):
import oceandb
api = oceandb.Client()
print(api.heartbeat())
from oceandb.utils.embedding_functions import MultiModalEmbeddingFunction
# setup Ocean in-memory, for easy prototyping. Can add persistence easily!
client = oceandb.Client()
#text
text_embedding_function = MultiModalEmbeddingFunction(modality="text")
#vision
#vision_embedding_function = MultiModalEmbeddingFunction(modality="vision")
#audio
#audio_embedding_function = MultiModalEmbeddingFunction(modality="audio")
# # Create collection. get_collection, get_or_create_collection, delete_collection also available and add embedding function
collection = client.create_collection("all-my-documents", embedding_function=text_embedding_function)
text_data = ['This is a query about artificial intelligence']
#test
test = collection.add(
documents=text_data,
ids=['doc1']
)
print(test)
#query result
results = collection.query(
query_texts=[query_text],
n_results=1
)
print(f"Query texts {query_text}")
print("Most similar document:", results['documents'][0][0])
Features
- Simple: Fully-typed, fully-tested, fully-documented == happiness
- Integrations:
🦜️🔗 LangChain
(python and js),🦙 LlamaIndex
and more soon - Dev, Test, Prod: the same API that runs in your python notebook, scales to your cluster
- Feature-rich: Queries, filtering, density estimation and more
- Free & Open Source: Apache 2.0 Licensed
Use case: ChatGPT for __
For example, the "Chat your data"
use case:
- Add documents to your database. You can pass in your own embeddings, embedding function, or let Ocean embed them for you.
- Query relevant documents with natural language.
- Compose documents into the context window of an LLM like
GPT3
for additional summarization or analysis.
Embeddings?
What are embeddings?
- Read the guide from OpenAI
- Literal: Embedding something turns it from image/text/audio into a list of numbers. 🖼️ or 📄 =>
[1.2, 2.1, ....]
. This process makes documents "understandable" to a machine learning model. - By analogy: An embedding represents the essence of a document. This enables documents and queries with the same essence to be "near" each other and therefore easy to find.
- Technical: An embedding is the latent-space position of a document at a layer of a deep neural network. For models trained specifically to embed data, this is the last layer.
- A small example: If you search your photos for "famous bridge in San Francisco". By embedding this query and comparing it to the embeddings of your photos and their metadata - it should return photos of the Golden Gate Bridge.
Embeddings databases (also known as vector databases) store embeddings and allow you to search by nearest neighbors rather than by substrings like a traditional database. By default, Ocean uses ImageBind to embed for you but you can also use OpenAI embeddings, Cohere (multilingual) embeddings, or your own.
Roadmap 🗺️
- Integrate the new 3 loss functions (conditional, cross-modal, and unimodality)
- Integrate ImageBind model to embed images, text, and audio as a native embedder
- Implement a method to choose query algorithm:
query([vectors], search_algorithm="knn")
- Implement shapeless and polymorphic support
- Explore the integration of database worker agents that manage the embedding, tokenization, and indexation (like a swarm)
- Implement an endless context length embedding model
- Enable running the ImageBind embedding model offline in a database repository
- Allow users to choose modality in the upsert method
- Deploy ImageBind as an API and increase context length
Get involved at Agora
Ocean is a rapidly developing project. We welcome PR contributors and ideas for how to improve the project.
- Join the conversation on Discord
- Review the roadmap and contribute your ideas
- Grab an issue and open a PR
License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file oceandb-0.1.0.tar.gz
.
File metadata
- Download URL: oceandb-0.1.0.tar.gz
- Upload date:
- Size: 2.8 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.3.2 CPython/3.11.0 Darwin/22.4.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b343bdebd2e87d872ff815b723e23678570a3bc8b641dd3198202e42686dc297 |
|
MD5 | 3b53eacde5132227687c4038c6d9f64f |
|
BLAKE2b-256 | 6523544b4d343426e29cdd3083be5417c0340e1111c9c38f3f31ee54c22e8759 |
File details
Details for the file oceandb-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: oceandb-0.1.0-py3-none-any.whl
- Upload date:
- Size: 2.8 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.3.2 CPython/3.11.0 Darwin/22.4.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0e9af73864e93ee6d7e9dedaa30a19d5894fc88dfcb90b196e933071ea09f4c9 |
|
MD5 | e03d6266b06eacfb6fd217ad874328bc |
|
BLAKE2b-256 | 1e3cf64a29f6e8f98d224e656d3a27576e11e0162df23a28737a1d7b63e07fdb |