Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
HemulGM committed Mar 3, 2023
2 parents cdf6cd2 + 200eaf5 commit 226700f
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
![GitHub](https://img.shields.io/github/license/hemulgm/DelphiOpenAI)
![GitHub](https://img.shields.io/github/last-commit/hemulgm/DelphiOpenAI)
![GitHub](https://img.shields.io/badge/coverage-100%25-green)
![GitHub](https://img.shields.io/badge/IDE%20Version-Delphi%2010.4+-yellow)
![GitHub](https://img.shields.io/badge/IDE%20Version-Delphi%2010.3+-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 `Delphi 10.3`.
`Delphi 10.3+` is required to work with the library.
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 Down Expand Up @@ -66,7 +66,23 @@ finally
end;
```

**Completions (for chat)**
**Chat**
```Pascal
var Chat := OpenAI.Chat.Create(
procedure(Params: TChatParams)
begin
Params.Messages([TChatMessageBuild.Create(TMessageRole.User, Text)]);
Params.MaxTokens(1024);
end);
try
for var Choice in Chat.Choices do
MemoChat.Lines.Add(Choice.Message.Content);
finally
Chat.Free;
end;
```

**Completions**
```Pascal
var Completions := OpenAI.Completion.Create(
procedure(Params: TCompletionParams)
Expand Down

0 comments on commit 226700f

Please sign in to comment.