Hayhooks logo

Hayhooks

by deepset-ai

Hayhooks makes it easy to deploy and serve Haystack pipelines as REST APIs. It provides a simple way to wrap your Haystack pipelines with custom logic and expose them via HTTP endpoints, including OpenAI-compatible chat completion endpoints.

View on GitHub

Last updated: N/A

What is Hayhooks?

Hayhooks is a tool that simplifies the deployment and serving of Haystack pipelines as REST APIs. It allows you to wrap Haystack pipelines with custom logic and expose them through HTTP endpoints, including OpenAI-compatible chat completion endpoints.

How to use Hayhooks?

  1. Install the package using pip install hayhooks. 2. Create a PipelineWrapper class that defines your pipeline's setup and run logic. 3. Deploy the pipeline using the Hayhooks CLI. 4. Interact with the pipeline via HTTP endpoints or the CLI.

Key features of Hayhooks

  • Easy deployment of Haystack pipelines as REST APIs

  • Support for custom pipeline logic via PipelineWrappers

  • OpenAI-compatible chat completion endpoints

  • CLI for managing the server and pipelines

  • MCP (Model Context Protocol) support

  • File upload support

  • Streaming responses

  • OpenAPI Tool Server compatibility for open-webui

Use cases of Hayhooks

  • Deploying a question answering system as an API

  • Creating a chatbot powered by a Haystack pipeline

  • Exposing a document processing pipeline as a service

  • Integrating Haystack pipelines with other applications via REST APIs

FAQ from Hayhooks

What is a PipelineWrapper?

A PipelineWrapper is a class that encapsulates a Haystack pipeline and defines how it should be set up and run. It allows you to customize the pipeline's behavior and expose it through HTTP endpoints.

How do I deploy a pipeline?

You can deploy a pipeline using the hayhooks pipeline deploy-files command, providing the path to the directory containing your PipelineWrapper and pipeline definition files.

How do I run a pipeline from the CLI?

You can run a pipeline from the CLI using the hayhooks pipeline run command, specifying the pipeline name and any required parameters.

How do I enable OpenAI compatibility?

To enable OpenAI compatibility, implement the run_chat_completion method in your PipelineWrapper. This will automatically generate OpenAI-compatible endpoints for your pipeline.

How do I use Hayhooks with open-webui?

You can use Hayhooks as a backend for open-webui by configuring an OpenAI API connection in open-webui's settings, pointing to the Hayhooks server's address.