Abraxas-365 / langchain-rust

🦜️🔗LangChain for Rust, the easiest way to write LLM-based programs in Rust
MIT License
491 stars 63 forks source link

add DuckDuckGoSearchResults Tool #164

Closed prabirshrestha closed 3 months ago

prabirshrestha commented 3 months ago

This introduces duck duck go search tool. Here is the langchain python equivalent. https://github.com/langchain-ai/langchain/blob/0214246dc69dd2d4e11fd567308f666c220cfb0d/libs/community/langchain_community/tools/ddg_search/tool.py#L43

I'm only porting DuckDuckGoSearchResults and not DuckDuckGoSearchRun. The main difference between them seems to be one returning JSON while other is returning string.

My tests with llama3 and mistral both seems to be able to extract information from JSON and return the correct response. Phi3 wasn't good at figuring it out. In the future we can easily add DuckDuckGoSearchRun if needed.

Abraxas-365 commented 3 months ago

LGTM