Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
HemulGM authored Feb 20, 2023
1 parent 8ba5fa4 commit e337638
Showing 1 changed file with 19 additions and 5 deletions.
24 changes: 19 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
![GitHub](https://img.shields.io/badge/IDE%20Version-Delphi%2010.4+-yellow)
![GitHub](https://img.shields.io/badge/platform-all%20platforms-green)

The library provides access to the API of the [OpenAI service](https://openai.com/api/), on the basis of which [ChatGPT](https://openai.com/blog/chatgpt) works and, for example, the generation of images from text using DALL-E.
Delphi 10.4+ is required to work with the library. It is possible to build under 10.3.
This library is a TOpenAI class for the main TComponent for more convenient work.
The library provides access to the API of the [OpenAI service](https://openai.com/api/), on the basis of which [ChatGPT](https://openai.com/blog/chatgpt) works and, for example, the generation of images from text using `DALL-E`.
`Delphi 10.4+` is required to work with the library. It is possible to build under `Delphi 10.3`.
This library is a `TOpenAI` class for the main TComponent for more convenient work.

*This is an unofficial library. OpenAI does not provide any official library for Delphi.*

Expand All @@ -29,10 +29,12 @@ This library is a TOpenAI class for the main TComponent for more convenient work

# ⚒️ Installation

To use the library, just add the root folder to the IDE library path, or your project source path.
To use the library, just add the `root` folder to the IDE library path, or your project source path.

# 🌳 Usage

The library needs to be configured with your account's secret key which is available on the [website](https://beta.openai.com/account/api-keys).

**Initialization**

```Pascal
Expand Down Expand Up @@ -97,11 +99,23 @@ end;
try
var Images := OpenAI.Image.Create(...);
except
on E: OpenAIExceptionRateLimitError do
ShowError('OpenAI Limit Error: ' + E.Message);
on E: OpenAIException do
ShowError('OpenAI Error: ' + E.Message);
ShowError('OpenAI Error: ' + E.Message);
end;
```

Exceptions:
* OpenAIExceptionAPI - errors of wrapper
* OpenAIException - base exception
* OpenAIExceptionInvalidRequestError
* OpenAIExceptionRateLimitError
* OpenAIExceptionAuthenticationError
* OpenAIExceptionPermissionError
* OpenAIExceptionTryAgain
* OpenAIExceptionInvalidResponse - parse error

*Usage proxy*
```Pascal
OpenAI.API.Client.ProxySettings := TProxySettings.Create(ProxyHost, ProxyPort, ProxyUserName, ProxyPassword);
Expand Down

0 comments on commit e337638

Please sign in to comment.