const res = await heliconeLogger.logRequest(
{
_type: "vector_db",
operation: "search", // The operation performed. In this case, search.
// ...include any other data about the vector db request here (look at the API reference for more details)
},
async (resultRecorder) => {
// Your vector db operation here. In this case, search
const searchResults = await vectorDB.search({
query: "Find similar products to iPhone",
limit: 3
});
// Log the results
resultRecorder.appendResults({
// These are the results of the operation that Helicone will log
products: searchResults.map(result => ({
name: result.name,
price: result.price
}))
});
return searchResults;
}
);