Skip to content

Commit 57dfb55

Browse files
committed
chore: updated readme
1 parent 548b923 commit 57dfb55

File tree

1 file changed

+28
-22
lines changed

1 file changed

+28
-22
lines changed

README.md

Lines changed: 28 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,47 @@
11
## OpenAI Unity Package
2-
An unofficial OpenAI Unity Package that aims to help you use OpenAI API directly in Unity Game engine.
2+
An unofficial Unity package that allows you to use the OpenAI API directly in the Unity game engine.
33

44
## How To Use
55

66
### Importing the Package
7-
In Unity 2019+ you can go to `Window > Package Manager > + > Add package from git URL` and paste the repository URL `https://github.com/srcnalt/OpenAI-Unity.git` then click on `Add` button.
7+
To import the package, follow these steps:
8+
- Open Unity 2019 or later
9+
- Go to `Window > Package Manager`
10+
- Click the `+` button and select `Add package from git URL`
11+
- Paste the repository URL https://github.com/srcnalt/OpenAI-Unity.git and click `Add`
812

9-
### Creating OpenAI Account
10-
To be able to use OpenAI API you will need an OpenAI account. Go to https://openai.com/api and sign up for an account.
13+
### Setting Up Your OpenAI Account
14+
To use the OpenAI API, you need to have an OpenAI account. Follow these steps to create an account and generate an API key:
1115

12-
Once you created an account you can go to https://beta.openai.com/account/api-keys page and create a new secret key save it.
16+
Go to https://openai.com/api and sign up for an account
17+
Once you have created an account, go to https://beta.openai.com/account/api-keys
18+
Create a new secret key and save it
1319

1420
### Saving Your Credentials
15-
To be able to make requests to OpenAI endpoints you will need to use your API Key and optionally organization name.
21+
To make requests to the OpenAI API, you need to use your API key and organization name (if applicable). To avoid exposing your API key in your Unity project, you can save it in your device's local storage.
1622

17-
To avoid keeping your API Key in your Unity project you can save it in your device's local.
18-
For this purpose this package uses a json file in User directory of your device.
19-
To create the file to save your credentials follow the steps below.
20-
- Create a folder called `.openai` in your user's home directory `C:User\UserName\` for Windows and `~\` for Linux and Mac.
21-
- Create a file called `auth.json` in `.openai` folder.
22-
- Add `api_key` and optionally `organization` fields, fill their values to your json object and save it.
23+
To do this, follow these steps:
2324

24-
Finally you should have `C:User\UserName\.openai\auth.json` file and the file content should look as the following.
25+
Create a folder called .openai in your home directory (e.g. C:User\UserName\ for Windows or ~\ for Linux or Mac)
26+
Create a file called auth.json in the .openai folder
27+
Add an api_key field and a organization field (if applicable) to the auth.json file and save it
28+
Here is an example of what your auth.json file should look like:
2529

2630
```json
2731
{
2832
"api_key": "sk-...W6yi",
2933
"organization": "org-...L7W"
3034
}
3135
```
32-
33-
Remember that your API key is a secret! Do not share it with others or expose it in any client-side code (browsers, apps).
34-
Production requests must be routed through your own backend server where your API key can be securely loaded from an environment variable or key management service.
35-
If you are going to use OpenAI for production make sure to run it on the server side.
36+
**IMPORTANT:** Your API key is a secret.
37+
Do not share it with others or expose it in any client-side code (e.g. browsers, apps).
38+
If you are using OpenAI for production, make sure to run it on the server side, where your API key can be securely loaded from an environment variable or key management service.
3639

3740
### Making Requests to OpenAPI
38-
You can create a async method to make a call to the `OpenAI` endpoints.
39-
All methods are asynchronous and can be directly accessed from the `OpenAIApi` instance.
41+
You can use the `OpenAIApi` class to make async requests to the OpenAI API.
42+
All methods are asynchronous and can be accessed directly from an instance of the `OpenAIApi` class.
43+
44+
Here is an example of how to make a request:
4045

4146
```csharp
4247
private async void SendRequest()
@@ -51,10 +56,11 @@ private async void SendRequest()
5156
```
5257

5358
### Sample Projects
54-
With this package you can find 2 sample scenes that you can import through Package Manager.
59+
This package includes two sample scenes that you can import via the Package Manager:
60+
5561
- **ChatGPT sample:** A simple ChatGPT like chat example.
5662
- **DallE sample:** A DALL.E text to image generation example.
5763

5864
### Further Reading
59-
For further details on how to use all the request parameters please refer to OpenAI documentation.
60-
https://beta.openai.com/docs/api-reference/introduction
65+
For more information on how to use the various request parameters,
66+
please refer to the OpenAI documentation: https://beta.openai.com/docs/api-reference/introduction

0 commit comments

Comments
 (0)