performaisearch

1.0.0 • Public • Published

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

Dependencies (1)

Dev Dependencies (0)

    Package Sidebar

    Install

    npm i performaisearch

    Weekly Downloads

    0

    Version

    1.0.0

    License

    ISC

    Unpacked Size

    3.11 kB

    Total Files

    3

    Last publish

    Collaborators

    • supernived