Skip to content

Commit

Permalink
docs(readme): update format (sashabaranov#317)
Browse files Browse the repository at this point in the history
  • Loading branch information
appleboy committed May 27, 2023
1 parent a18c18d commit 980504b
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -435,16 +435,15 @@ import (
)

func main() {

config := openai.DefaultAzureConfig("your Azure OpenAI Key", "https://your Azure OpenAI Endpoint")
//If you use a deployment name different from the model name, you can customize the AzureModelMapperFunc function
//config.AzureModelMapperFunc = func(model string) string {
// azureModelMapping = map[string]string{
// "gpt-3.5-turbo":"your gpt-3.5-turbo deployment name",
// }
// return azureModelMapping[model]
//}
// If you use a deployment name different from the model name, you can customize the AzureModelMapperFunc function
// config.AzureModelMapperFunc = func(model string) string {
// azureModelMapping = map[string]string{
// "gpt-3.5-turbo": "your gpt-3.5-turbo deployment name",
// }
// return azureModelMapping[model]
// }

client := openai.NewClientWithConfig(config)
resp, err := client.CreateChatCompletion(
context.Background(),
Expand All @@ -458,14 +457,14 @@ func main() {
},
},
)

if err != nil {
fmt.Printf("ChatCompletion error: %v\n", err)
return
}

fmt.Println(resp.Choices[0].Message.Content)
}

```
</details>

Expand Down

0 comments on commit 980504b

Please sign in to comment.