-1

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.

kheirq
  • 31
  • 2

2 Answers2

1

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.
0

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