{"id":16683517,"url":"https://github.com/marcominerva/chatgptplayground","last_synced_at":"2025-03-21T18:32:49.074Z","repository":{"id":180715704,"uuid":"656256474","full_name":"marcominerva/ChatGptPlayground","owner":"marcominerva","description":"A ready-to-use ASP.NET Core chat application backed by a Minimal API that can be used to test ChatGPT workflows","archived":false,"fork":false,"pushed_at":"2024-12-20T09:27:49.000Z","size":7118,"stargazers_count":16,"open_issues_count":1,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-18T03:51:25.783Z","etag":null,"topics":["aspnetcore","azure-openai","azure-openai-api","c-sharp","chatgpt","hacktoberfest","minimal-api","openai","openai-api","razor-pages","visual-studio"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/marcominerva.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-06-20T15:10:59.000Z","updated_at":"2025-03-15T07:37:52.000Z","dependencies_parsed_at":"2024-03-07T14:49:37.408Z","dependency_job_id":"a96bae59-fe46-4a58-8454-ca8f5c3e0af1","html_url":"https://github.com/marcominerva/ChatGptPlayground","commit_stats":null,"previous_names":["marcominerva/chatgptplayground"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcominerva%2FChatGptPlayground","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcominerva%2FChatGptPlayground/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcominerva%2FChatGptPlayground/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcominerva%2FChatGptPlayground/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/marcominerva","download_url":"https://codeload.github.com/marcominerva/ChatGptPlayground/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244849070,"owners_count":20520637,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aspnetcore","azure-openai","azure-openai-api","c-sharp","chatgpt","hacktoberfest","minimal-api","openai","openai-api","razor-pages","visual-studio"],"created_at":"2024-10-12T14:25:03.404Z","updated_at":"2025-03-21T18:32:47.970Z","avatar_url":"https://github.com/marcominerva.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ChatGPT Playground for .NET\n\n[![Lint Code Base](https://github.com/marcominerva/ChatGptPlayground/actions/workflows/linter.yml/badge.svg)](https://github.com/marcominerva/ChatGptPlayground/actions/workflows/linter.yml)\n[![CodeQL](https://github.com/marcominerva/ChatGptPlayground/actions/workflows/codeql.yml/badge.svg)](https://github.com/marcominerva/ChatGptPlayground/actions/workflows/codeql.yml)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/marcominerva/TinyHelpers/blob/master/LICENSE)\n\n\nA ready-to-use ASP.NET Core chat application backed by a Minimal API that can be used to test ChatGPT workflows.\n\n![](https://raw.githubusercontent.com/marcominerva/ChatGptPlayground/master/assets/Playground.png)\n\n## Introduction\n\nChat Playground provided by [OpenAI](https://chat.openai.com) and [Azure OpenAI service](https://oai.azure.com/chat) are great tools to showcase ChatGPT capabilities, but they are not always suitable for testing purposes. In a real-world application, we typically need to integrate ChatGPT with our workflows, and we need to test it in a controlled environment. For example, we may want to use ChatGPT in conjuction with other services (like Azure Cognitive Search or third-party APIs). In these cases, we need a simple chat application that can be easily customized to fit our needs. **ChatGPT Playgroud for .NET** aims to address this requirement by providing a simple chat-like application already integrated with ChatGPT, with a Minimal API that can be easily customize to add custom workflows. In other words, it is a starting point for testing custom interaction with ChatGPT.\n\n## Getting Started\n\nThe Playground uses [ChatGptNet](https://github.com/marcominerva/ChatGptNet) for interacting with ChatGPT. The registration is made in [Program.cs](https://github.com/marcominerva/ChatGptPlayground/blob/master/src/ChatGptPlayground/Program.cs#L30):\n\n    builder.Services.AddChatGpt(builder.Configuration);\n    \nYou can refer to the [official documentation](https://github.com/marcominerva/ChatGptNet) available on GitHub for more details about this library and how to configure and use it.\n\nIn any case, you can safely replace this library with the one you prefer.\n\nWhen the user sends a message using the Playground, it is received by the Minimal API that, in turn, calls the [ChatService](https://github.com/marcominerva/ChatGptPlayground/blob/master/src/ChatGptPlayground.BusinessLayer/Services/ChatService.cs):\n\n    public class ChatService : IChatService\n    {\n        public async Task\u003cResult\u003cChatResponse\u003e\u003e AskAsync(ChatRequest request)\n        {\n            // ...\n        }\n\n        public IAsyncEnumerable\u003cstring\u003e AskStreamAsync(ChatRequest request)\n        {\n            // ...\n        }\n    }\n\nThe [AskAsync](https://github.com/marcominerva/ChatGptPlayground/blob/master/src/ChatGptPlayground.BusinessLayer/Services/ChatService.cs#L18-L22) method is called when the _Enable Response Streaming_ switch is disabled in the Playground, while [AskStreamAsync](https://github.com/marcominerva/ChatGptPlayground/blob/master/src/ChatGptPlayground.BusinessLayer/Services/ChatService.cs#L24-L28) is invoked when it is enabled:\n\n![](https://raw.githubusercontent.com/marcominerva/ChatGptPlayground/master/assets/ResponseStreaming.png)\n\nThe [ChatRequest](https://github.com/marcominerva/ChatGptPlayground/blob/master/src/ChatGptPlayground.Shared/Models/ChatRequest.cs) argument contains the user's message. The default implementations call the corresponding methods on [ChatGptNet](https://github.com/marcominerva/ChatGptNet). You can replace them with your own logic. In this way, you can test your custom workflows, without having to worry about implementing the chat service itself.\n\n### Contribute\n\nThe project is constantly evolving. Contributions are welcome. Feel free to file issues and pull requests on the repo and we'll address them as we can.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarcominerva%2Fchatgptplayground","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarcominerva%2Fchatgptplayground","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarcominerva%2Fchatgptplayground/lists"}