|
2 | 2 |
|
3 | 3 | [](https://github.com/zq99/openai-vba-framework/blob/main/LICENSE)
|
4 | 4 |
|
5 |
| -OpenAI-VBA-Framework is a toolkit for developers looking to create applications in VBA that interact with OpenAI's large language models such as GPT-4 and ChatGPT. This framework provides a suite of classes to facilitate smooth integration with OpenAI's API. |
| 5 | +OpenAI-VBA-Framework is a toolkit for developers looking to create applications in VBA that interact with OpenAI's large language models such as GPT-4, ChatGPT and DALL-E. This framework provides a suite of classes to facilitate smooth integration with OpenAI's API. |
6 | 6 |
|
7 | 7 | ## Main Classes
|
8 | 8 | 1. `clsOpenAI` - Main class to interact with OpenAI
|
@@ -117,11 +117,35 @@ Public Function GETTEXTFROMOPENAI(ByVal strPrompt As String, ByVal strAPIKey As
|
117 | 117 | End Function
|
118 | 118 | ```
|
119 | 119 |
|
| 120 | +### DALL-E Image Creation |
| 121 | + |
| 122 | +``` |
| 123 | +Public Sub TestDalleOpenAI() |
| 124 | +
|
| 125 | + Dim oOpenAI As clsOpenAI |
| 126 | + Dim oResponse As clsOpenAIResponse |
| 127 | + |
| 128 | + Set oOpenAI = New clsOpenAI |
| 129 | + |
| 130 | + oOpenAI.API_KEY = API_KEY |
| 131 | + |
| 132 | + Set oResponse = oOpenAI.CreateImageFromText("A cat playing a banjo on a surfboard", 512, 512) |
| 133 | + |
| 134 | + If Not oResponse Is Nothing Then |
| 135 | + Debug.Print ("The picture has been saved to: " & oResponse.SavedLocalFile) |
| 136 | + End If |
| 137 | + |
| 138 | + Set oResponse = Nothing |
| 139 | + Set oOpenAI = Nothing |
| 140 | +
|
| 141 | +End Sub |
| 142 | +``` |
| 143 | + |
120 | 144 | ## Configuration
|
121 | 145 |
|
122 | 146 | You can customize the OpenAI-VBA-Framework by adjusting properties in the `clsOpenAI` class:
|
123 | 147 |
|
124 |
| -```vba |
| 148 | +``` |
125 | 149 | ' Specify the model
|
126 | 150 | oOpenAI.Model = "gpt-3.5-turbo"
|
127 | 151 |
|
@@ -151,6 +175,15 @@ Dim apiKey As String
|
151 | 175 | apiKey = oOpenAI.GetReadAPIKeyFromFolder("<FolderPath>")
|
152 | 176 | ```
|
153 | 177 |
|
| 178 | +## Troubleshooting |
| 179 | + |
| 180 | +You can check the status of the OpenAI API [here](https://status.openai.com/). |
| 181 | + |
| 182 | +For coding issues, use the following line, to go through the code. |
| 183 | +``` |
| 184 | +oOpenAI.IsLogOutputRequired True |
| 185 | +``` |
| 186 | + |
154 | 187 | ## Contributing
|
155 | 188 | Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
|
156 | 189 |
|
|
0 commit comments