1.0.0 • Published 2 months ago

performaisearch v1.0.0

Weekly downloads
-
License
ISC
Repository
github
Last release
2 months ago

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);
    });
1.0.0

2 months ago