Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Litserve <> Haystack #118

Open
srini047 opened this issue Sep 4, 2024 · 2 comments
Open

Litserve <> Haystack #118

srini047 opened this issue Sep 4, 2024 · 2 comments

Comments

@srini047
Copy link

srini047 commented Sep 4, 2024

Notebook

Serve Haystack pipelines using Litserve.

Reason

With its core reason to use being to serve AI/LLM models. I would like to showcase the capabilities of Haystack with Litserve.

Prework

Eg:

import litserve as ls
from haystack import Pipeline, PredefinedPipeline


class HaystackPredefinedLitAPI(ls.LitAPI):
    def setup(self):
        self.pipeline = Pipeline.from_template(PredefinedPipeline.GENERATIVE_QA)

    def decode_request(self, request):
        return request["query"]

    def predict(self, question):
        return self.pipeline.run({"prompt_builder": {"question": question}})

    def encode_response(self, output):
        return {"output": output}


if __name__ == "__main__":
    server = ls.LitServer(HaystackPredefinedLitAPI(), accelerator="auto")
    server.run(port=8000)

I would like to show how custom pipelines can be built and run.

@TuanaCelik
Copy link
Contributor

@srini047 if you created an example/demo we would be happy to share it/showcase it

@srini047
Copy link
Author

srini047 commented Sep 6, 2024

@srini047 if you created an example/demo we would be happy to share it/showcase it

Sure, I shall work on the code with demo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants