Skip to main content
After completing your fine-tuning job, you can immediately evaluate your custom model either from the command line or within a Python script. This guide walks you through both methods.

1. Test Your Fine-Tuned Model via CLI

Use the openai api completions.create command and specify your fine-tuned model’s ID, which you can copy from the fine-tuning job output:
Example response:
Replace the model ID with your own fine-tuned model name. You can find it in the CLI output or in your OpenAI Dashboard.

2. Fine-Tuning Workflow Overview

Here’s a quick summary of the end-to-end fine-tuning process: For detailed instructions, see the OpenAI Fine-Tuning Guide.

3. Test Your Model in Python

This Python example demonstrates:
  • Configuring your API key
  • Adding a suffix to control responses
  • Looping through multiple prompts
  • Printing questions with answers

Key Parameters


4. Why This Approach Works

  • Self-contained inference: The model depends solely on its fine-tuned parameters—no external context injection.
  • Controlled output: A suffix forces the model to admit uncertainty, preventing hallucinations.
  • Batchable prompts: Easily loop through multiple questions without managing conversational state.
With these examples, you can seamlessly integrate your fine-tuned OpenAI model into command-line tools, Jupyter notebooks, or production services. Apply the same pattern to tasks like summarization or classification by adjusting the training dataset and prompts.

Watch Video