{"id":13342171,"url":"https://github.com/RobsonPontin/openai-winrt","last_synced_at":"2025-03-12T00:31:01.430Z","repository":{"id":65828103,"uuid":"588422395","full_name":"RobsonPontin/openai-winrt","owner":"RobsonPontin","description":"An unofficial OpenAI SDK for WinRT applications","archived":false,"fork":false,"pushed_at":"2023-09-03T15:33:53.000Z","size":2017,"stargazers_count":7,"open_issues_count":0,"forks_count":0,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-02-06T00:11:27.126Z","etag":null,"topics":["chat","chatgpt","dall-e","dalle2","desktop","gpt3","openai","uwp","windows","winrt","winui","winui3"],"latest_commit_sha":null,"homepage":"","language":"C++","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/RobsonPontin.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-01-13T04:28:27.000Z","updated_at":"2024-04-16T14:04:06.000Z","dependencies_parsed_at":"2024-10-24T03:53:33.826Z","dependency_job_id":"93ad5749-0da3-423f-b0fb-80a0ff7cf350","html_url":"https://github.com/RobsonPontin/openai-winrt","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RobsonPontin%2Fopenai-winrt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RobsonPontin%2Fopenai-winrt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RobsonPontin%2Fopenai-winrt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RobsonPontin%2Fopenai-winrt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RobsonPontin","download_url":"https://codeload.github.com/RobsonPontin/openai-winrt/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243136265,"owners_count":20241987,"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":["chat","chatgpt","dall-e","dalle2","desktop","gpt3","openai","uwp","windows","winrt","winui","winui3"],"created_at":"2024-07-29T19:28:08.284Z","updated_at":"2025-03-12T00:31:01.424Z","avatar_url":"https://github.com/RobsonPontin.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# WinRT SDK for OpenAI DALL·E and GPT\n\nA community-maintained (unofficial) OpenAI WinRT SDK that can be used with [UWP (Universal Windows Platform)](https://learn.microsoft.com/en-us/windows/uwp/get-started/universal-application-platform-guide) and/or [WinUI 3 (Desktop)](https://learn.microsoft.com/en-us/windows/apps/winui/winui3/) apps for both C++ and C# languages.\n\nFor more information visit https://openai.com/.\n\n## OpenAI Service\n\nIt is necessary to initialize the service with an API Key, which can be obtained at https://openai.com/.\n\nThe example below show how to get the OpenAI Key by passing your environment variable which contains it.\n\n```cs\nvar options = new OpenAI.OpenAiOptions();\noptions.SetOpenAiKeyFromEnvironmentVar(\"MY_OPEN_AI_API_KEY\");\n\nm_openAiService = new OpenAI.OpenAiService(options);\n```\n\n## GPT3 APIs\n\n### Chat\n\nUsing chat you can go back and forth with the AI models about almost any subject\n\n```cs\nvar chatRequest = new OpenAI.Chat.ChatRequest();\nvar chatMessage = new OpenAI.Chat.ChatMessage(\"user\", \"What is the most used math formula in the world?\");\nchatRequest.Messages.Add(chatMessage);\n\nvar response = await m_openAiService.RunRequestAsync(chatRequest);\n```\n\n### Text Completion\n\nWith text completion you can send some text as a prompt, and the model will generate a text completion that attempts to match whatever context or pattern you gave it.\n\n```cpp\nwinrt::hstring prompt = L\"tell me a very nice joke\";\n\nauto completionReq = OpenAI::Completion::CompletionRequest{};\ncompletionReq.Prompt(prompt);\ncompletionReq.Model(ModelType::text_davinci_003);\n\nauto response = co_await m_openAiService.RunRequestAsync(completionReq);\n```\n\n## DALL·E\n\n### Image Generation\n\nGenerate images from a command prompt.\n\n```cpp\nwinrt::hstring prompt = L\"a robot duck walking on the beach\";\n\nauto imageReq = OpenAI::Image::ImageCreateRequest{};\nimageReq.ImageName(L\"ai image\");\nimageReq.Prompt(prompt);\n\nauto response = co_await m_openAiService.RunRequestAsync(imageReq);\n```\n\n### Image Variation\n\nCreate image variations from a source image file.\n\n```cpp\nWindows::Storage::StorageFile file = GetFileFromPicker();\n\nauto imageReq = OpenAI::Image::ImageVariationRequest{};\nimageReq.ImageName(file.Name());\nco_await imageReq.SetImageAsync(file);\n\nauto response = co_await m_openAiService.RunRequestAsync(imageReq);\n```\n\n### Image Editing\n\nCreate a new image from a source image file considering the prompt editing commands. \n\n```cpp\nWindows::Storage::StorageFile file = GetFileFromPicker();\nWindowS::Storage::StorageFile mask = GetFileFromPicker();\n\nwinrt::hstring prompt = L\"add a small tiger with shoes\";\n\nauto imageReq = OpenAI::Image::ImageEditRequest{};\nimageReq.ImageName(file.Name());\nimageReq.Prompt(prompt);\nco_await imageReq.SetImageAsync(file);\nco_await imageReq.SetMaskAsync(mask); // Mask needed to declare which are of the image the editing should be applied\n\nauto response = co_await m_openAiService.RunRequestAsync(imageReq);\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FRobsonPontin%2Fopenai-winrt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FRobsonPontin%2Fopenai-winrt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FRobsonPontin%2Fopenai-winrt/lists"}