docs(readme): update format (#317)

This commit is contained in:
Bo-Yi Wu
2023-05-27 18:13:41 +08:00
committed by GitHub
parent a18c18d5e8
commit 980504b47e

View File

@@ -435,16 +435,15 @@ import (
) )
func main() { func main() {
config := openai.DefaultAzureConfig("your Azure OpenAI Key", "https://your Azure OpenAI Endpoint") 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 // If you use a deployment name different from the model name, you can customize the AzureModelMapperFunc function
//config.AzureModelMapperFunc = func(model string) string { // config.AzureModelMapperFunc = func(model string) string {
// azureModelMapping = map[string]string{ // azureModelMapping = map[string]string{
// "gpt-3.5-turbo":"your gpt-3.5-turbo deployment name", // "gpt-3.5-turbo": "your gpt-3.5-turbo deployment name",
// } // }
// return azureModelMapping[model] // return azureModelMapping[model]
//} // }
client := openai.NewClientWithConfig(config) client := openai.NewClientWithConfig(config)
resp, err := client.CreateChatCompletion( resp, err := client.CreateChatCompletion(
context.Background(), context.Background(),
@@ -458,7 +457,6 @@ func main() {
}, },
}, },
) )
if err != nil { if err != nil {
fmt.Printf("ChatCompletion error: %v\n", err) fmt.Printf("ChatCompletion error: %v\n", err)
return return
@@ -466,6 +464,7 @@ func main() {
fmt.Println(resp.Choices[0].Message.Content) fmt.Println(resp.Choices[0].Message.Content)
} }
``` ```
</details> </details>