Documentation ¶
Overview ¶
Package wikipedia contains an implementation of the tool interface with the wikipedia api.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrUnexpectedAPIResult = errors.New("unexpected result from wikipedia api")
ErrUnexpectedAPIResult is returned if the result form the wikipedia api is unexpected.
Functions ¶
This section is empty.
Types ¶
type Tool ¶
type Tool struct { CallbacksHandler callbacks.Handler // The number of wikipedia pages to include in the result. TopK int // The number of characters to take from each page. DocMaxChars int // The language code to use. LanguageCode string // The user agent sent in the heder. See https://www.mediawiki.org/wiki/API:Etiquette. UserAgent string }
Tool is an implementation of the tool interface that finds information using the wikipedia api.
func New ¶
New creates a new wikipedia tool to find wikipedia pages using the wikipedia api. TopK is set to 2, DocMaxChars is set to 2000 and the language code is set to "en".
func (Tool) Call ¶
Call uses the wikipedia api to find the top search results for the input and returns the first part of the documents combined.
func (Tool) Description ¶
Click to show internal directories.
Click to hide internal directories.