Token导航 LogoToken导航TokenDH.com
hayhooks (Deepset AI) logo
搜索检索stdio官方级别未说明来源级核验

hayhooks (Deepset AI)

MCP Server

Easily deploy Haystack pipelines as REST APIs and MCP Tools.

工具数

0

提示词数

0

GitHub Stars

141

资源数

0
API集成PythonClaudeClaudeCursor

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

deepset-ai

提供方

deepset-ai

最后核验

2026/5/18 04:56

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

命令预览

pip install hayhooks

详细介绍

Hayhooks

Hayhooks 使其易于部署和服务 干草堆 管道代理.

使用Hayhooks,您可以:

  • 📦 将Haystack管道和代理部署为REST API 具有最大的灵活性和最少的样板代码。
  • 💬 将您的Haystack管道和代理与 开放网页界面 因为OpenAI兼容的聊天完成后端支持流媒体。
  • 🖥️ 嵌入a Chainlit 聊天界面 直接在Hayhooks pip install "hayhooks[chainlit]"hayhooks run --with-chainlit --具有流媒体、管道选择和自定义UI小部件的零配置前端。
  • 📈 使用OpenTetry跟踪Hayhooks生命周期操作 (pip install "hayhooks[tracing]")用于跨REST和MCP的部署/运行/取消部署可见性,具有 /dashboard UI通过 hayhooks run --with-tracing-dashboard (由本地实时跟踪缓冲区支持)。

](https://pypi.org/project/hayhooks) ](https://pypi.org/project/hayhooks) ](https://github.com/deepset-ai/hayhooks/actions/workflows/docker.yml) ![Tests](https://github.com/deepset-ai/hayhooks/actions/workflows/tests.yml)

文档

📚 有关详细指南、示例和API参考,请查看我们的 全面的文件.

快速开始

1.安装Hayhooks

# Install Hayhooks
pip install hayhooks

2.启动Hayhooks

hayhooks run

3.创建一个简单的代理

创建一个具有流式聊天支持和简单HTTP POST API的最小代理包装器:

from typing import AsyncGenerator
from haystack.components.agents import Agent
from haystack.dataclasses import ChatMessage
from haystack.tools import Tool
from haystack.components.generators.chat import OpenAIChatGenerator
from hayhooks import BasePipelineWrapper, async_streaming_generator

# Define a Haystack Tool that provides weather information for a given location.
def weather_function(location):
    return f"The weather in {location} is sunny."

weather_tool = Tool(
    name="weather_tool",
    description="Provides weather information for a given location.",
    parameters={
        "type": "object",
        "properties": {"location": {"type": "string"}},
        "required": ["location"],
    },
    function=weather_function,
)

class PipelineWrapper(BasePipelineWrapper):
    def setup(self) -> None:
        self.agent = Agent(
            chat_generator=OpenAIChatGenerator(model="gpt-4o-mini"),
            system_prompt="You're a helpful agent",
            tools=[weather_tool],
        )

    # This will create a POST /my_agent/run endpoint
    # `question` will be the input argument and will be auto-validated by a Pydantic model
    async def run_api_async(self, question: str) -> str:
        result = await self.agent.run_async(messages=[ChatMessage.from_user(question)])
        return result["last_message"].text

    # This will create an OpenAI-compatible /chat/completions endpoint
    async def run_chat_completion_async(
        self, model: str, messages: list[dict], body: dict
    ) -> AsyncGenerator[str, None]:
        chat_messages = [
            ChatMessage.from_openai_dict_format(message) for message in messages
        ]

        return async_streaming_generator(
            pipeline=self.agent,
            pipeline_run_args={
                "messages": chat_messages,
            },
        )

另存为 my_agent_dir/pipeline_wrapper.py.

4.部署它

hayhooks pipeline deploy-files -n my_agent ./my_agent_dir

5.运行它

调用HTTP POST API(/my_agent/run):

curl -X POST http://localhost:1416/my_agent/run \
  -H 'Content-Type: application/json' \
  -d '{"question": "What can you do?"}'

调用OpenAI兼容的聊天完成API(已启用流):

curl -X POST http://localhost:1416/chat/completions \
  -H 'Content-Type: application/json' \
  -d '{
    "model": "my_agent",
    "messages": [{"role": "user", "content": "What can you do?"}]
  }'

或者在 嵌入式Chainlit用户界面 (hayhooks run --with-chainlit)或 将其与Open WebUI集成!

主要特点

🚀 轻松部署

  • 以最少的设置将Haystack管道和代理部署为REST API
  • 支持基于YAML和基于包装器的管道部署
  • 自动生成与OpenAI兼容的端点

🌐 多种集成选项

  • MCP协议:将管道作为MCP工具公开,用于人工智能开发环境
  • 链式UI:具有流媒体、管道选择和自定义UI小部件的嵌入式聊天前端
  • 打开WebUI集成:使用Hayhooks作为具有流媒体支持的Open WebUI的后端
  • OpenAI兼容性:与OpenAI兼容的工具和框架无缝集成

🔧 开发者友好

  • CLI,便于管道管理
  • 灵活的配置选项
  • 全面的日志记录和调试支持
  • 基于Haystack跟踪API构建的OpenTetry就绪跟踪挂钩
  • 自定义路由和中间件支持

📁 文件上传支持

  • 内置支持处理管道中的文件上传
  • 非常适合RAG系统和文档处理

接下来的步骤

社区与支持

Hayhooks由 深陷的 团队。

目录标签

目录标签

API集成PythonClauderesearch-and-dataapirestaimcphaystackapi-restllm本地部署管道部署RESTAPIMCP协议OpenAI兼容Chainlit集成

支持客户端

ClaudeCursor

接入字段

传输方式(transport,传输协议)

stdio

鉴权方式(authType,认证方式)

none

部署方式(deploymentType,部署类型)

remote-capable

工具数量(toolCount,工具数)

0

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

stdiononeremote-capable

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

来源信息

继续浏览同类 MCP