Scripts2026年3月31日·1 分钟阅读

Haystack — AI Orchestration for Search & RAG

Open-source AI orchestration framework by deepset. Build production RAG pipelines, semantic search, and agent workflows with modular components. 25K+ GitHub stars.

TO
TokRepo精选 · Community
快速使用

先拿来用,再决定要不要深挖

这里应该同时让用户和 Agent 知道第一步该复制什么、安装什么、落到哪里。

pip install haystack-ai
from haystack import Pipeline
from haystack.components.generators import OpenAIGenerator
from haystack.components.builders import PromptBuilder

prompt = PromptBuilder(template="Answer: {{query}}")
llm = OpenAIGenerator(model="gpt-4o")

pipe = Pipeline()
pipe.add_component("prompt", prompt)
pipe.add_component("llm", llm)
pipe.connect("prompt", "llm")

result = pipe.run({"prompt": {"query": "What is RAG?"}})
print(result["llm"]["replies"][0])

介绍

Haystack is an open-source AI orchestration framework by deepset for building production-ready RAG pipelines, semantic search engines, and agent workflows. It uses a modular pipeline architecture where you compose components (retrievers, generators, rankers, converters) into directed graphs. Supports 30+ LLM providers and vector stores. 25,000+ GitHub stars.

Best for: Teams building production RAG, search, or question-answering systems Works with: OpenAI, Anthropic, Google, Cohere, Ollama, 30+ providers


Core Concepts

Pipelines

Compose components into DAGs — each component does one thing well:

pipe.add_component("converter", HTMLToDocument())
pipe.add_component("splitter", DocumentSplitter(split_length=200))
pipe.add_component("embedder", OpenAIDocumentEmbedder())
pipe.add_component("writer", DocumentWriter(document_store=store))
pipe.connect("converter", "splitter")
pipe.connect("splitter", "embedder")
pipe.connect("embedder", "writer")

Component Library

50+ built-in components: document converters, splitters, embedders, retrievers, rankers, generators, and more.

Document Stores

Pluggable storage: Elasticsearch, Qdrant, Pinecone, Weaviate, ChromaDB, pgvector, and in-memory.

Evaluation

Built-in evaluation metrics for RAG quality: faithfulness, context relevance, answer relevance.


FAQ

Q: What is Haystack? A: An open-source AI orchestration framework by deepset for building production RAG, search, and agent pipelines with modular components. 25K+ GitHub stars.

Q: How is Haystack different from LangChain? A: Haystack uses a strict pipeline/DAG model with typed components, making it more predictable for production. LangChain is more flexible but less structured.


🙏

来源与感谢

Created by deepset. Licensed under Apache 2.0. deepset-ai/haystack — 25,000+ GitHub stars

相关资产