weaviate / weaviate-examples

Weaviate vector database – examples
MIT License
297 stars 72 forks source link

Update import data for Bert IR #2

Closed StefanBogdan closed 2 years ago

StefanBogdan commented 2 years ago

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)
bobvanluijt commented 2 years ago

Is this still an issue @StefanBogdan?

StefanBogdan commented 2 years ago

@bobvanluijt Nope