# OpenAI Fine Tune

> Chat completion using OpenAI fine-tuned models with custom training.

Source: https://cotera.co/docs/reference/tools/individual-tools/openai-finetune

---

**Authentication Type:** API Key\
**Description:** Chat completion using OpenAI fine-tuned models with custom training.

***

## Authentication

To authenticate, you'll need an OpenAI API key. Create one in the [OpenAI Platform](https://platform.openai.com/api-keys).

***

## OpenAI Chat

Chat completion using OpenAI fine-tuned models.

### Chat Completion

Generate chat completions using a specified OpenAI fine-tuned model. Provide the model name and conversation messages.

**Operation Type:** Query (Read)

**Parameters:**

* **modelName** `string` (required): Name of the fine-tuned OpenAI model to use
* **messages** `array of objects` (required): Array of messages for the chat completion
  * **role** `string` (required): Role of the message sender. Options: "system", "user", "assistant"
  * **content** `string` (required): Content of the message

**Returns:**

* **id** `string` (nullable): Unique identifier for the completion
* **object** `string` (nullable): Object type, typically "chat.completion"
* **created** `number` (nullable): Unix timestamp of creation
* **model** `string` (nullable): Model used for completion
* **choices** `array of objects` (nullable): Array of completion choices
  * **index** `number` (nullable): Index of the choice
  * **message** `object` (nullable): The generated message
    * **role** `string` (nullable): Role of the message
    * **content** `string` (nullable): Content of the message
  * **finishReason** `string` (nullable): Reason the completion finished
* **usage** `object` (nullable): Token usage information
  * **promptTokens** `number` (nullable): Number of tokens in the prompt
  * **completionTokens** `number` (nullable): Number of tokens in the completion
  * **totalTokens** `number` (nullable): Total number of tokens used

**Example Usage:**

```json
{
  "modelName": "ft:gpt-3.5-turbo-0125:my-org:custom-suffix:7p4lURel",
  "messages": [
    {
      "role": "system",
      "content": "You are a helpful assistant specialized in customer support for an e-commerce platform."
    },
    {
      "role": "user",
      "content": "I haven't received my order yet and it's been 5 days. What should I do?"
    }
  ]
}
```

***

## Common Use Cases

**Custom Domain Expertise:**

* Deploy fine-tuned models trained on domain-specific knowledge for specialized assistance
* Use models customized for specific industries like healthcare, legal, finance, or technical support
* Implement brand-specific tone and communication styles through fine-tuned model responses

**Personalized AI Applications:**

* Create conversational AI with custom personality traits and response patterns
* Build customer service bots trained on company-specific policies and procedures
* Develop educational assistants fine-tuned on curriculum-specific content and teaching methodologies

**Quality Control and Consistency:**

* Ensure consistent response quality and style across different user interactions
* Monitor token usage and completion performance for cost optimization and efficiency
* Generate responses with predictable formatting and structure based on fine-tuned training data

**Production AI Deployment:**

* Integrate fine-tuned models into production applications with reliable performance metrics
* Scale custom AI solutions with specialized knowledge while maintaining OpenAI's infrastructure
* Track completion metadata including finish reasons and token usage for monitoring and optimization

