const res = await client.searchFiles({
query: 'what are the most popular products of your company?', // This is the natural language query (for example: a user's question) to be used for running a semantic search on the files of the bot.
contextDepth: 1, // Optional (default: 0), allows you prepend and append the surrounding context to each matching passage in the search results
tags: {
// Optional, allows you to only search files that match the specified tags. Useful if you only want to search a subset of the bot's files.
category: 'Support',
subcategory: 'Technical',
},
limit: 30, // Default is 20, maximum is 50 results
})
const passages = res.data.passages
for (const passage of passages) {
// You can use passage.content here to retrieve the content (including surrounding context, if any) of each matching passage
}