# Make Chat Completion

**Introduction**

The "Make Chat Completion" step interacts with the OpenAI API to generate chat completions based on provided messages and conversation history. This step is ideal for automating responses or generating conversational AI outputs.

**Configuration**

* **Connection**: The [Connections](/general/connections.md) to the OpenAI service. This parameter is required.
* **Model**: The specific model used for generating the chat completion. Default is `gpt-4o-mini`. For a list of available models, refer to [OpenAI Models](https://platform.openai.com/docs/models/models). This parameter is required.
* **Instructions**: Instructions to guide the model's behavior, tone, and response style.
* **Message**: The latest message from the user. This parameter allows the model to generate a relevant continuation.
* **History**:
  * **Assistant**: Specifies which author's messages are treated as assistant messages. Other messages are considered user messages. This parameter is required.
  * **Messages**: A list of previous messages in the conversation. This history provides context for generating more accurate responses.
* **Max Tokens**: The maximum number of tokens to generate in the chat completion. The default value is 256. This parameter is required.

**Outputs**

* **Message**: The generated message from the model, provided as text. This output can be used in subsequent steps or actions.

This step leverages the capabilities of OpenAI's language models to enhance conversational AI, allowing for dynamic and context-aware responses.


---

# 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.flexy.bot/modules/openai/steps/make-chat-completion.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.
