Skip to content
This repository has been archived by the owner on Jan 31, 2024. It is now read-only.

Commit

Permalink
Create README.md
Browse files Browse the repository at this point in the history
Signed-off-by: Marcel Kwiatkowski <[email protected]>
  • Loading branch information
marcel2215 authored Aug 30, 2023
1 parent cd91a74 commit 5f1a414
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# FunctionalGPT
Lightweight C#/.NET OpenAI API wrapper with support of GPT function calling via reflection.
> [!NOTE]
> Function calling is not yet supported *(coming soon)*.
## Usage
### Simple Prompt
``` cs
using FunctionalGPT;

var chatGPT = new ChatGPT("<OPENAI API KEY>", "gpt-3.5-turbo");
var response = chatGPT.CompleteAsync("Write an article about bitcoin.");

Console.WriteLine(response);
```

### Conversation
```cs
using FunctionalGPT;

var chatGPT = new ChatGPT("<OPENAI API KEY>", "gpt-3.5-turbo");
var conversation = new Conversation("You are a helpful assistant [...]");

while (true)
{
var userMessage = Console.ReadLine()!;
conversation.FromUser(userMessage);

var assistantResponse = await chatGPT.CompleteAsync(conversation);
Console.WriteLine(assistantResponse);
}
```
> [!IMPORTANT]
> Assistant replies are automatically added to the conversation.
### Conversation with Multiple Users
```cs
using FunctionalGPT;

var chatGPT = new ChatGPT("<OPENAI API KEY>", "gpt-3.5-turbo");
var conversation = new Conversation("Decide who is right and explain why.");

conversation.FromUser("Alice", "I think the egg came first.");
conversation.FromUser("Bob", "Nah, it must have been chicken.");

var response = await chatGPT.CompleteAsync(conversation);
Console.WriteLine(response);
```

0 comments on commit 5f1a414

Please sign in to comment.