Skip to main content

Function: snippetAround()

snippetAround(text, words, options?): Snippet

Defined in: packages/agentos/src/cognition/library/tokens.ts:60

A hit's snippet: the first word of the text that begins with one of the query's words (the lexical legs' prefix rule, on the words of the word rule, each word and query word compared in NFC and in lower case), and whole words around it; with no such word, the text's start. The offset is the text's own, read on the text as given, so a caller places the hit in its turns. before is 80 and after 120 unless given.

Parameters​

text​

string

words​

readonly string[]

options?​

after?​

number

before?​

number

Returns​

Snippet