Giter VIP home page Giter VIP logo

concat's Introduction

๐Ÿˆโ€โฌ› concat

This is a simple retrieval chat api. It takes a Bookwyrm object and a text query, does similarity search to find relevant docs, and outputs a synthetic answer with citations.

To use, create a virtual environment and install requirements with pip.

Here's how you can use concat with the bookwyrm model you created:

from concat.concat import load_model, get_full_answer

# Load the Bookwyrm model
model = load_model("wyrm.json")

# Ask a query
query = "What is the meaning of life?"

# Get the answer
answer = "".join(get_full_answer(model, query))
print(answer)

This will:

  1. Load the bookwyrm model from the wyrm.json file you created.
  2. Process the query "What is the capital of France?" to get its embedding.
  3. Find the most similar chunks in the model to the query embedding.
  4. Generate a prompt with the query and relevant chunks.
  5. Use the meta/meta-llama-3-8b-instruct model to generate an answer based on the prompt.
  6. Print out the full answer with citations.

To use concat with Replicate, update the predict.py file:

from concat.concat import load_model, get_full_answer

class Predictor(BasePredictor):
    def setup(self):
        self.model = load_model("wyrm.json")

    def predict(self, query: str) -> str:
        return "".join(get_full_answer(self.model, query))

Then build and push to Replicate as shown in the README.

concat's People

Contributors

deepfates avatar

Watchers

 avatar  avatar

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.