概述
PrologTool 类允许生成使用 Prolog 规则来产生答案的 LangChain 工具。设置
使用以下 Prolog 规则,存储在 family.pl 文件中: parent(john, bianca, mary).parent(john, bianca, michael).
parent(peter, patricia, jennifer).
partner(X, Y) :- parent(X, Y, _).
实例化
首先创建 Prolog 工具:调用
将 Prolog 工具与 LLM 及函数调用结合使用
链式调用
将 Prolog 工具与 Agent 结合使用
要在 Agent 中使用 Prolog 工具,将其传入 Agent 的构造函数:API 参考
详细信息请参阅 langchain-prolog.readthedocs.io/en/latest/modules.html。Connect these docs to Claude, VSCode, and more via MCP for real-time answers.

