From 5f1a4142ccf4f78ec676409125057db4b9c6cb25 Mon Sep 17 00:00:00 2001 From: Marcel Kwiatkowski Date: Wed, 30 Aug 2023 23:47:36 +0200 Subject: [PATCH] Create README.md Signed-off-by: Marcel Kwiatkowski --- README.md | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..03ef249 --- /dev/null +++ b/README.md @@ -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("", "gpt-3.5-turbo"); +var response = chatGPT.CompleteAsync("Write an article about bitcoin."); + +Console.WriteLine(response); +``` + +### Conversation +```cs +using FunctionalGPT; + +var chatGPT = new ChatGPT("", "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("", "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); +```