Skip to content
A minimalist 8-bit illustration features three evenly spaced icons: the first is a grid made of colored squares representing vector search; the second is a magnifying glass above horizontal rectangles symbolizing fuzzy search; the third is a globe next to a browser window indicating web search. Only five flat colors are used, set against a plain white background with clear separation and symmetry, all in a clean 128x128 layout.

Retrieval

GenAIScript provides various utilities to retrieve content and augment the prompt. This technique is typically referred to as RAG (Retrieval-Augmentation-Generation) in the literature.

GenAIScript provides various vector database to support embeddings (vector) search.

// index creation
const index = await retrieval.index("animals")
// indexing
await index.insertOrUpdate(env.files)
// search
const res = await index.search("cat dog")
def("RAG", res)

The retrieve.fuzzSearch performs a “traditional” fuzzy search to find the most similar documents to the prompt.

const files = await retrieval.fuzzSearch("cat dog", env.files)

The retrieval.webSearch performs a web search using a search engine API. You will need to provide API keys for the search engine you want to use.

const { webPages } = await retrieval.webSearch("cat dog")
def("RAG", webPages)

To enable Bing search, configure the BING_SEARCH_API_KEY secret in your .env file. Learn more about configuring the Bing Search API.