performaisearch
v1.0.0
Published
Utility package including AI search for based on your json data
Downloads
4
Readme
performaisearch
A utility package to perform AI-powered searches using OpenAI's API, based on your JSON data.
Description
The performaisearch
function connects to the OpenAI API to perform searches or generate responses based on a user's input and predefined JSON data. This can be used to integrate AI-driven search capabilities into your applications.
Installation
To use performaisearch
in your project, install it via npm:
npm install performaisearch
Usage
import { performaisearch } from 'performaisearch';
const userInput = 'Search Query';
const jsonData = {
"products": [
{"name": "Laptop", "category": "Electronics"},
{"name": "Shirt", "category": "Apparel"}
]
};
const apiKey = 'your-openai-api-key'; // Replace with your actual OpenAI API key
const type = 'gpt-3.5-turbo';
performaisearch(userInput, jsonData, apiKey, type)
.then(response => {
console.log('AI response:', response);
})
.catch(error => {
console.error('Search error:', error);
});