如何使用Haystack Framework構建代理QA抹布系統
想像您正在建立一個客戶支持AI,需要回答有關您的產品的問題。有時,它需要從您的文檔中獲取信息,而其他時間則需要搜索網絡以獲取最新更新。代理抹布系統在此類複雜的AI應用程序中派上用場。將他們視為聰明的研究助理,他們不僅知道您的內部文檔,而且決定何時搜索網絡。在本指南中,我們將使用Haystack Framework進行構建代理QA抹布系統的過程。
學習目標
- 知道什麼是代理LLM,並且了解它與抹布系統有何不同。
> 熟悉Agesic LLM應用程序的Haystack框架。
- >了解從模板提示構建的過程,並學習如何將不同的提示連接在一起。 學習如何在Haystack中使用Chromadb創建嵌入。
- > 學習如何建立從嵌入到世代的完整本地開發系統。
- >本文是
> > data Science Blogathon的一部分。 目錄的>>什麼是代理llm?塊
組件
- 管道
-
-
- Question-Asswer rag項目,用於高級物理學的
- >管道 >>實現路由器
- >實現Query Pipeline
- 繪製查詢管道圖形
- 結論
- 常見問題問題。 什麼是代理LLM?
- > >代理LLM是一個可以自主做出決定並根據其對任務的理解採取行動的AI系統。與主要產生文本響應的傳統LLM不同,代理LLM可以做更多的事情。
- >它可以思考,計劃和行動,以最少的人類投入。它評估其知識,認識到何時需要更多信息或外部工具。 >代理LLMS
> - 這種類型的系統還可以為作業選擇正確的工具。它可以決定何時需要檢索文檔,運行計算或自動化任務。使它們與眾不同的是它可以將復雜問題分解為步驟並獨立執行它們的能力,從而使其對於研究,分析和工作流動自動化很有價值。
rag vs agentic rag
>傳統的抹布系統遵循線性過程。 收到查詢時,系統首先標識請求中的密鑰元素。然後,它搜索知識庫,掃描相關信息,以幫助設計準確的響應。一旦檢索了相關信息或數據,系統就會對其進行處理以生成有意義且具有上下文相關的響應。
您可以通過下圖輕鬆理解這些過程。現在,一個代理抹布系統通過以下方式增強了此過程
評估查詢要求
- 在多個知識源之間決定
- 可能將來自不同來源的信息
- 組合 >就響應策略做出自主決定
- 提供源代理響應
- >關鍵區別在於系統對如何處理查詢做出明智決定的能力,而不是遵循固定的檢索生成模式。 了解乾草框架組件
>使用強大的檢索和發電技術易於促進數據的抹布。
>聊天機器人和代理使用最新的Genai模型,例如GPT-4,Llama3.2,DeepSeek-r1。 在混合類型(圖像,文本,音頻和表)知識庫上
生成多模式提問系統。
>從文檔或構建知識圖中提取信息。
- > HAYSTACK構建塊 Haystack有兩個主要概念,用於構建功能齊全的Genai LLM系統 - 組件和管道。讓我們以日語動漫角色的抹布的簡單示例來理解它們。
- >輕鬆調試和監視
- 可擴展的處理體系結構
- >節點 節點是可以在管道中連接的基本處理單元,這些節點是執行特定任務的組件。 來自上述管道的節點的示例
- 現在,我們可以使用提示來查詢動漫知識庫。
> - 創建一個提示模板
- 此提示將提供一個從文檔庫中獲取信息的答案。 >
- 用於本地嵌入
- 的通用嵌入文本模型 duckduckgo搜索網絡搜索或tavily搜索(可選)
- >
- 我使用一個免費的,完全局部的系統。 >
- ChromAdb用於嵌入組件
- 元素推斷的ollama組件
- > 和用於Web搜索的DuckDuckgo
- Web搜索文檔將數據發送到Web搜索文檔。
- Web搜索提示符將數據發送到提示點。 >提示木器將將數據發送到LLM以進行答案。
- 為什麼不看自己?
- > 繪製查詢管道圖
- QUERY GRAPH
-
我知道這是一個巨大的圖表,但它會向您顯示野獸腹部下發生的事情。
現在是時候享受我們辛勤工作的果實了。
創建一個用於易於查詢的函數。>
這是一個簡單的簡單函數。$ pip install haystack-ai ollama-haystack # On you system download Ollama and install LLM ollama pull llama3.2:3b ollama pull nomic-embed-text # And then start ollama server ollama serve
登入後複製登入後複製登入後複製登入後複製登入後複製現在運行您的主要腳本以索引NCERT物理書
>from haystack import Document, Pipeline from haystack.components.builders.prompt_builder import PromptBuilder from haystack.components.retrievers.in_memory import InMemoryBM25Retriever from haystack.document_stores.in_memory import InMemoryDocumentStore from haystack_integrations.components.generators.ollama import OllamaGenerator
登入後複製登入後複製登入後複製登入後複製登入後複製和文件的底部,我們為查詢
編寫驅動程序代碼關於本書知識的電阻率的
> MCQdocument_store = InMemoryDocumentStore() documents = [ Document( content="Naruto Uzumaki is a ninja from the Hidden Leaf Village and aspires to become Hokage." ), Document( content="Luffy is the captain of the Straw Hat Pirates and dreams of finding the One Piece." ), Document( content="Goku, a Saiyan warrior, has defended Earth from numerous powerful enemies like Frieza and Cell." ), Document( content="Light Yagami finds a mysterious Death Note, which allows him to eliminate people by writing their names." ), Document( content="Levi Ackerman is humanity’s strongest soldier, fighting against the Titans to protect mankind." ), ]
登入後複製登入後複製登入後複製登入後複製登入後複製書中不在書中的另一個問題
輸出
pipe = Pipeline() pipe.add_component("retriever", InMemoryBM25Retriever(document_store=document_store)) pipe.add_component("prompt_builder", PromptBuilder(template=template)) pipe.add_component( "llm", OllamaGenerator(model="llama3.2:1b", url="http://localhost:11434") ) pipe.connect("retriever", "prompt_builder.documents") pipe.connect("prompt_builder", "llm")
登入後複製登入後複製登入後複製登入後複製登入後複製>所以,它正在工作!我們可以使用更多數據,書籍或PDF來嵌入,這將產生更多的上下文感知答案。此外,諸如GPT-4O,Anthropic的Claude或其他Cloud LLM等LLM會更好地完成工作。image_param = { "format": "img", "type": "png", "theme": "forest", "bgColor": "f2f3f4", } pipe.show(params=image_param)
登入後複製登入後複製登入後複製登入後複製登入後複製登入後複製登入後複製登入後複製登入後複製>
結論
>我們的代理抹布系統展示了Haystack框架與組合組件和管道的功能的靈活性和魯棒性。可以通過部署到Web服務平台,並使用付費更好的LLM(例如OpenAI和Nththththopic)來準備生產。您可以使用簡化或基於React的Web Spa構建UI,以獲得更好的用戶體驗。
>您可以在此處找到本文中使用的所有代碼。>
鑰匙要點代理抹布系統提供了更聰明,更靈活的響應。 Haystack的管道體系結構啟用複雜的模塊化工作流程。
路由器在響應生成中啟用動態決策。>
連接圖提供了靈活且可維護的組件交互。- >
- 多個知識來源的集成增強了響應質量。
- >
- 本文所示的媒體不歸Analytics Vidhya擁有,並由作者的酌情決定 。
- 常見問題
- > Q1。系統如何處理未知查詢?當本地知識不足時,系統使用其路由器組件自動返回Web搜索,從而確保全面的覆蓋範圍。管道架構提供了哪些優點?管道體系結構可實現模塊化開發,易於測試和靈活的組件佈置,使系統可維護和擴展。 Q3。連接圖如何增強系統功能?該連接圖可實現複雜的數據流和並行處理,提高系統效率以及在處理不同類型的查詢時的靈活性。
Q4。我可以使用其他LLM API?是的,很容易只為各自的LLM API安裝必要的集成包,例如Gemini,Anthropic和Groq,然後將其與API鍵一起使用。
>
組件
>組件是Haystack的核心構建塊。他們可以執行諸如文檔存儲,文檔檢索,文本生成和嵌入之類的任務。 Haystack有許多組件,您可以在安裝後直接使用,它還提供了通過編寫Python類製造自己組件的API。
有合作夥伴公司和社區的集成集合。> >
>安裝庫,並設置Ollama>
導入一些組件$ pip install haystack-ai ollama-haystack # On you system download Ollama and install LLM ollama pull llama3.2:3b ollama pull nomic-embed-text # And then start ollama server ollama serve
登入後複製登入後複製登入後複製登入後複製登入後複製from haystack import Document, Pipeline from haystack.components.builders.prompt_builder import PromptBuilder from haystack.components.retrievers.in_memory import InMemoryBM25Retriever from haystack.document_stores.in_memory import InMemoryDocumentStore from haystack_integrations.components.generators.ollama import OllamaGenerator
登入後複製登入後複製登入後複製登入後複製登入後複製管道是Haystack框架的骨幹。它們定義了不同組件之間的數據流。管道本質上是有向的無環圖(DAG)。一個具有多個輸出的單個組件可以連接到具有多個輸入的另一個單個組件。document_store = InMemoryDocumentStore() documents = [ Document( content="Naruto Uzumaki is a ninja from the Hidden Leaf Village and aspires to become Hokage." ), Document( content="Luffy is the captain of the Straw Hat Pirates and dreams of finding the One Piece." ), Document( content="Goku, a Saiyan warrior, has defended Earth from numerous powerful enemies like Frieza and Cell." ), Document( content="Light Yagami finds a mysterious Death Note, which allows him to eliminate people by writing their names." ), Document( content="Levi Ackerman is humanity’s strongest soldier, fighting against the Titans to protect mankind." ), ]
登入後複製登入後複製登入後複製登入後複製登入後複製>
您可以通過>定義管道
您可以可視化管道
pipe = Pipeline() pipe.add_component("retriever", InMemoryBM25Retriever(document_store=document_store)) pipe.add_component("prompt_builder", PromptBuilder(template=template)) pipe.add_component( "llm", OllamaGenerator(model="llama3.2:1b", url="http://localhost:11434") ) pipe.connect("retriever", "prompt_builder.documents") pipe.connect("prompt_builder", "llm")
登入後複製登入後複製登入後複製登入後複製登入後複製管道提供:
image_param = { "format": "img", "type": "png", "theme": "forest", "bgColor": "f2f3f4", } pipe.show(params=image_param)
登入後複製登入後複製登入後複製登入後複製登入後複製登入後複製登入後複製登入後複製登入後複製模塊化工作流程管理
- 靈活組件佈置
>pipe.add_component("retriever", InMemoryBM25Retriever(document_store=document_store)) pipe.add_component("prompt_builder", PromptBuilder(template=template)) pipe.add_component( "llm", OllamaGenerator(model="llama3.2:1b", url="http://localhost:11434") )
登入後複製登入後複製登入後複製登入後複製image_param = { "format": "img", "type": "png", "theme": "forest", "bgColor": "f2f3f4", } pipe.show(params=image_param)
登入後複製登入後複製登入後複製登入後複製登入後複製登入後複製登入後複製登入後複製登入後複製>
在可能的情況下啟用並行處理>管理輸入/輸出關係
>
創建靈活的處理途徑。響應:
template = """ Given only the following information, answer the question. Ignore your own knowledge. Context: {% for document in documents %} {{ document.content }} {% endfor %} Question: {{ query }}? """
登入後複製登入後複製登入後複製登入後複製這個抹布對新來者來說很簡單,但在概念上很有價值。現在,我們已經了解了大多數Haystack框架的概念,我們可以深入研究我們的主要項目。如果有什麼新事物出現,我將在此過程中解釋。
>>高中物理學的問答抹布項目
>我們將為高中生建立一個基於NCERT物理書籍的問題答案抹布。它將通過從NCERT書籍中獲取信息來提供查詢的答案,如果不存在信息,它將搜索網絡以獲取該信息。
local llama3.2:3b或llama3.2:1b- Chromadb用於嵌入存儲
安裝必要的軟件包
$ pip install haystack-ai ollama-haystack # On you system download Ollama and install LLM ollama pull llama3.2:3b ollama pull nomic-embed-text # And then start ollama server ollama serve
登入後複製登入後複製登入後複製登入後複製登入後複製現在創建一個名為
QAGENT的項目目錄。from haystack import Document, Pipeline from haystack.components.builders.prompt_builder import PromptBuilder from haystack.components.retrievers.in_memory import InMemoryBM25Retriever from haystack.document_stores.in_memory import InMemoryDocumentStore from haystack_integrations.components.generators.ollama import OllamaGenerator
登入後複製登入後複製登入後複製登入後複製登入後複製。 >您可以為項目或jupyter筆記本使用普通的Python文件,這無關緊要。我將使用一個普通的python文件。
在項目根上創建document_store = InMemoryDocumentStore() documents = [ Document( content="Naruto Uzumaki is a ninja from the Hidden Leaf Village and aspires to become Hokage." ), Document( content="Luffy is the captain of the Straw Hat Pirates and dreams of finding the One Piece." ), Document( content="Goku, a Saiyan warrior, has defended Earth from numerous powerful enemies like Frieza and Cell." ), Document( content="Light Yagami finds a mysterious Death Note, which allows him to eliminate people by writing their names." ), Document( content="Levi Ackerman is humanity’s strongest soldier, fighting against the Titans to protect mankind." ), ]
登入後複製登入後複製登入後複製登入後複製登入後複製main.py
文件。> 導入必要的庫
>系統軟件包
- > Core Haystack組件
pipe = Pipeline() pipe.add_component("retriever", InMemoryBM25Retriever(document_store=document_store)) pipe.add_component("prompt_builder", PromptBuilder(template=template)) pipe.add_component( "llm", OllamaGenerator(model="llama3.2:1b", url="http://localhost:11434") ) pipe.connect("retriever", "prompt_builder.documents") pipe.connect("prompt_builder", "llm")
登入後複製登入後複製登入後複製登入後複製登入後複製image_param = { "format": "img", "type": "png", "theme": "forest", "bgColor": "f2f3f4", } pipe.show(params=image_param)
登入後複製登入後複製登入後複製登入後複製登入後複製登入後複製登入後複製登入後複製登入後複製創建文檔商店pipe.add_component("retriever", InMemoryBM25Retriever(document_store=document_store)) pipe.add_component("prompt_builder", PromptBuilder(template=template)) pipe.add_component( "llm", OllamaGenerator(model="llama3.2:1b", url="http://localhost:11434") )
登入後複製登入後複製登入後複製登入後複製image_param = { "format": "img", "type": "png", "theme": "forest", "bgColor": "f2f3f4", } pipe.show(params=image_param)
登入後複製登入後複製登入後複製登入後複製登入後複製登入後複製登入後複製登入後複製登入後複製Document store is the most important here we will store our embedding for retrieval, we usetemplate = """ Given only the following information, answer the question. Ignore your own knowledge. Context: {% for document in documents %} {{ document.content }} {% endfor %} Question: {{ query }}? """
登入後複製登入後複製登入後複製登入後複製ChromaDB
for the embedding store, and as you may see in the earlier example, we use InMemoryDocumentStore for fast retrieval because then our data was tiny but for a robust system of retrieval we don’t rely on the InMemoryStore, it will hog the memory and we will have creat embeddings every time we start系統。該解決方案是矢量數據庫,例如Pinecode,Weaviate,Postgres Vector DB或Chromadb。我之所以使用chromadb,是因為免費,開源,易於使用且健壯。 >
persist_path是您要存儲嵌入的位置。query = "How Goku eliminate people?" response = pipe.run({"prompt_builder": {"query": query}, "retriever": {"query": query}}) print(response["llm"]["replies"])
登入後複製登入後複製pdf文件路徑
>它將從數據文件夾中創建文件列表,該文件由我們的PDF文件組成。
文檔預處理組件> $conda create --name agenticlm python=3.12 $conda activate agenticlm
登入後複製>我們將使用Haystack的內置文檔預處理器,例如清潔器,分離器和文件轉換器,然後使用Writer將數據寫入商店。
清潔器:
它將清除文檔中的額外空間,重複的線條,空線等。分離器:>它將以各種方式分開文檔,例如單詞,句子,para,pages。
>$pip install haystack-ai ollama-haystack pypdf $pip install chroma-haystack duckduckgo-api-haystack
登入後複製>>文件轉換器:它將使用PYPDF將PDF轉換為文檔。
。 $ pip install haystack-ai ollama-haystack # On you system download Ollama and install LLM ollama pull llama3.2:3b ollama pull nomic-embed-text # And then start ollama server ollama serve
登入後複製登入後複製登入後複製登入後複製登入後複製作者:>它將存儲文檔要存儲文檔和重複文檔的文檔,它將與先前的文檔覆蓋。
> 現在設置文檔索引的嵌入式。from haystack import Document, Pipeline from haystack.components.builders.prompt_builder import PromptBuilder from haystack.components.retrievers.in_memory import InMemoryBM25Retriever from haystack.document_stores.in_memory import InMemoryDocumentStore from haystack_integrations.components.generators.ollama import OllamaGenerator
登入後複製登入後複製登入後複製登入後複製登入後複製嵌入:nomic嵌入文本>
>我們將使用somic-embed-text嵌入器,這是非常有效且免費的插入面和ollama。> 在運行索引管道之前,請打開終端並在下面鍵入sumic-embed-text和llama3.2:3b模型從Ollama模型商店
ollama servedocument_store = InMemoryDocumentStore() documents = [ Document( content="Naruto Uzumaki is a ninja from the Hidden Leaf Village and aspires to become Hokage." ), Document( content="Luffy is the captain of the Straw Hat Pirates and dreams of finding the One Piece." ), Document( content="Goku, a Saiyan warrior, has defended Earth from numerous powerful enemies like Frieza and Cell." ), Document( content="Light Yagami finds a mysterious Death Note, which allows him to eliminate people by writing their names." ), Document( content="Levi Ackerman is humanity’s strongest soldier, fighting against the Titans to protect mankind." ), ]
登入後複製登入後複製登入後複製登入後複製登入後複製來啟動Ollama 現在嵌入組件
我們使用
> ollamadocumentembedder組件嵌入文檔,但是如果您要嵌入文本字符串,則必須使用pipe = Pipeline() pipe.add_component("retriever", InMemoryBM25Retriever(document_store=document_store)) pipe.add_component("prompt_builder", PromptBuilder(template=template)) pipe.add_component( "llm", OllamaGenerator(model="llama3.2:1b", url="http://localhost:11434") ) pipe.connect("retriever", "prompt_builder.documents") pipe.connect("prompt_builder", "llm")
登入後複製登入後複製登入後複製登入後複製登入後複製ollamatextemtembedder。 創建索引管道 就像我們以前的玩具抹布示例一樣,我們將首先啟動管道類別。 >
現在,我們將一一
一個添加到管道中的組件image_param = { "format": "img", "type": "png", "theme": "forest", "bgColor": "f2f3f4", } pipe.show(params=image_param)
登入後複製登入後複製登入後複製登入後複製登入後複製登入後複製登入後複製登入後複製登入後複製將組件連接到管道圖
pipe.add_component("retriever", InMemoryBM25Retriever(document_store=document_store)) pipe.add_component("prompt_builder", PromptBuilder(template=template)) pipe.add_component( "llm", OllamaGenerator(model="llama3.2:1b", url="http://localhost:11434") )
登入後複製登入後複製登入後複製登入後複製>在這裡,訂單很重要,因為如何連接組件告訴管道數據將如何流過管道。就像,在哪個順序或購買水管物品的位置都沒關係,但是如何將它們放在一起會決定您是否獲得水。
>>轉換器將PDF轉換並發送清潔以進行清潔。然後,清潔工將清潔的文檔發送到分離器以進行分解。然後,這些塊將傳遞到嵌入式矢量化,最後嵌入的嵌入將把這些嵌入到作者的存儲中。
。理解!好的,讓我給您索引的視覺圖,以便您可以檢查數據流。image_param = { "format": "img", "type": "png", "theme": "forest", "bgColor": "f2f3f4", } pipe.show(params=image_param)
登入後複製登入後複製登入後複製登入後複製登入後複製登入後複製登入後複製登入後複製登入後複製繪製索引管道
template = """ Given only the following information, answer the question. Ignore your own knowledge. Context: {% for document in documents %} {{ document.content }} {% endfor %} Question: {{ query }}? """
登入後複製登入後複製登入後複製登入後複製實現路由器
>現在,我們需要創建一個路由器來通過其他路徑路由數據。在這種情況下,我們將使用條件路由器,該路由器將在某些條件下完成路由工作。條件路由器將根據組件輸出評估條件。它將通過不同的管道分支來指導數據流,從而實現動態決策。它也將具有強大的後備策略。$ pip install haystack-ai ollama-haystack # On you system download Ollama and install LLM ollama pull llama3.2:3b ollama pull nomic-embed-text # And then start ollama server ollama serve
登入後複製登入後複製登入後複製登入後複製登入後複製系統從嵌入式商店上下文中獲得NO_ANSWER回复時,它將轉到Web搜索工具以從Internet收集相關數據。
>用於網絡搜索,我們將使用DuckDuckgo API或Tavely,在這裡我使用了DuckDuckgo。
好的,大多數繁重的舉重已經完成。現在,是時候及時工程from haystack import Document, Pipeline from haystack.components.builders.prompt_builder import PromptBuilder from haystack.components.retrievers.in_memory import InMemoryBM25Retriever from haystack.document_stores.in_memory import InMemoryDocumentStore from haystack_integrations.components.generators.ollama import OllamaGenerator
登入後複製登入後複製登入後複製登入後複製登入後複製創建提示模板
我們將使用Haystack提示式佈置組件來從模板
構建提示首先,我們將為QA
創建一個提示現在,在從LLM獲取NO_ANSWER之後的第二個提示中,系統將使用Web搜索工具從Internet收集上下文。 > duckduckgo提示模板document_store = InMemoryDocumentStore() documents = [ Document( content="Naruto Uzumaki is a ninja from the Hidden Leaf Village and aspires to become Hokage." ), Document( content="Luffy is the captain of the Straw Hat Pirates and dreams of finding the One Piece." ), Document( content="Goku, a Saiyan warrior, has defended Earth from numerous powerful enemies like Frieza and Cell." ), Document( content="Light Yagami finds a mysterious Death Note, which allows him to eliminate people by writing their names." ), Document( content="Levi Ackerman is humanity’s strongest soldier, fighting against the Titans to protect mankind." ), ]
登入後複製登入後複製登入後複製登入後複製登入後複製>它將有助於系統進入Web搜索並嘗試回答查詢。
使用Haystack> pipe = Pipeline() pipe.add_component("retriever", InMemoryBM25Retriever(document_store=document_store)) pipe.add_component("prompt_builder", PromptBuilder(template=template)) pipe.add_component( "llm", OllamaGenerator(model="llama3.2:1b", url="http://localhost:11434") ) pipe.connect("retriever", "prompt_builder.documents") pipe.connect("prompt_builder", "llm")
登入後複製登入後複製登入後複製登入後複製登入後複製的提示構建器創建提示
我們將使用HayStack提示Joiner一起加入提示的分支。 >實現查詢管道
>查詢管道將嵌入嵌入的查詢收集上下文資源,並使用LLM或Web搜索工具回答我們的查詢。image_param = { "format": "img", "type": "png", "theme": "forest", "bgColor": "f2f3f4", } pipe.show(params=image_param)
登入後複製登入後複製登入後複製登入後複製登入後複製登入後複製登入後複製登入後複製登入後複製它類似於索引管道。
啟動管道pipe.add_component("retriever", InMemoryBM25Retriever(document_store=document_store)) pipe.add_component("prompt_builder", PromptBuilder(template=template)) pipe.add_component( "llm", OllamaGenerator(model="llama3.2:1b", url="http://localhost:11434") )
登入後複製登入後複製登入後複製登入後複製>在查詢管道中添加組件
在這裡,對於LLM生成,我們使用ollamagenerator組件使用Llama3.2:3b或1b或您喜歡使用工具調用的任何LLM生成答案。
將所有組件連接在一起以進行查詢流並回答生成> 總結上述連接:image_param = { "format": "img", "type": "png", "theme": "forest", "bgColor": "f2f3f4", } pipe.show(params=image_param)
登入後複製登入後複製登入後複製登入後複製登入後複製登入後複製登入後複製登入後複製登入後複製> template = """ Given only the following information, answer the question. Ignore your own knowledge. Context: {% for document in documents %} {{ document.content }} {% endfor %} Question: {{ query }}? """
登入後複製登入後複製登入後複製登入後複製獵犬將數據發送到提示_builder的文檔。
提示構建器轉到提示木器以加入其他提示。>
提示木匠將數據傳遞給LLM發電。llm的答復轉到路由器以檢查答復是否具有query = "How Goku eliminate people?" response = pipe.run({"prompt_builder": {"query": query}, "retriever": {"query": query}}) print(response["llm"]["replies"])
登入後複製登入後複製no_answer
>> no_answer。- Web搜索將數據發送到Web搜索提示
以上是如何使用Haystack Framework構建代理QA抹布系統的詳細內容。更多資訊請關注PHP中文網其他相關文章!

熱AI工具

Undresser.AI Undress
人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover
用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool
免費脫衣圖片

Clothoff.io
AI脫衣器

Video Face Swap
使用我們完全免費的人工智慧換臉工具,輕鬆在任何影片中換臉!

熱門文章

熱工具

記事本++7.3.1
好用且免費的程式碼編輯器

SublimeText3漢化版
中文版,非常好用

禪工作室 13.0.1
強大的PHP整合開發環境

Dreamweaver CS6
視覺化網頁開發工具

SublimeText3 Mac版
神級程式碼編輯軟體(SublimeText3)

嘿,編碼忍者!您當天計劃哪些與編碼有關的任務?在您進一步研究此博客之前,我希望您考慮所有與編碼相關的困境,這是將其列出的。 完畢? - 讓&#8217

介紹 Openai已根據備受期待的“草莓”建築發布了其新模型。這種稱為O1的創新模型增強了推理能力,使其可以通過問題進行思考

SQL的Alter表語句:動態地將列添加到數據庫 在數據管理中,SQL的適應性至關重要。 需要即時調整數據庫結構嗎? Alter表語句是您的解決方案。本指南的詳細信息添加了Colu

介紹 Mistral發布了其第一個多模式模型,即Pixtral-12b-2409。該模型建立在Mistral的120億參數Nemo 12B之上。是什麼設置了該模型?現在可以拍攝圖像和Tex

在從事代理AI時,開發人員經常發現自己在速度,靈活性和資源效率之間進行權衡。我一直在探索代理AI框架,並遇到了Agno(以前是Phi-

陷入困境的基準:駱駝案例研究 2025年4月上旬,梅塔(Meta)揭開了其Llama 4套件的模特,擁有令人印象深刻的性能指標,使他們對GPT-4O和Claude 3.5 Sonnet等競爭對手的良好定位。倫斯的中心

視頻遊戲可以緩解焦慮,建立焦點或支持多動症的孩子嗎? 隨著醫療保健在全球範圍內挑戰,尤其是在青年中的挑戰,創新者正在轉向一種不太可能的工具:視頻遊戲。現在是世界上最大的娛樂印度河之一

解鎖嵌入模型的力量:深入研究安德魯·NG的新課程 想像一個未來,機器可以完全準確地理解和回答您的問題。 這不是科幻小說;多虧了AI的進步,它已成為R
