管理Langchain中的搜索结果

huangapple go评论59阅读模式
英文:

Manage search results in Langchain

问题

我是Langchain的新手。我想创建一个应用程序,使用Langchain的搜索代理,如serpapi,在互联网上找到一些有用的信息。但大多数时候,当我需要参考信息时,它返回无关的来源。我想要管理它的搜索内容。我该如何在Python中实现这个?我已经搜索过解决方案,但找到的自定义工具都没有帮助。

英文:

I am kind of new to Langchain. I wanted to create an app that uses Langchain's search agents like serpapi and find some useful information on the internet. But most of the times, when I want references from it, it returns irrelevant sources. I want to manage what it searches. How can I do that in python?

I have searched for the solutions and found custom tools but they were not helpful.

答案1

得分: 1

搜索结果依赖于您的LLM用于搜索的关键词。LLM根据您提供的信息(提示)选择要搜索的关键词。所以,您在这里有三个选项:

  • 优化您的提示,以便您的LLM可以正确跟随。也许可以给出一些示例(以防需要少量示例来描述反应)。
  • 在收到搜索结果后,尝试要求您的LLM提取相关信息并优化结果。您可以查看这个解释
  • 如果您正在使用本地LLM,可以尝试更大的LLM。据我们所知,更大的模型具有更好的推理能力。
英文:

The search results depend on the keyword your LLM used to search. The LLM chooses keywords to search based on your provided information (prompt). So, you have three options here:

  • Optimize your prompt so that your LLM can follow correctly. Maybe
    give it some examples (in case of a few-shot react description).
  • After receiving a search result, try to ask your LLM to extract
    relevant information and refine the result. You can check this
    explanation
    .
  • In case you're using local LLM, try a bigger LLM. As far as we know,
    a bigger model has a better reasoning ability.

答案2

得分: 0

唯一操纵搜索结果的方式是使用提示。明确指定目标,添加示例,不要添加矛盾的观点。

英文:

the only way to manipulate the search result is using the prompt. Specify the goal clearly, add examples, Do not add contradictory ideas.

huangapple
  • 本文由 发表于 2023年5月15日 00:13:46
  • 转载请务必保留本文链接:https://go.coder-hub.com/76248496.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定