org.llm4s.toolapi.builtin.search

Search tools for web searches and lookups.

These tools provide web search capabilities using free APIs that don't require API keys.

== Available Tools ==

  • WebSearchTool: Search using DuckDuckGo Instant Answer API
  • Best for definitions, facts, quick lookups
  • No API key required
  • Returns abstracts, related topics, and infobox data

Attributes

Example
import org.llm4s.toolapi.builtin.search._
import org.llm4s.toolapi.ToolRegistry
// Default search tool
val searchTool = WebSearchTool.create()
// Custom configuration
val customSearch = WebSearchTool.create(WebSearchConfig(
 timeoutMs = 15000,
 maxResults = 5
))
val tools = new ToolRegistry(Seq(searchTool))

Members list

Type members

Classlikes

case class RelatedTopic(text: String, url: Option[String])

A related topic from web search.

A related topic from web search.

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object RelatedTopic

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
case class WebSearchConfig(timeoutMs: Int, maxResults: Int, safeSearch: Boolean)

Configuration for web search tool.

Configuration for web search tool.

Value parameters

maxResults

Maximum number of related topics to return.

safeSearch

Whether to enable safe search.

timeoutMs

Request timeout in milliseconds.

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
case class WebSearchResult(query: String, abstract_: String, abstractSource: String, abstractUrl: String, answer: String, answerType: String, relatedTopics: Seq[RelatedTopic], infoboxContent: Option[String])

Web search result.

Web search result.

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
object WebSearchTool

Tool for web searching using DuckDuckGo's Instant Answer API.

Tool for web searching using DuckDuckGo's Instant Answer API.

This tool provides quick answers and definitions without requiring an API key. It's best suited for factual queries, definitions, and quick lookups.

Note: This uses DuckDuckGo's free Instant Answer API which provides:

  • Definitions from Wikipedia
  • Quick facts
  • Related topics
  • Disambiguation pages

It does NOT provide full web search results (that would require a paid API).

Attributes

Example
{
import org.llm4s.toolapi.builtin.search._
val searchTool = WebSearchTool.create()
val tools = new ToolRegistry(Seq(searchTool))
agent.run("What is Scala programming language?", tools)

}

Supertypes
class Object
trait Matchable
class Any
Self type

Value members

Concrete fields

val allTools: Seq[ToolFunction[_, _]]

All search tools with default configuration.

All search tools with default configuration.

Attributes