{"id":60933,"date":"2026-01-16T16:49:12","date_gmt":"2026-01-16T08:49:12","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/60933.html"},"modified":"2026-01-16T16:49:12","modified_gmt":"2026-01-16T08:49:12","slug":"%e8%a7%a3%e9%94%81ai%e5%ba%94%e7%94%a8%e5%bc%80%e5%8f%91%e6%96%b0%e8%8c%83%e5%bc%8f%ef%bc%9a%e6%b7%b1%e5%85%a5%e6%8e%a2%e7%b4%a2langchain%e6%a1%86%e6%9e%b6%e7%9a%84%e6%a0%b8%e5%bf%83%e4%b8%8e%e5%ae%9e","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/60933.html","title":{"rendered":"\u89e3\u9501AI\u5e94\u7528\u5f00\u53d1\u65b0\u8303\u5f0f\uff1a\u6df1\u5165\u63a2\u7d22LangChain\u6846\u67b6\u7684\u6838\u5fc3\u4e0e\u5b9e\u8df5"},"content":{"rendered":"<h3>\u5f15\u8a00&#xff1a;AI\u5e94\u7528\u5f00\u53d1\u7684\u8303\u5f0f\u8f6c\u53d8<\/h3>\n<p>\u968f\u7740\u5927\u8bed\u8a00\u6a21\u578b&#xff08;LLM&#xff09;\u7684\u5feb\u901f\u53d1\u5c55&#xff0c;\u6211\u4eec\u6b63\u7ad9\u5728AI\u5e94\u7528\u5f00\u53d1\u7684\u65b0\u62d0\u70b9\u3002\u8fc7\u53bb&#xff0c;\u6784\u5efaAI\u9a71\u52a8\u7684\u5e94\u7528\u5f80\u5f80\u9700\u8981\u590d\u6742\u7684\u5de5\u7a0b\u67b6\u6784\u548c\u5927\u91cf\u7684\u5b9a\u5236\u5316\u5f00\u53d1\u3002\u800c\u4eca&#xff0c;LangChain\u6846\u67b6\u6b63\u5728\u6539\u53d8\u8fd9\u4e00\u5c40\u9762\u2014\u2014\u5b83\u662f\u4e00\u4e2a\u4e13\u95e8\u4e3a\u6784\u5efa\u57fa\u4e8e\u5927\u8bed\u8a00\u6a21\u578b\u7684\u5e94\u7528\u7a0b\u5e8f\u800c\u8bbe\u8ba1\u7684\u5f00\u6e90\u6846\u67b6&#xff0c;\u8ba9\u5f00\u53d1\u8005\u80fd\u591f\u66f4\u8f7b\u677e\u3001\u66f4\u9ad8\u6548\u5730\u521b\u5efa\u590d\u6742\u7684AI\u5e94\u7528\u3002<\/p>\n<h3>\u4e00\u3001LangChain\u662f\u4ec0\u4e48&#xff1f;<\/h3>\n<p>LangChain\u662f\u4e00\u4e2a\u7528\u4e8e\u5f00\u53d1\u7531\u8bed\u8a00\u6a21\u578b\u9a71\u52a8\u7684\u5e94\u7528\u7a0b\u5e8f\u7684\u6846\u67b6&#xff0c;\u5b83\u63d0\u4f9b\u4e86\u4e00\u5957\u5b8c\u6574\u7684\u5de5\u5177\u94fe&#xff0c;\u5e2e\u52a9\u5f00\u53d1\u8005\u5c06LLM\u80fd\u529b\u96c6\u6210\u5230\u5b9e\u9645\u5e94\u7528\u4e2d\u3002\u5176\u6838\u5fc3\u8bbe\u8ba1\u7406\u5ff5\u662f\u6a21\u5757\u5316\u548c\u53ef\u7ec4\u5408\u6027\u2014\u2014\u4f60\u53ef\u4ee5\u50cf\u642d\u79ef\u6728\u4e00\u6837\u7ec4\u5408\u4e0d\u540c\u7684\u7ec4\u4ef6\u6765\u6784\u5efa\u590d\u6742\u7684\u5e94\u7528\u3002<\/p>\n<h4>\u6838\u5fc3\u4ef7\u503c\u4e3b\u5f20&#xff1a;<\/h4>\n<ul>\n<li>\n<p>\u51cf\u5c11\u6837\u677f\u4ee3\u7801&#xff1a;\u6807\u51c6\u5316\u4e86\u4e0eLLM\u4ea4\u4e92\u7684\u6a21\u5f0f<\/p>\n<\/li>\n<li>\n<p>\u63d0\u9ad8\u5f00\u53d1\u6548\u7387&#xff1a;\u63d0\u4f9b\u9884\u6784\u5efa\u7684\u7ec4\u4ef6\u548c\u94fe<\/p>\n<\/li>\n<li>\n<p>\u589e\u5f3a\u5e94\u7528\u80fd\u529b&#xff1a;\u8f7b\u677e\u96c6\u6210\u8bb0\u5fc6\u3001\u5de5\u5177\u4f7f\u7528\u7b49\u9ad8\u7ea7\u529f\u80fd<\/p>\n<\/li>\n<\/ul>\n<h3>\u4e8c\u3001LangChain\u6838\u5fc3\u7ec4\u4ef6\u8be6\u89e3<\/h3>\n<h4>1. \u6a21\u578b&#xff08;Models&#xff09;<\/h4>\n<p>LangChain\u652f\u6301\u591a\u79cd\u6a21\u578b\u63d0\u4f9b\u5546&#xff0c;\u7edf\u4e00\u4e86\u4e0d\u540c\u6a21\u578b\u7684\u8c03\u7528\u63a5\u53e3\u3002<\/p>\n<p>from langchain.llms import OpenAI<br \/>\nfrom langchain.chat_models import ChatOpenAI<\/p>\n<p># \u4f7f\u7528OpenAI GPT-3<br \/>\nllm &#061; OpenAI(model_name&#061;&#034;text-davinci-003&#034;, temperature&#061;0.7)<\/p>\n<p># \u4f7f\u7528ChatGPT<br \/>\nchat_model &#061; ChatOpenAI(temperature&#061;0.7)<\/p>\n<h4>2. \u63d0\u793a&#xff08;Prompts&#xff09;<\/h4>\n<p>\u7ba1\u7406\u7cfb\u7edf\u5316\u63d0\u793a\u6a21\u677f&#xff0c;\u5b9e\u73b0\u63d0\u793a\u5de5\u7a0b\u7684\u6700\u4f73\u5b9e\u8df5\u3002<\/p>\n<p>from langchain.prompts import PromptTemplate<\/p>\n<p># \u521b\u5efa\u63d0\u793a\u6a21\u677f<br \/>\nprompt &#061; PromptTemplate(<br \/>\n    input_variables&#061;[&#034;product&#034;],<br \/>\n    template&#061;&#034;\u4e3a{product}\u5199\u4e00\u4e2a\u5438\u5f15\u4eba\u7684\u5e7f\u544a\u6807\u8bed&#xff1a;&#034;<br \/>\n)<\/p>\n<p># \u4f7f\u7528\u6a21\u677f<br \/>\nformatted_prompt &#061; prompt.format(product&#061;&#034;\u667a\u80fd\u624b\u8868&#034;)<\/p>\n<h4>3. \u94fe&#xff08;Chains&#xff09;<\/h4>\n<p>\u5c06\u591a\u4e2aLLM\u8c03\u7528\u6216\u64cd\u4f5c\u7ec4\u5408\u6210\u6709\u5e8f\u7684\u5de5\u4f5c\u6d41\u3002<\/p>\n<p>from langchain.chains import LLMChain<br \/>\nfrom langchain.chains import SimpleSequentialChain<\/p>\n<p># \u521b\u5efa\u5355\u4e2a\u94fe<br \/>\nllm_chain &#061; LLMChain(llm&#061;llm, prompt&#061;prompt)<\/p>\n<p># \u521b\u5efa\u987a\u5e8f\u94fe<br \/>\nsummary_chain &#061; SimpleSequentialChain(<br \/>\n    chains&#061;[llm_chain, translate_chain],<br \/>\n    verbose&#061;True<br \/>\n)<\/p>\n<h4>4. \u8bb0\u5fc6&#xff08;Memory&#xff09;<\/h4>\n<p>\u4f7f\u94fe\u80fd\u591f\u5728\u591a\u6b21\u4ea4\u4e92\u4e2d\u8bb0\u4f4f\u4e0a\u4e0b\u6587\u4fe1\u606f\u3002<\/p>\n<p>from langchain.memory import ConversationBufferMemory<\/p>\n<p>memory &#061; ConversationBufferMemory()<br \/>\nconversation &#061; ConversationChain(<br \/>\n    llm&#061;llm,<br \/>\n    memory&#061;memory,<br \/>\n    verbose&#061;True<br \/>\n)<\/p>\n<h4>5. \u4ee3\u7406&#xff08;Agents&#xff09;<\/h4>\n<p>\u8ba9LLM\u80fd\u591f\u4f7f\u7528\u5916\u90e8\u5de5\u5177\u548cAPI&#xff0c;\u5927\u5927\u6269\u5c55\u4e86\u5e94\u7528\u80fd\u529b\u3002<\/p>\n<p>from langchain.agents import initialize_agent, Tool<br \/>\nfrom langchain.agents import AgentType<\/p>\n<p>tools &#061; [<br \/>\n    Tool(<br \/>\n        name&#061;&#034;\u641c\u7d22&#034;,<br \/>\n        func&#061;search_tool,<br \/>\n        description&#061;&#034;\u7528\u4e8e\u641c\u7d22\u6700\u65b0\u4fe1\u606f&#034;<br \/>\n    )<br \/>\n]<\/p>\n<p>agent &#061; initialize_agent(<br \/>\n    tools, llm, agent&#061;AgentType.ZERO_SHOT_REACT_DESCRIPTION, verbose&#061;True<br \/>\n)<\/p>\n<h4>6. \u7d22\u5f15&#xff08;Indexes&#xff09;<\/h4>\n<p>\u4f18\u5316\u6587\u6863\u7684\u52a0\u8f7d\u3001\u7d22\u5f15\u548c\u68c0\u7d22&#xff0c;\u6784\u5efa\u9ad8\u6548\u7684RAG&#xff08;\u68c0\u7d22\u589e\u5f3a\u751f\u6210&#xff09;\u5e94\u7528\u3002<\/p>\n<p>from langchain.document_loaders import TextLoader<br \/>\nfrom langchain.text_splitter import CharacterTextSplitter<br \/>\nfrom langchain.embeddings import OpenAIEmbeddings<br \/>\nfrom langchain.vectorstores import Chroma<\/p>\n<p># \u52a0\u8f7d\u548c\u5206\u5272\u6587\u6863<br \/>\nloader &#061; TextLoader(&#034;document.txt&#034;)<br \/>\ndocuments &#061; loader.load()<br \/>\ntext_splitter &#061; CharacterTextSplitter(chunk_size&#061;1000, chunk_overlap&#061;0)<br \/>\ndocs &#061; text_splitter.split_documents(documents)<\/p>\n<p># \u521b\u5efa\u5411\u91cf\u5b58\u50a8<br \/>\nembeddings &#061; OpenAIEmbeddings()<br \/>\nvectorstore &#061; Chroma.from_documents(docs, embeddings)<\/p>\n<h3>\u4e09\u3001\u5b9e\u6218\u6848\u4f8b&#xff1a;\u6784\u5efa\u667a\u80fd\u6587\u6863\u95ee\u7b54\u7cfb\u7edf<\/h3>\n<p>\u4e0b\u9762\u6211\u4eec\u901a\u8fc7\u4e00\u4e2a\u5b8c\u6574\u7684\u793a\u4f8b&#xff0c;\u5c55\u793a\u5982\u4f55\u4f7f\u7528LangChain\u6784\u5efa\u4e00\u4e2a\u667a\u80fd\u6587\u6863\u95ee\u7b54\u7cfb\u7edf\u3002<\/p>\n<p>from langchain.chains import RetrievalQA<br \/>\nfrom langchain.llms import OpenAI<\/p>\n<p># 1. \u51c6\u5907\u6587\u6863\u548c\u5411\u91cf\u6570\u636e\u5e93<br \/>\nloader &#061; DirectoryLoader(&#039;.\/documents\/&#039;, glob&#061;&#034;**\/*.txt&#034;)<br \/>\ndocuments &#061; loader.load()<\/p>\n<p># \u5206\u5272\u6587\u6863<br \/>\ntext_splitter &#061; RecursiveCharacterTextSplitter(<br \/>\n    chunk_size&#061;1000,<br \/>\n    chunk_overlap&#061;200<br \/>\n)<br \/>\ntexts &#061; text_splitter.split_documents(documents)<\/p>\n<p># \u521b\u5efa\u5411\u91cf\u5b58\u50a8<br \/>\nembeddings &#061; OpenAIEmbeddings()<br \/>\nvectorstore &#061; Chroma.from_documents(texts, embeddings)<\/p>\n<p># 2. \u521b\u5efa\u68c0\u7d22QA\u94fe<br \/>\nqa_chain &#061; RetrievalQA.from_chain_type(<br \/>\n    llm&#061;OpenAI(temperature&#061;0),<br \/>\n    chain_type&#061;&#034;stuff&#034;,<br \/>\n    retriever&#061;vectorstore.as_retriever(),<br \/>\n    return_source_documents&#061;True<br \/>\n)<\/p>\n<p># 3. \u4f7f\u7528\u7cfb\u7edf<br \/>\nquery &#061; &#034;\u4ec0\u4e48\u662f\u673a\u5668\u5b66\u4e60&#xff1f;&#034;<br \/>\nresult &#061; qa_chain({&#034;query&#034;: query})<br \/>\nprint(f&#034;\u7b54\u6848&#xff1a;{result[&#039;result&#039;]}&#034;)<\/p>\n<h3>\u56db\u3001LangChain\u9ad8\u7ea7\u7279\u6027\u63a2\u7d22<\/h3>\n<h4>1. \u56de\u8c03\u7cfb\u7edf<\/h4>\n<p>LangChain\u63d0\u4f9b\u4e86\u5f3a\u5927\u7684\u56de\u8c03\u7cfb\u7edf&#xff0c;\u65b9\u4fbf\u76d1\u63a7\u548c\u8c03\u8bd5\u5e94\u7528\u3002<\/p>\n<p>from langchain.callbacks import StdOutCallbackHandler<\/p>\n<p>handler &#061; StdOutCallbackHandler()<br \/>\nchain &#061; LLMChain(llm&#061;llm, prompt&#061;prompt, callbacks&#061;[handler])<\/p>\n<h4>2. \u6d41\u5f0f\u54cd\u5e94<\/h4>\n<p>\u5b9e\u73b0\u5b9e\u65f6\u54cd\u5e94\u7684\u804a\u5929\u4f53\u9a8c\u3002<\/p>\n<p>from langchain.callbacks.streaming_stdout import StreamingStdOutCallbackHandler<\/p>\n<p>streaming_llm &#061; OpenAI(<br \/>\n    streaming&#061;True,<br \/>\n    callbacks&#061;[StreamingStdOutCallbackHandler()],<br \/>\n    temperature&#061;0<br \/>\n)<\/p>\n<h4>3. \u81ea\u5b9a\u4e49\u94fe\u548c\u5de5\u5177<\/h4>\n<p>LangChain\u652f\u6301\u9ad8\u5ea6\u5b9a\u5236\u5316&#xff0c;\u53ef\u4ee5\u6839\u636e\u9700\u6c42\u521b\u5efa\u81ea\u5df1\u7684\u94fe\u548c\u5de5\u5177\u3002<\/p>\n<p>from langchain.tools import BaseTool<\/p>\n<p>class CustomCalculatorTool(BaseTool):<br \/>\n    name &#061; &#034;\u8ba1\u7b97\u5668&#034;<br \/>\n    description &#061; &#034;\u7528\u4e8e\u8fdb\u884c\u6570\u5b66\u8ba1\u7b97&#034;<\/p>\n<p>    def _run(self, expression: str) -&gt; str:<br \/>\n        return str(eval(expression))<\/p>\n<h3>\u4e94\u3001\u6027\u80fd\u4f18\u5316\u548c\u6700\u4f73\u5b9e\u8df5<\/h3>\n<h4>1. \u63d0\u793a\u4f18\u5316\u6280\u5de7<\/h4>\n<ul>\n<li>\n<p>\u4f7f\u7528\u5c11\u6837\u672c\u5b66\u4e60&#xff08;Few-shot learning&#xff09;\u63d0\u9ad8\u51c6\u786e\u6027<\/p>\n<\/li>\n<li>\n<p>\u5b9e\u73b0\u601d\u7ef4\u94fe&#xff08;Chain-of-Thought&#xff09;\u63a8\u7406<\/p>\n<\/li>\n<li>\n<p>\u8bbe\u8ba1\u6e05\u6670\u7684\u6307\u4ee4\u548c\u7ea6\u675f<\/p>\n<\/li>\n<\/ul>\n<h4>2. \u7f13\u5b58\u7b56\u7565<\/h4>\n<p>from langchain.cache import InMemoryCache<br \/>\nimport langchain<br \/>\nlangchain.llm_cache &#061; InMemoryCache()<\/p>\n<h4>3. \u9519\u8bef\u5904\u7406\u548c\u91cd\u8bd5\u673a\u5236<\/h4>\n<p>from langchain.llms import OpenAI<br \/>\nfrom tenacity import retry, stop_after_attempt, wait_exponential<\/p>\n<p>&#064;retry(stop&#061;stop_after_attempt(3), wait&#061;wait_exponential(multiplier&#061;1, min&#061;4, max&#061;10))<br \/>\ndef robust_llm_call(prompt):<br \/>\n    llm &#061; OpenAI()<br \/>\n    return llm(prompt)<\/p>\n<h3>\u516d\u3001\u884c\u4e1a\u5e94\u7528\u573a\u666f<\/h3>\n<h4>1. \u4f01\u4e1a\u7ea7\u5e94\u7528<\/h4>\n<ul>\n<li>\n<p>\u667a\u80fd\u5ba2\u670d\u548c\u95ee\u7b54\u7cfb\u7edf<\/p>\n<\/li>\n<li>\n<p>\u6587\u6863\u5206\u6790\u548c\u6458\u8981\u751f\u6210<\/p>\n<\/li>\n<li>\n<p>\u6570\u636e\u67e5\u8be2\u548c\u5206\u6790\u52a9\u624b<\/p>\n<\/li>\n<\/ul>\n<h4>2. \u6559\u80b2\u9886\u57df<\/h4>\n<ul>\n<li>\n<p>\u4e2a\u6027\u5316\u5b66\u4e60\u52a9\u624b<\/p>\n<\/li>\n<li>\n<p>\u667a\u80fd\u9898\u76ee\u751f\u6210\u548c\u89e3\u7b54<\/p>\n<\/li>\n<li>\n<p>\u5b66\u4e60\u5185\u5bb9\u63a8\u8350\u7cfb\u7edf<\/p>\n<\/li>\n<\/ul>\n<h4>3. \u5185\u5bb9\u521b\u4f5c<\/h4>\n<ul>\n<li>\n<p>\u8425\u9500\u6587\u6848\u81ea\u52a8\u751f\u6210<\/p>\n<\/li>\n<li>\n<p>\u6280\u672f\u6587\u6863\u64b0\u5199\u52a9\u624b<\/p>\n<\/li>\n<li>\n<p>\u521b\u610f\u5199\u4f5c\u652f\u6301\u5de5\u5177<\/p>\n<\/li>\n<\/ul>\n<h3>\u4e03\u3001\u672a\u6765\u5c55\u671b\u4e0e\u6311\u6218<\/h3>\n<h4>\u53d1\u5c55\u8d8b\u52bf&#xff1a;<\/h4>\n<li>\n<p>\u591a\u6a21\u6001\u6269\u5c55&#xff1a;\u652f\u6301\u56fe\u50cf\u3001\u97f3\u9891\u7b49\u591a\u7c7b\u578b\u6570\u636e<\/p>\n<\/li>\n<li>\n<p>\u66f4\u597d\u7684\u672c\u5730\u5316\u90e8\u7f72&#xff1a;\u4f18\u5316\u79bb\u7ebf\u8fd0\u884c\u80fd\u529b<\/p>\n<\/li>\n<li>\n<p>\u4f01\u4e1a\u7ea7\u529f\u80fd\u589e\u5f3a&#xff1a;\u5b89\u5168\u3001\u76d1\u63a7\u3001\u6743\u9650\u7ba1\u7406\u7b49<\/p>\n<\/li>\n<h4>\u5f53\u524d\u6311\u6218&#xff1a;<\/h4>\n<ul>\n<li>\n<p>\u5904\u7406\u590d\u6742\u903b\u8f91\u7684\u80fd\u529b\u6709\u9650<\/p>\n<\/li>\n<li>\n<p>\u6210\u672c\u63a7\u5236\u548c\u4f18\u5316<\/p>\n<\/li>\n<li>\n<p>\u9690\u79c1\u548c\u6570\u636e\u5b89\u5168\u95ee\u9898<\/p>\n<\/li>\n<\/ul>\n<h3>\u7ed3\u8bed&#xff1a;\u62e5\u62b1AI\u5e94\u7528\u5f00\u53d1\u7684\u65b0\u65f6\u4ee3<\/h3>\n<p>LangChain\u6846\u67b6\u4e3a\u5f00\u53d1\u8005\u63d0\u4f9b\u4e86\u6784\u5efa\u4e0b\u4e00\u4ee3AI\u5e94\u7528\u7684\u5f3a\u5927\u5de5\u5177\u96c6\u3002\u901a\u8fc7\u5176\u6a21\u5757\u5316\u8bbe\u8ba1\u548c\u4e30\u5bcc\u7684\u7ec4\u4ef6&#xff0c;\u5f00\u53d1\u8005\u53ef\u4ee5\u4e13\u6ce8\u4e8e\u5e94\u7528\u903b\u8f91\u800c\u4e0d\u662f\u5e95\u5c42\u5b9e\u73b0\u7ec6\u8282\u3002\u968f\u7740\u6846\u67b6\u7684\u4e0d\u65ad\u6210\u719f\u548c\u751f\u6001\u7cfb\u7edf\u7684\u5b8c\u5584&#xff0c;\u6211\u4eec\u6709\u7406\u7531\u76f8\u4fe1&#xff0c;LangChain\u5c06\u6210\u4e3aAI\u5e94\u7528\u5f00\u53d1\u7684\u6807\u51c6\u5de5\u5177\u4e4b\u4e00\u3002<\/p>\n<p>\u5bf9\u4e8e\u60f3\u8981\u8fdb\u5165AI\u5e94\u7528\u5f00\u53d1\u9886\u57df\u7684\u5f00\u53d1\u8005\u6765\u8bf4&#xff0c;\u73b0\u5728\u6b63\u662f\u5b66\u4e60LangChain\u7684\u6700\u4f73\u65f6\u673a\u3002\u65e0\u8bba\u662f\u6784\u5efa\u4f01\u4e1a\u5185\u90e8\u5de5\u5177&#xff0c;\u8fd8\u662f\u5f00\u53d1\u9762\u5411\u7528\u6237\u7684AI\u4ea7\u54c1&#xff0c;LangChain\u90fd\u80fd\u63d0\u4f9b\u5f3a\u6709\u529b\u7684\u652f\u6301\u3002<\/p>\n<p>\u6280\u672f\u7684\u4ef7\u503c\u5728\u4e8e\u5e94\u7528&#xff0c;\u800cLangChain\u6b63\u5728\u8ba9AI\u5e94\u7528\u5f00\u53d1\u53d8\u5f97\u524d\u6240\u672a\u6709\u7684\u7b80\u5355\u3002\u00a0\u5f00\u59cb\u4f60\u7684LangChain\u4e4b\u65c5&#xff0c;\u6784\u5efa\u5c5e\u4e8e\u81ea\u5df1\u7684\u667a\u80fd\u5e94\u7528\u5427&#xff01;<\/p>\n<p>\u6b22\u8fce\u5728\u8bc4\u8bba\u533a\u5206\u4eab\u4f60\u7684LangChain\u4f7f\u7528\u7ecf\u9a8c&#xff01;\u5982\u679c\u4f60\u5728\u5b9e\u8df5\u8fc7\u7a0b\u4e2d\u9047\u5230\u4efb\u4f55\u95ee\u9898&#xff0c;\u6216\u8005\u6709\u72ec\u7279\u7684\u5e94\u7528\u6848\u4f8b&#xff0c;\u6b22\u8fce\u4ea4\u6d41\u8ba8\u8bba\u3002<\/p>\n<p>\u5173\u6ce8\u6211&#xff0c;\u83b7\u53d6\u66f4\u591aAI\u5f00\u53d1\u6280\u672f\u5e72\u8d27&#xff01;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5f15\u8a00&#xff1a;AI\u5e94\u7528\u5f00\u53d1\u7684\u8303\u5f0f\u8f6c\u53d8\u968f\u7740\u5927\u8bed\u8a00\u6a21\u578b&#xff08;LLM&#xff09;\u7684\u5feb\u901f\u53d1\u5c55&#xff0c;\u6211\u4eec\u6b63\u7ad9\u5728AI\u5e94\u7528\u5f00\u53d1\u7684\u65b0\u62d0\u70b9\u3002\u8fc7\u53bb&#xff0c;\u6784\u5efaAI\u9a71\u52a8\u7684\u5e94\u7528\u5f80\u5f80\u9700\u8981\u590d\u6742\u7684\u5de5\u7a0b\u67b6\u6784\u548c\u5927\u91cf\u7684\u5b9a\u5236\u5316\u5f00\u53d1\u3002\u800c\u4eca&#xff0c;LangChain\u6846\u67b6\u6b63\u5728\u6539\u53d8\u8fd9\u4e00\u5c40\u9762\u2014\u2014\u5b83\u662f\u4e00\u4e2a\u4e13\u95e8\u4e3a\u6784\u5efa\u57fa\u4e8e\u5927\u8bed\u8a00\u6a21\u578b\u7684\u5e94\u7528\u7a0b\u5e8f\u800c\u8bbe\u8ba1\u7684\u5f00\u6e90\u6846\u67b6&#xff0c;\u8ba9\u5f00\u53d1\u8005\u80fd\u591f\u66f4\u8f7b\u677e\u3001\u66f4\u9ad8\u6548\u5730\u521b\u5efa\u590d\u6742\u7684AI\u5e94\u7528\u3002\u4e00\u3001LangChain\u662f\u4ec0\u4e48&#xff1f;LangChain\u662f<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[997,50],"topic":[],"class_list":["post-60933","post","type-post","status-publish","format-standard","hentry","category-server","tag-langchain","tag-50"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u89e3\u9501AI\u5e94\u7528\u5f00\u53d1\u65b0\u8303\u5f0f\uff1a\u6df1\u5165\u63a2\u7d22LangChain\u6846\u67b6\u7684\u6838\u5fc3\u4e0e\u5b9e\u8df5 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/60933.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u89e3\u9501AI\u5e94\u7528\u5f00\u53d1\u65b0\u8303\u5f0f\uff1a\u6df1\u5165\u63a2\u7d22LangChain\u6846\u67b6\u7684\u6838\u5fc3\u4e0e\u5b9e\u8df5 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u5f15\u8a00&#xff1a;AI\u5e94\u7528\u5f00\u53d1\u7684\u8303\u5f0f\u8f6c\u53d8\u968f\u7740\u5927\u8bed\u8a00\u6a21\u578b&#xff08;LLM&#xff09;\u7684\u5feb\u901f\u53d1\u5c55&#xff0c;\u6211\u4eec\u6b63\u7ad9\u5728AI\u5e94\u7528\u5f00\u53d1\u7684\u65b0\u62d0\u70b9\u3002\u8fc7\u53bb&#xff0c;\u6784\u5efaAI\u9a71\u52a8\u7684\u5e94\u7528\u5f80\u5f80\u9700\u8981\u590d\u6742\u7684\u5de5\u7a0b\u67b6\u6784\u548c\u5927\u91cf\u7684\u5b9a\u5236\u5316\u5f00\u53d1\u3002\u800c\u4eca&#xff0c;LangChain\u6846\u67b6\u6b63\u5728\u6539\u53d8\u8fd9\u4e00\u5c40\u9762\u2014\u2014\u5b83\u662f\u4e00\u4e2a\u4e13\u95e8\u4e3a\u6784\u5efa\u57fa\u4e8e\u5927\u8bed\u8a00\u6a21\u578b\u7684\u5e94\u7528\u7a0b\u5e8f\u800c\u8bbe\u8ba1\u7684\u5f00\u6e90\u6846\u67b6&#xff0c;\u8ba9\u5f00\u53d1\u8005\u80fd\u591f\u66f4\u8f7b\u677e\u3001\u66f4\u9ad8\u6548\u5730\u521b\u5efa\u590d\u6742\u7684AI\u5e94\u7528\u3002\u4e00\u3001LangChain\u662f\u4ec0\u4e48&#xff1f;LangChain\u662f\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/60933.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-01-16T08:49:12+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/60933.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/60933.html\",\"name\":\"\u89e3\u9501AI\u5e94\u7528\u5f00\u53d1\u65b0\u8303\u5f0f\uff1a\u6df1\u5165\u63a2\u7d22LangChain\u6846\u67b6\u7684\u6838\u5fc3\u4e0e\u5b9e\u8df5 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-01-16T08:49:12+00:00\",\"dateModified\":\"2026-01-16T08:49:12+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/60933.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/60933.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/60933.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u89e3\u9501AI\u5e94\u7528\u5f00\u53d1\u65b0\u8303\u5f0f\uff1a\u6df1\u5165\u63a2\u7d22LangChain\u6846\u67b6\u7684\u6838\u5fc3\u4e0e\u5b9e\u8df5\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u89e3\u9501AI\u5e94\u7528\u5f00\u53d1\u65b0\u8303\u5f0f\uff1a\u6df1\u5165\u63a2\u7d22LangChain\u6846\u67b6\u7684\u6838\u5fc3\u4e0e\u5b9e\u8df5 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/60933.html","og_locale":"zh_CN","og_type":"article","og_title":"\u89e3\u9501AI\u5e94\u7528\u5f00\u53d1\u65b0\u8303\u5f0f\uff1a\u6df1\u5165\u63a2\u7d22LangChain\u6846\u67b6\u7684\u6838\u5fc3\u4e0e\u5b9e\u8df5 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u5f15\u8a00&#xff1a;AI\u5e94\u7528\u5f00\u53d1\u7684\u8303\u5f0f\u8f6c\u53d8\u968f\u7740\u5927\u8bed\u8a00\u6a21\u578b&#xff08;LLM&#xff09;\u7684\u5feb\u901f\u53d1\u5c55&#xff0c;\u6211\u4eec\u6b63\u7ad9\u5728AI\u5e94\u7528\u5f00\u53d1\u7684\u65b0\u62d0\u70b9\u3002\u8fc7\u53bb&#xff0c;\u6784\u5efaAI\u9a71\u52a8\u7684\u5e94\u7528\u5f80\u5f80\u9700\u8981\u590d\u6742\u7684\u5de5\u7a0b\u67b6\u6784\u548c\u5927\u91cf\u7684\u5b9a\u5236\u5316\u5f00\u53d1\u3002\u800c\u4eca&#xff0c;LangChain\u6846\u67b6\u6b63\u5728\u6539\u53d8\u8fd9\u4e00\u5c40\u9762\u2014\u2014\u5b83\u662f\u4e00\u4e2a\u4e13\u95e8\u4e3a\u6784\u5efa\u57fa\u4e8e\u5927\u8bed\u8a00\u6a21\u578b\u7684\u5e94\u7528\u7a0b\u5e8f\u800c\u8bbe\u8ba1\u7684\u5f00\u6e90\u6846\u67b6&#xff0c;\u8ba9\u5f00\u53d1\u8005\u80fd\u591f\u66f4\u8f7b\u677e\u3001\u66f4\u9ad8\u6548\u5730\u521b\u5efa\u590d\u6742\u7684AI\u5e94\u7528\u3002\u4e00\u3001LangChain\u662f\u4ec0\u4e48&#xff1f;LangChain\u662f","og_url":"https:\/\/www.wsisp.com\/helps\/60933.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-01-16T08:49:12+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"2 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/60933.html","url":"https:\/\/www.wsisp.com\/helps\/60933.html","name":"\u89e3\u9501AI\u5e94\u7528\u5f00\u53d1\u65b0\u8303\u5f0f\uff1a\u6df1\u5165\u63a2\u7d22LangChain\u6846\u67b6\u7684\u6838\u5fc3\u4e0e\u5b9e\u8df5 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-01-16T08:49:12+00:00","dateModified":"2026-01-16T08:49:12+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/60933.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/60933.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/60933.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"\u89e3\u9501AI\u5e94\u7528\u5f00\u53d1\u65b0\u8303\u5f0f\uff1a\u6df1\u5165\u63a2\u7d22LangChain\u6846\u67b6\u7684\u6838\u5fc3\u4e0e\u5b9e\u8df5"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/60933","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=60933"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/60933\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=60933"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=60933"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=60933"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=60933"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}