Giter VIP home page Giter VIP logo

txtai.weaviate's Introduction

txtai -> weaviate integration example

This project has been archived. For those interested in a txtai-weaviate integration check out this repository.

This repository contains an example Weaviate integration with txtai. A txtai workflow is used to index and search with Weaviate.

The following diagram illustrates the architecture.

architecture

Installation

pip install -r requirements.txt

Start Weaviate locally

Start a local Weaviate instance with docker-compose.

docker-compose up

Example Python application

The following will load a subset of a dataset from a Hugging Face datasets into Weaviate. Once successful, a query prompt will be brought up.

python example.py

Example API application

An FastAPI-backed application can also be brought up as follows.

CONFIG=app.yml uvicorn "txtai.api:app"

This API instance can be used with a txtai client (txtai.go, txtai.java, txtai.js, txtai.rs) or with any generic HTTP client. The following shows how to index and search data using cURL.

curl -XPOST "http://localhost:8000/workflow" -H "Content-Type: application/json" -d '{"name": "index", "elements": ["US tops 5 million confirmed virus cases","Canadas last fully intact ice shelf has suddenly collapsed, forming a Manhattan-sized iceberg","Beijing mobilises invasion craft along coast as Taiwan tensions escalate","The National Park Service warns against sacrificing slower friends in a bear attack","Maine man wins $1M from $25 lottery ticket","Make huge profits without work, earn up to $100,000 a day"]}'
# ["db471ead-5764-4933-a3b0-ba5e7e4039db","2e52177a-ee91-4c00-8f94-594c16ddda55","04e9098d-ac14-4392-9341-6079fefc5cdf","7546a8c4-c10d-49ee-9a76-1d0377d18a9d","bc825fd4-3139-448a-a6e0-85d7b9483e6c","99ffbb1b-5910-40a6-921c-2ce8822166a7"]

curl -XPOST "http://localhost:8000/workflow" -H "Content-Type: application/json" -d '{"name": "search", "elements": ["feel good story"]}'
# [{"data":{"Get":{"Post":[{"_additional":{"certainty":0.5416451},"content":"Maine man wins $1M from $25 lottery ticket"}]}}}]

Files

  • app.yml - txtai workflow
  • client.py - defines a Weaviate client as a txtai pipeline
  • example.py - Execute workflow with a txtai application

txtai.weaviate's People

Contributors

davidmezzetti avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

trengrj hadryan

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.