AI DevKit
Glitch9 Inc.Glitch9 DocsDiscordIssues
  • Introduction
    • AI DevKit 3.0
    • Update Logs
    • Troubleshooting
      • ❗Issues After Updating AIDevKit?
      • ❗The type or namespace name 'Newtonsoft' could not be found
      • ❗Build Error: The name 'UnityMenu' does not exist in the current context
      • ❗Model 'modelName' not found
      • ❗The model `model name` does not exist or you do not have access to it
      • ❗The type or namespace name 'AndroidJavaObject' could not be found
      • ❗The type or namaspace name 'Plastic' does not exist
      • ❗Build Error: The name 'Asset Database' does not exist in the current context
      • ❗'ModelData.Create(Provider, string, UnixTime?, string)': not all code paths return a value
      • ⚠️ Timeout Issues
      • ⚠️ Receiving a “HTTP/1.1 400 Bad Request” Error?
    • FAQ
      • My OpenAI API free trial has ended or is inactive.
  • Quick Start
    • Get API Keys
      • OpenAI API Key Guide
      • Google API Key Guide
      • ElevenLabs API Key Guide
    • Text Generation
    • C# Object Generation
    • Image Generation
    • Sound Effect Generation
    • Text to Speech (TTS)
    • Speech to Text (STT)
    • Voice Changer
    • Audio Isolation
  • Pro Features
    • Generation Menu
      • Code Generators
        • C# Script Generator
        • Unity Component Generator
    • Editor Chat
    • Editor Vision (TTI, ITI)
    • Editor Speech (TTS)
    • Management Tools
      • Prompt History Viewer
      • AI Model Manager
      • TTS Voice Manager
      • OpenAI File Manager
      • OpenAI Assistant Manager
      • ElevenLabs Voice Library
  • Assistants API (OpenAI)
    • How it works
    • Creating custom functions
    • Creating assistants API
  • Advanced API Supports
    • OpenAI API
      • 💬Chat completions
      • 🖼️Image operations
      • 🗣️Text to speech
      • 🎙️Speech to text
        • Recording real-time in Unity
      • 💾Files
      • 🔎Embeddings
      • 🛡️Moderations
      • ⚙️Fine-tuning
    • Google API
      • 📝System instructions
      • 💬Text generation
      • ⚙️Fine-tuning
      • ▶️Fucntion calling
      • 🔎Embeddings
      • 🛡️Safety
      • 💻Code execution
    • ElevenLabs API
  • Legacy Documents
    • AI DevKit 1.0 - 2.0
      • AI DevKit 2.0
      • AI DevKit 1.0
      • Preperation
      • Event Handlers
      • Scriptable Toolkits
        • Chat Streamer
        • Image Generator
        • Voice Transcriber
        • Voice Generator
      • Editor Tools
Powered by GitBook
On this page
  • Upload file
  • List files
  • Retrieve file
  • Delete file
  • Retrieve file content
  1. Advanced API Supports
  2. OpenAI API

Files

Files are used to upload documents that can be used with features like Assistants, Fine-tuning, and Batch API.

PreviousRecording real-time in UnityNextEmbeddings

Last updated 10 months ago

Upload a file that can be used across various endpoints. Individual files can be up to 512 MB, and the size of all files uploaded by one organization can be up to 100 GB.

  • Supports files up to 2 million tokens and of specific file types.

  • See the for details.

  • Only supports .jsonl file.

  • The input also has certain required formats for fine-tuning or models.

  • Only supports .jsonl file.

  • Up to 100 MB in size.

  • The input also has a specific required .

var file = new FormFile("path/to/mydata.jsonl");

var request = new FileUploadRequest.Builder()
    .SetFile(file)
    .SetPurpose(UploadPurpose.FineTune)
    .Build();

var result = await OpenAI.DefaultInstance.Files.Upload(request);

Debug.Log(result.Id);
from openai import OpenAI
client = OpenAI()

client.files.create(
  file=open("mydata.jsonl", "rb"),
  purpose="fine-tune"
)

Please if you need to increase these storage limits.


Returns a list of files that belong to the user's organization.

var fileList = await OpenAI.DefaultInstance.Files.List();

foreach (var fileData in fileList)
{
    Debug.Log(fileData.Id);
    Debug.Log(fileData.CreatedAt);
    Debug.Log(fileData.Purpose);
}
from openai import OpenAI
client = OpenAI()

client.files.list()

Returns information about a specific file.

var fileData = await OpenAI.DefaultInstance.Files.Retrieve("file-abc123");

Debug.Log(fileData.Id);
from openai import OpenAI
client = OpenAI()

client.files.retrieve("file-abc123")

Delete a file.

bool deleted = await OpenAI.DefaultInstance.Files.Delete("file-abc123");

if (deleted)
{
    Debug.Log("File deleted successfully");
}
from openai import OpenAI
client = OpenAI()

client.files.delete("file-abc123")

Returns the contents of the specified file.

var content = await OpenAI.DefaultInstance.Files.RetrieveFileContent("file-abc123");

Debug.Log(content);
from openai import OpenAI
client = OpenAI()

content = client.files.content("file-abc123")

💾
Upload file
Assistants Tools guide
chat
completions
format
contact OpenAI
List files
Retrieve file
Delete file
Retrieve file content