You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Not too many breaking changes from the Stainless/openai-go side: mostly things just shuffled around a bit with function types, and specifying tools.
Part of the work for #25558
| Azure Extensions | Built-in | Use `azopenai` as a companion |
29
+
| API Structure | Flat methods | Subclients per service category |
30
+
| Authentication | Azure-specific | Use `azure.With...` options |
30
31
31
32
> [!IMPORTANT]
32
33
> The Assistants API is no longer available in the `openai-go` package. If you require Assistants functionality, please refer to the [OpenAI API documentation](https://platform.openai.com/docs/api-reference/assistants) for alternative approaches or use the HTTP API directly.
@@ -39,31 +40,32 @@ Your projects must now include the official OpenAI Go client:
39
40
40
41
```go
41
42
import (
42
-
"github.com/openai/openai-go"
43
+
"github.com/openai/openai-go/v3"
43
44
)
44
45
```
45
46
46
47
If you need Azure-specific extensions (for instance, Azure OpenAI On Your Data or content filtering), also include the `azopenai` package:
> **Azure extensions** refer to features unique to the Azure OpenAI Service (e.g., Azure OpenAI On Your Data, or content filtering). Authentication for Azure resources is available in the `openai-go` package, and does not require this package.
56
+
> [!NOTE] > **Azure extensions** refer to features unique to the Azure OpenAI Service (e.g., Azure OpenAI On Your Data, or content filtering). Authentication for Azure resources is available in the `openai-go` package, and does not require this package.
57
57
58
58
## Authentication and Client Creation
59
59
60
60
Instead of using the Azure OpenAI client directly for all operations, you'll now:
61
+
61
62
- Create an OpenAI client configured for the Azure OpenAI Service.
62
63
- Use the Azure OpenAI companion library for Azure-specific extensions.
63
64
64
65
### Azure OpenAI with API Key
65
66
66
67
**Before:**
68
+
67
69
```go
68
70
endpoint:= os.Getenv("AZURE_OPENAI_ENDPOINT")
69
71
key:= os.Getenv("AZURE_OPENAI_API_KEY")
@@ -74,6 +76,7 @@ if err != nil {
74
76
```
75
77
76
78
**After:**
79
+
77
80
```go
78
81
endpoint:= os.Getenv("AZURE_OPENAI_ENDPOINT")
79
82
// Information on Azure OpenAI API versions can be found here: https://aka.ms/oai/docs/api-lifecycle
@@ -89,6 +92,7 @@ client := openai.NewClient(
89
92
### Azure OpenAI with Token Credentials
90
93
91
94
**Before:**
95
+
92
96
```go
93
97
endpoint:= os.Getenv("AZURE_OPENAI_ENDPOINT")
94
98
@@ -103,6 +107,7 @@ if err != nil {
103
107
```
104
108
105
109
**After:**
110
+
106
111
```go
107
112
endpoint:= os.Getenv("AZURE_OPENAI_ENDPOINT")
108
113
// Information on Azure OpenAI API versions can be found here: https://aka.ms/oai/docs/api-lifecycle
@@ -121,6 +126,7 @@ client := openai.NewClient(
121
126
### OpenAI v1 (not using Azure OpenAI Service)
122
127
123
128
**Before:**
129
+
124
130
```go
125
131
key:= os.Getenv("OPENAI_API_KEY")
126
132
@@ -131,6 +137,7 @@ if err != nil {
131
137
```
132
138
133
139
**After:**
140
+
134
141
```go
135
142
key:= os.Getenv("OPENAI_API_KEY")
136
143
client:= openai.NewClient(
@@ -142,26 +149,25 @@ client := openai.NewClient(
142
149
143
150
The official OpenAI Go client organizes operations into subclients for each service category, rather than providing all operations on a single client.
Refer to the [official OpenAI Go client documentation](https://github.com/openai/openai-go) for details.
162
169
163
-
> [!NOTE]
164
-
> **Assistants API:** As of v1.0.0, the Assistants API is not supported in the `openai-go` package. There is currently no official Go SDK support for Assistants. You may need to use direct HTTP requests for this functionality.
170
+
> [!NOTE] > **Assistants API:** As of v1.0.0, the Assistants API is not supported in the `openai-go` package. There is currently no official Go SDK support for Assistants. You may need to use direct HTTP requests for this functionality.
165
171
166
172
For Azure-specific extensions, see the reference documentation and examples in this companion library.
167
173
@@ -170,6 +176,7 @@ For Azure-specific extensions, see the reference documentation and examples in t
Copy file name to clipboardExpand all lines: sdk/ai/azopenai/README.md
+6-5Lines changed: 6 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,16 +1,16 @@
1
1
# Azure OpenAI extensions module for Go
2
2
3
-
This module provides models and convenience functions to make it simpler to use Azure OpenAI features, such as [Azure OpenAI On Your Data][openai_on_your_data], with the OpenAI Go client (https://pkg.go.dev/github.com/openai/openai-go).
3
+
This module provides models and convenience functions to make it simpler to use Azure OpenAI features, such as [Azure OpenAI On Your Data][openai_on_your_data], with the OpenAI Go client (https://pkg.go.dev/github.com/openai/openai-go/v3).
* Go, version 1.23 or higher - [Install Go](https://go.dev/doc/install)
12
-
*[Azure subscription][azure_sub]
13
-
*[Azure OpenAI access][azure_openai_access]
11
+
- Go, version 1.23 or higher - [Install Go](https://go.dev/doc/install)
12
+
-[Azure subscription][azure_sub]
13
+
-[Azure OpenAI access][azure_openai_access]
14
14
15
15
### Install the packages
16
16
@@ -31,7 +31,7 @@ See [Key concepts][openai_key_concepts] in the product documentation for more de
31
31
32
32
# Examples
33
33
34
-
Examples for scenarios specific to Azure can be found on [pkg.go.dev](https://aka.ms/azsdk/go/azopenaiextensions/pkg#pkg-examples) or in the example*_test.go files in our GitHub repo for [azopenai](https://github.com/Azure/azure-sdk-for-go/blob/main/sdk/ai/azopenai).
34
+
Examples for scenarios specific to Azure can be found on [pkg.go.dev](https://aka.ms/azsdk/go/azopenaiextensions/pkg#pkg-examples) or in the example\*\_test.go files in our GitHub repo for [azopenai](https://github.com/Azure/azure-sdk-for-go/blob/main/sdk/ai/azopenai).
35
35
36
36
For examples on using the openai-go client, see the examples in the [openai-go](https://github.com/openai/openai-go/tree/main/examples) repository.
37
37
@@ -48,6 +48,7 @@ the [Code of Conduct FAQ][coc_faq] or contact [[email protected]][coc_conta
0 commit comments