From 3db25b0740cfe229fdaf05f82e2daba549663915 Mon Sep 17 00:00:00 2001 From: Mike Kistler Date: Wed, 19 Apr 2023 08:36:10 -0500 Subject: [PATCH] Add LICENSE.txt, README.md, CHANGELOG.md. --- sdk/cognitiveservices/azopenai/CHANGELOG.md | 5 + sdk/cognitiveservices/azopenai/LICENSE.txt | 21 ++++ sdk/cognitiveservices/azopenai/README.md | 101 ++++++++++++++++++++ 3 files changed, 127 insertions(+) create mode 100644 sdk/cognitiveservices/azopenai/CHANGELOG.md create mode 100644 sdk/cognitiveservices/azopenai/LICENSE.txt create mode 100644 sdk/cognitiveservices/azopenai/README.md diff --git a/sdk/cognitiveservices/azopenai/CHANGELOG.md b/sdk/cognitiveservices/azopenai/CHANGELOG.md new file mode 100644 index 000000000000..077c60d77c60 --- /dev/null +++ b/sdk/cognitiveservices/azopenai/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 0.1.0 (unreleased) + +* This is the initial release of the `azopenai` library diff --git a/sdk/cognitiveservices/azopenai/LICENSE.txt b/sdk/cognitiveservices/azopenai/LICENSE.txt new file mode 100644 index 000000000000..ec703274aadd --- /dev/null +++ b/sdk/cognitiveservices/azopenai/LICENSE.txt @@ -0,0 +1,21 @@ + MIT License + +Copyright (c) Microsoft Corporation. All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE \ No newline at end of file diff --git a/sdk/cognitiveservices/azopenai/README.md b/sdk/cognitiveservices/azopenai/README.md new file mode 100644 index 000000000000..2a1721791fb2 --- /dev/null +++ b/sdk/cognitiveservices/azopenai/README.md @@ -0,0 +1,101 @@ +# Azure OpenAI client module for Go + +The Azure OpenAI client module is used to ... + +[Source code][azopenai_repo] | [Package (pkg.go.dev)][azopenai_pkg_go] | [REST API documentation][openai_rest_docs] | [Product documentation][openai_docs] + +## Getting started + +### Prerequisites + +* Go, version 1.18 or higher - [Install Go](https://go.dev/doc/install) +* Azure subscription - [Create a free account][azure_sub] + +### Install the packages + +Install the `azopenai` and `azidentity` modules with `go get`: + +```bash +go get github.com/Azure/azure-sdk-for-go/sdk/cognitiveservices/azopenai +go get github.com/Azure/azure-sdk-for-go/sdk/azidentity +``` + +The [azidentity][azure_identity] module is used for authentication during client construction. + +### Authentication + + + +#### Create a client + +Constructing the client requires your vault's URL, which you can get from the Azure CLI or the Azure Portal. + +```go +import ( + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/cognitiveservices/azopenai" +) + +func main() { + endpoint := "https://" + apiKey := "" + + var err error + cred := azopenai.KeyCredential{APIKey: apiKey} + client, err := azopenai.NewClientWithKeyCredential(endpoint, cred, &options) + if err != nil { + // TODO: handle error + } +} +``` + +## Key concepts + +See [Key concepts][openai_key_concepts] in the product documentation for more details about general concepts. + +## Troubleshooting + +### Error Handling + +All methods that send HTTP requests return `*azcore.ResponseError` when these requests fail. `ResponseError` has error details and the raw response from the service. + +### Logging + +This module uses the logging implementation in `azcore`. To turn on logging for all Azure SDK modules, set `AZURE_SDK_GO_LOGGING` to `all`. By default, the logger writes to stderr. Use the `azcore/log` package to control log output. For example, logging only HTTP request and response events, and printing them to stdout: + +```go +import azlog "github.com/Azure/azure-sdk-for-go/sdk/azcore/log" + +// Print log events to stdout +azlog.SetListener(func(cls azlog.Event, msg string) { + fmt.Println(msg) +}) + +// Includes only requests and responses in credential logs +azlog.SetEvents(azlog.EventRequest, azlog.EventResponse) +``` + +## Contributing + +This project welcomes contributions and suggestions. Most contributions require you to agree to a [Contributor License Agreement (CLA)][cla] declaring that you have the right to, and actually do, grant us the rights to use your contribution. + +When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate +the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to +do this once across all repos using our CLA. + +This project has adopted the [Microsoft Open Source Code of Conduct][coc]. For more information, see +the [Code of Conduct FAQ][coc_faq] or contact [opencode@microsoft.com][coc_contact] with any additional questions or +comments. + + +[azopenai_repo]: https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/cognitiveservices/azopenai +[azopenai_pkg_go]: https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/cognitiveservices/azopenai +[azure_identity]: https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity +[azure_sub]: https://azure.microsoft.com/free/ +[openai_docs]: https://learn.microsoft.com/azure/cognitive-services/openai +[openai_key_concepts]: https://learn.microsoft.com/en-us/azure/cognitive-services/openai/overview#key-concepts +[openai_rest_docs]: https://learn.microsoft.com/azure/cognitive-services/openai/reference +[cla]: https://cla.microsoft.com +[coc]: https://opensource.microsoft.com/codeofconduct/ +[coc_faq]: https://opensource.microsoft.com/codeofconduct/faq/ +[coc_contact]: mailto:opencode@microsoft.com \ No newline at end of file