searxng

package
v1.5.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 19, 2025 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package searxng The SearxNG Search Tool is a powerful utility within the Atomic Agents ecosystem that allows you to perform searches using SearxNG, a privacy-respecting metasearch engine. This tool enables you to fetch search results from multiple sources while maintaining user privacy.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Category

type Category = string
const (
	EmptyCategory       Category = ""
	GeneralCategory     Category = "general"
	NewsCategory        Category = "news"
	SocialMediaCategory Category = "social_media"
)

type Config

type Config struct {
	tools.Config
	// contains filtered or unexported fields
}

type Input

type Input struct {
	schema.Base
	// Queries list of search queries.
	Queries []string `json:"queries" jsonschema:"title=queries,description=List of search queries." validate:"required"`
	// Category: Category of the search queries.
	Category Category `` /* 154-byte string literal not displayed */
}

Input Schema for input to a tool for searching for information, news, references, and other content using SearxNG. Returns a list of search results with a short description or content snippet and URLs for further exploration

func NewInput

func NewInput(category Category, queries []string) *Input

type Option

type Option func(*Config)

func WithBaseURL

func WithBaseURL(baseURL string) Option

func WithHttpClient

func WithHttpClient(clt *http.Client) Option

func WithLanguage

func WithLanguage(lang string) Option

func WithMaxResults

func WithMaxResults(n int) Option

type Output

type Output struct {
	schema.Base
	// Query The query used to obtain this search result
	Query string `json:"query,omitempty" jsonschema:"title=query,description=The query used to obtain this search result"`
	// Results List of search result items
	Results []SearchResultItem `json:"results,omitempty" jsonschema:"title=results,description=List of search result items"`
	// Category The category of the search results
	Category Category `` /* 154-byte string literal not displayed */
}

Output represents the output of the SearxNG search tool. the schema implements SystemPromptContextProvider

func NewOutput

func NewOutput(query string, results []SearchResultItem, category Category) *Output

func (Output) Info

func (s Output) Info() string

Info implements SystemPromptContextProvider interface

func (Output) Title

func (s Output) Title() string

Title implements SystemPromptContextProvider interface

type SearchResultItem

type SearchResultItem struct {
	schema.Base
	// URL The URL of the search result
	URL string `json:"url" jsonschema:"title=url,description=The URL of the search result" validate:"required,url"`
	// Title The title of the search result
	Title string `json:"title" jsonschema:"title=title,description=The title of the search result" validate:"required"`
	// Content The content snippet of the search result
	Content string `json:"content,omitempty" jsonschema:"title=content,description=The content snippet of the search result"`
	// Query The query used to obtain this search result
	Query string `json:"query" jsonschema:"title=query,description=The query used to obtain this search result" validate:"required"`
	// Category: Category of the search queries.
	Category Category `` /* 154-byte string literal not displayed */
	// Metadata search result metadata
	Metadata string `json:"metadata,omitempty" jsonschema:"title=metadata,description=The metadata of the search result"`
	// PublishedDate The published date of the search result
	PublishedDate string `json:"publishedDate,omitempty" jsonschema:"title=published_date,description=The published date of the search result"`
	// Score search result score
	Score float64 `json:"score,omitempty" jsonschema:"title=score,description=The score of the search result"`
}

SearchResultItem represents a single search result item

type Tool

type Tool struct {
	Config
}

Tool is a tool for performing searches on SearxNG based on the provided queries and category.

func New

func New(opts ...Option) *Tool

func (*Tool) Run

func (t *Tool) Run(ctx context.Context, input *Input, output *Output) error

Run Runs the SearxNGTool synchronously with the given parameters

func (*Tool) RunAnonymous added in v1.0.8

func (t *Tool) RunAnonymous(ctx context.Context, input any) (any, error)

RunAnonymous run tool for tools ochestration

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL