# Working with Open AI

## 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.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.flutfast.com/backend/working-with-open-ai.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
