sobelio / llm-chain

`llm-chain` is a powerful rust crate for building chains in large language models allowing you to summarise text and complete complex tasks
https://llm-chain.xyz
MIT License
1.3k stars 128 forks source link

feat: add google serper (search) tool #221

Closed danbev closed 10 months ago

danbev commented 10 months ago

This commit adds a new tool that can be used to search the internet for information similar to BingSearch. The tool uses the Google Serper API to perform the search.


Example output from crates/llm-chain-openai/examples/self_ask_with_google_search.rs:

$ cargo r --example self_ask_with_google_search
   Compiling llm-chain-openai v0.12.3 (/home/danielbevenius/work/ai/llm-chain/crates/llm-chain-openai)
    Finished dev [unoptimized + debuginfo] target(s) in 5.04s
     Running `target/debug/examples/self_ask_with_google_search`

Are followup questions needed here: Yes. 

Follow up: Where was Levy Mwanawasa born?
Intermediate answer: Levy Mwanawasa was a member of the Lenje tribe and was educated at Chiwala Secondary School in Ndola. He read law at the University of Zambia in Lusaka from ...
Follow up: What is the capital of Zambia?
Intermediate answer: And viewed from the villages, Lusaka is the glittering capital which still persuades rural Zambians to migrate to the city in search of jobs and dreams. Most ...

Agent final answer: Lusaka.

I've not been able to get a Bing API key as there seems to be some issue with their phone verification at the moment, so I've not been able to compare this output to the Bing example.

danbev commented 10 months ago

LGTM let me know if you intend to make anymore changes

I don't intend to make anymore changes, thanks!