Giter Club home page Giter Club logo

weaviate-examples's Introduction

Weaviate examples

List of examples and tutorials of how to use the Vector Search Engine Weaviate for cool machine-learning related tasks.

Running Weaviate

  • Most examples assume you have a Weaviate running. You can run one locally by following this installation guide in the documentation.
    • If you need a specific vectorizer module or another ML module, it will be explained in the tutorial.
  • Basic links: DocumentationGithub - Slack

Examples

Title Language Description
Semantic search through Wikipedia with the Weaviate vector search engine GraphQL Semantic search through a vectorized Wikipedia (SentenceBERT) with the Weaviate vector search engine
PyTorch-BigGraph Wikidata search with the Weaviate vector search engine GraphQL Search through Facebook Research's PyTorch BigGraph Wikidata-dataset with the Weaviate vector search engine
Multi-Modal Text/Image search using CLIP Bash, Javascript, React Use text to search through images using CLIP (multi2vec-clip). Also acts as a demo on how to use Weaviate with React
Google Colab notebook: Getting started with the Python Client python (Google Colab) Google Colab notebook to learn to get started with the Python client. Contains plenty of example code.
Demo dataset News Publications with Contextionary yaml Docker-compose configuration file of Weaviate with a News Publications demo dataset.
Demo dataset News Publications with Transformers, NER, Spellcheck and Q&A yaml Docker-compose configuration file of Weaviate with a News Publications demo dataset. The vectorization is done by a text2vec-transformers module, and the spellcheck, Q&A and Named Entity Recognition module are connected.
Weaviate simple schema Python Easy example of a schema and how to upload it to Weaviate with the Python client
Semantic search through wine dataset Python Easy example to get started with Weaviate and semantic search with the Transformers module
Unmask Superheroes in 5 steps using the Weaviate NLP module and the Python client Python Super simple 5 step guide to get started with the Weaviate NLP modules. This is a basic introduction to semantic search with Weaviate and the Python client.
Information Retrieval with BERT (Weaviate without vectorizer module) Python (Jupyter Notebook) In this example we are going to use Weaviate without vectorization module, and use it as pure vector database to use a BERT transformer to vectorize text documents, then retrieve the closest ones through Weaviate's Search
Text search with weaviate using own vectors Python A basic and simple example using our own vectors(obtained using SBERT, but any other model can also be used) in weaviate
Harry Potter Question Answering with Haystack & Weaviate Python (Jupyter/Colab notebook) A demo notebook showing how to use Weaviate as DocumentStore in Haystack.
Vegetable classification using image2vec-neural Python An image classification example made using image2vec-neural and flask to classify vegetable images
Exploring multi2vec-clip with Python and flask Python This example explores the multi2vec-clip module to implement an image and text combined search functionality.
Toxic Comment Classifier having GUI in Tkinter Python An example to classify comments as Toxic or Non Toxic
Plant information searching in NodeJs and Javascript NodeJs, Javascript A simple example to demonstrate how to use weaviate in NodeJs using Javascript APIs
Web App for movie recommendation NodeJs, Javascript An example demonstration how to easily make a movie recommender using weaviate
Generate Data profile for data stored in weaviate cluster Python, NodeJs, Javascript An example demonstration how to easily generate data profile for data in weaviate cluster using pandas library of python
Example with NER module of weaviate Python Minimal example to get started with and use NER module to extract useful data and store it
Workshop Vector Databases Python notebook Jupyter/Colab notebook to learn how to get started with Vector Search and Weaviate, given at Open Data Science Conference (ODSC) East 2022
Workshop Question Answering Python notebook Jupyter/Colab notebook to learn how to get started with Question Answering and Weaviate, given at Knowledge Graph Conference (KGC) 2022
Attendance system using image2vec-neural and own vectors Python This example uses image2vec-neural and has an option to use own vectors using OpenCV. It is a smart attendance system example
Monitoring Setup with Prometheus & Grafana yaml This example does not describe any use case, but rather shows a way of how to start, operate and configure Weaviate with Prometheus-Monitoring and a Grafana Instance with some sample dashboards.

weaviate-examples's People

Contributors

antas-marcin avatar asmitbm avatar bobvanluijt avatar dandv avatar databyjp avatar dudanogueira avatar dvanderrijst avatar erika-cardenas avatar etiennedi avatar laura-ham avatar lmangani avatar pkdyn avatar sebawita avatar shree3245 avatar sky-2002 avatar stefanbogdan avatar trengrj avatar weisisheng avatar yash-gu24 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

weaviate-examples's Issues

error occurs at update_embeddings

I have been trying https://github.com/weaviate/weaviate-examples/blob/main/harrypotter-qa-haystack-weaviate/JUPYTER-HarryPotter-QA-Haystack-Weaviate.ipynb a few times at my local machine.

My code is:

from haystack.utils

import clean_wiki_text
import pandas as pd

harry = pd.read_csv("https://s3.eu-central-1.amazonaws.com/deepset.ai-farm-qa/datasets/documents/harry_potter_wiki.csv")

dicts = []

for ix, row in harry.iterrows():
dic = {

    'content': clean_wiki_text(row.text),
    'meta': {
        'name': row['name'],
        'url': row.url
    }
}
dicts.append(dic)

from haystack.utils import launch_weaviate
launch_weaviate()
from haystack.document_stores import WeaviateDocumentStore
document_store = WeaviateDocumentStore() # assumes Weaviate is running on http://localhost:8080
document_store.write_documents(documents=dicts, batch_size=100)
from haystack.nodes import EmbeddingRetriever

retriever = EmbeddingRetriever(document_store=document_store, model_format="sentence_transformers", embedding_model="sentence-transformers/multi-qa-mpnet-base-dot-v1",)
document_store.update_embeddings(retriever)
from haystack.nodes import FARMReader
reader = FARMReader(model_name_or_path="deepset/tinyroberta-squad2", use_gpu=True)

everything went smooth until this line:

document_store.update_embeddings(retriever)

The error message is:

Exception has occurred: WeaviateDocumentStoreError
Query results contain errors: [{'locations': [{'column': 6, 'line': 1}], 'message': 'explorer: list class: search: invalid pagination params: query maximum results exceeded', 'path': ['Get', 'Document']}]
File "/home/ky/weaviate/harrypotter.py", line 26, in
document_store.update_embeddings(retriever)
haystack.document_stores.weaviate.WeaviateDocumentStoreError: Query results contain errors: [{'locations': [{'column': 6, 'line': 1}], 'message': 'explorer: list class: search: invalid pagination params: query maximum results exceeded', 'path': ['Get', 'Document']}]

Any idea how to resolve this?

Issue with slack link

When attempting to report an issue, the process recommends using Slack. However, the provided link is not functional unless you have already been added to the Slack account. I suggest that the link should redirect to a service capable of managing invites.

Community Slack
Chat with the community about any issues, questions, or feedback

TypeError: 'NoneType' object is not subscriptable

Hi,

I have tried running the attendance example. However I run into the following error:
TypeError: 'NoneType' object is not subscriptable

Image faces_detected.jpg written to filesystem:  True
Client created (student_test.py file)
127.0.0.1 - - [28/May/2022 20:04:11] "POST / HTTP/1.1" 500 -
Traceback (most recent call last):
  File "E:\weaviate-examples\attendance-system-example\venv\Lib\site-packages\flask\app.py", line 2091, in __call__
    return self.wsgi_app(environ, start_response)
  File "E:\weaviate-examples\attendance-system-example\venv\Lib\site-packages\flask\app.py", line 2076, in wsgi_app
    response = self.handle_exception(e)
  File "E:\weaviate-examples\attendance-system-example\venv\Lib\site-packages\flask\app.py", line 2073, in wsgi_app
    response = self.full_dispatch_request()
  File "E:\weaviate-examples\attendance-system-example\venv\Lib\site-packages\flask\app.py", line 1518, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "E:\weaviate-examples\attendance-system-example\venv\Lib\site-packages\flask\app.py", line 1516, in full_dispatch_request
    rv = self.dispatch_request()
  File "E:\weaviate-examples\attendance-system-example\venv\Lib\site-packages\flask\app.py", line 1502, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
  File "E:\weaviate-examples\attendance-system-example\upload_student.py", line 44, in upload_image
    attendance = markAttendance(faces,own=True) #.drop_duplicates()
  File "E:\weaviate-examples\attendance-system-example\mark.py", line 18, in markAttendance
    name = testit(img)
  File "E:\weaviate-examples\attendance-system-example\student_test.py", line 87, in testit
    ans = res['data']['Get']['Students'][0]['labelName']
TypeError: 'NoneType' object is not subscriptable
127.0.0.1 - - [28/May/2022 20:04:11] "GET /?__debugger__=yes&cmd=resource&f=style.css HTTP/1.1" 200 -
127.0.0.1 - - [28/May/2022 20:04:11] "GET /?__debugger__=yes&cmd=resource&f=debugger.js HTTP/1.1" 200 -
127.0.0.1 - - [28/May/2022 20:04:11] "GET /?__debugger__=yes&cmd=resource&f=console.png HTTP/1.1" 200 -
 * Detected change in 'E:\\weaviate-examples\\attendance-system-example\\upload_student.py', reloading
libpng warning: iCCP: known incorrect sRGB profile
 * Restarting with stat
C:\Program Files\JetBrains\PyCharm Community Edition 2020.2.2\plugins\python-ce\helpers\pydev\pydevd.py:1844: DeprecationWarning: currentThread() is deprecated, use current_thread() instead
  dummy_thread = threading.currentThread()
 * Debugger is active!
 * Debugger PIN: 521-878-846
 * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
127.0.0.1 - - [28/May/2022 20:04:59] "GET / HTTP/1.1" 200 -

I used the images from the following directories to test it out:
attendance-system-example\students and attendance-system-example\test

Regards,

Issue with `cohere-multilingual-wikipedia-search`

when I try to run this sample it break even after installing weaviate-ts-client.

I got this error:


webpack compiled with 1 warning
ERROR in src/weaviate_search.ts:1:15
TS2724: '"weaviate-ts-client"' has no exported member named 'IWeaviateClient'. Did you mean 'WeaviateClient'?
  > 1 | import type { IWeaviateClient } from "weaviate-ts-client";
      |               ^^^^^^^^^^^^^^^
    2 |
    3 | export type FilterInput = {
    4 |   languageIdsSelected: number[];

'vectorizer: no module with name "multi2vec-clip" present'

I installed weaviate_client-3.16.0 to try and use from weaviate.embedded import EmbeddedOptions for weaviate.Client but am getting below error when running this example class_obj through client.schema.create_class(class_obj)

UnexpectedStatusCodeException Traceback (most recent call last)
Input In [4], in
6 # Create a schema to add images
7 # I have used the web page https://weaviate.io/developers/weaviate/v1.11.0/retriever-vectorizer-modules/multi2vec-clip.html
8 # to get help on making a suitable schema. You can read the contents of this web page to know more.
9 class_obj = {
10 "class": "ClipExample",
11 "description": "A class to implement CLIP example",
(...)
41 ]
42 }
---> 44 client.schema.create_class(class_obj)
45 print("Schema class created")

File ~/.local/lib/python3.8/site-packages/weaviate/schema/crud_schema.py:182, in Schema.create_class(self, schema_class)
180 # validate the class before loading
181 check_class(loaded_schema_class)
--> 182 self._create_class_with_primitives(loaded_schema_class)
183 self._create_complex_properties_from_class(loaded_schema_class)

File ~/.local/lib/python3.8/site-packages/weaviate/schema/crud_schema.py:708, in Schema._create_class_with_primitives(self, weaviate_class)
706 raise RequestsConnectionError("Class may not have been created properly.") from conn_err
707 if response.status_code != 200:
--> 708 raise UnexpectedStatusCodeException("Create class", response)

UnexpectedStatusCodeException: Create class! Unexpected status code: 422, with response body: {'error': [{'message': 'vectorizer: no module with name "multi2vec-clip" present'}]}.

err="open /prometheus/queries.active: permission denied"

While following the example: monitoring-prometheus-grafana, I encountered with the following error: err="open /prometheus/queries.active: permission denied" in the logs of the prometheus container.

It is simply that you have to change ownership for /data/prometheus folder so that inside the container the mounted folder is accesible. This can easily be done with the following command:
sudo chown -R 65534:65534 data/prometheus/

Perhaps this happened because I'm not running on rootless docker, however I think this should be specified as one of the steps in the repo's README

Batch add_reference() error while links to other class objects property.

We are trying to achieve some class object property reference links to other class objects property in order to reduce process time for the vectorization and memory. But We are facing issue with below error when calling to batch.add_reference() error as
{'error': [{'message': "ref batch: write inverted batch: write additions: no bucket for prop 'section_content__meta_count' found"}]}
Setup for test: We are using weaviate 1.18.2 version:
We followed steps as per reference example https://weaviate.io/developers/weaviate/client-libraries/python#manual-batching
Can you please provide complete setup of example or is there any bug in provided example steps.

Retrieval based in two sbert models

Hi,
I'm currently working in a system where I score the document based on a calculated score from two separate retrievals, each one with it's own sbert model (a linear sum of two cosine similarities) . Is this type of query possible with weaviate? If so, is there any example I can have look?
Thanks!

Update import data for Bert IR

This notebook needs to be updated. The cell, where the data is imported, is doing it manually, now it is possible to do it with the client. This cell:

## doing this manually until the client is updated
import requests

def import_posts_with_vectors(posts, vectors):
    if len(posts) != len(vectors):
        raise Exception("len of posts ({}) and vectors ({}) does not match".format(len(posts), len(vectors)))
        
    for i, post in enumerate(posts):
        r = requests.post('http://localhost:8080/v1/objects', json={
            "class": "Post",
            "vector": vectors[i].tolist(),
            "properties": {
                "content": post,
            }
        })
             
        if r.status_code > 399:
            print(res)

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.