/gptapi4data

code for generate data via GPT API

Primary LanguagePython

GPT API Example

This is code for generate instruction data via GPT-API following LLaVA style.

How to use

Run following command to run GPT API and for coco samples. In-context examples are from LLaVA dataset.

python llava-instruction.py

Access GPT

Normally, only api key needed.

import openai
openai.api_key = "sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"

Change version of ChatGPT you want to use.

response = openai.ChatCompletion.create(
    model="gpt-3.5-turbo", # or "gpt-4"
    messages=message_copy
)

Sometimes, organization ID may also be required.

openai.organization = "org-xxxxxxx"