Working with Open AI
Open Ai methods in the backend.
OpenAI Methods Documentation
This file contains various functions utilizing the OpenAI API for different purposes.
Initialization
Before using any OpenAI functions, ensure that you have initialized the API client with your API key.
Functions
chatCompletion()
This function allows interactive chat with an AI model. It sends a series of messages between the user and the assistant, generating responses from the AI model based on the conversation.
generateImage()
This function generates an image based on a given prompt. It utilizes the DALL-E model to create an image that corresponds to the provided description.
readingImage()
This function describes the content of an image. It takes an image URL as input and uses the GPT-4 Vision Preview model to generate a textual description of the image.
moderateInput()
This function moderates input text for inappropriate content. It sends a text input to the moderation API, which analyzes the text and returns a moderation decision.
Usage
These functions can be imported into your application and called as needed to leverage the capabilities of the OpenAI API for various tasks.
Last updated