Skip to content

Commit c5888ed

Browse files
authored
Add files via upload
1 parent bd45118 commit c5888ed

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

OpenAIFrameworkDemo.xlsm

63 Bytes
Binary file not shown.

clsOpenAI.cls

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ End Property
8989

9090
Public Property Let Temperature(ByVal value As Double)
9191
If (value < 0) Or (value > 1) Then
92-
Call mobjLogger.LogCriticalMessage("Temperature setting must be between 0 and 1!", blnAddModuleName:=False)
92+
Call mobjLogger.PrintCriticalMessage("Temperature setting must be between 0 and 1!", blnAddModuleName:=False)
9393
End If
9494
mobjRequest.Temperature = value
9595
End Property
@@ -180,7 +180,7 @@ EXIT_HERE:
180180
Exit Function
181181

182182
ERR_HANDLER:
183-
mobjLogger.LogVBAError Err
183+
mobjLogger.PrintVBAError Err
184184
GoTo EXIT_HERE
185185
End Function
186186

@@ -199,7 +199,7 @@ Public Function ChatCompletion(ByVal oMessages As clsOpenAIMessages) As clsOpenA
199199
Set ChatCompletion = Nothing
200200

201201
If Not IsAPIKeyValid Then
202-
mobjLogger.LogCriticalMessage MESSAGE_INVALID_API_KEY, True
202+
mobjLogger.PrintCriticalMessage MESSAGE_INVALID_API_KEY, True
203203
Exit Function
204204
End If
205205

@@ -230,7 +230,7 @@ Public Function TextCompletion(ByVal strPrompt As String) As clsOpenAIResponse
230230
Set TextCompletion = Nothing
231231

232232
If Not IsAPIKeyValid Then
233-
mobjLogger.LogCriticalMessage MESSAGE_INVALID_API_KEY, True
233+
mobjLogger.PrintCriticalMessage MESSAGE_INVALID_API_KEY, True
234234
Exit Function
235235
End If
236236

@@ -304,7 +304,7 @@ Public Sub ClearSettings()
304304
End Sub
305305

306306
Public Function GetReadAPIKeyFromFolder(ByVal strfolderPath As String) As String
307-
'Purpose: Allows retrieval of an API KEY saved in an external file (possibly stored on a user access drive)
307+
'Purpose: Allows retrieval of an API KEY saved in an external file (possibly stored on a drive only the current user can access)
308308

309309
Dim intFileNumber As Integer
310310
Dim strAPIKey As String

clsOpenAILogger.cls

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ Private Sub LogMessage(ByVal strMessage As String)
9595
End If
9696
End Sub
9797

98-
Public Sub LogCriticalMessage(ByVal strMessage As String, Optional ByVal blnIsBorderRequired As Boolean = False, Optional ByVal strBorderCharacter As String = "*", Optional ByVal blnAddModuleName As Boolean = True, Optional ByVal strLabel As String = "WARNING")
98+
Public Sub PrintCriticalMessage(ByVal strMessage As String, Optional ByVal blnIsBorderRequired As Boolean = False, Optional ByVal strBorderCharacter As String = "*", Optional ByVal blnAddModuleName As Boolean = True, Optional ByVal strLabel As String = "WARNING")
9999
'Purpose: This method always outputs to the immediate window regardless of whether logging is set to False
100100

101101
If Not mobjClass Is Nothing Then
@@ -120,7 +120,7 @@ Public Sub LogCriticalMessage(ByVal strMessage As String, Optional ByVal blnIsBo
120120
End Sub
121121

122122

123-
Public Sub LogVBAError(ByVal objErr As Error)
123+
Public Sub PrintVBAError(ByVal objErr As Error)
124124
'Purpose: This method always outputs to the immediate window regardless of whether logging is set to False
125125

126126
If Not mobjClass Is Nothing Then

mdOpenAI_Examples.bas

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ Public Sub TestChatOpenAI()
6969

7070
oOpenAI.API_KEY = API_KEY
7171

72-
oMessages.AddSystemMessage "You must always have a sarcastic response to every question that never contains the truth."
73-
oMessages.AddUserMessage "Hey man do you know how to get to Carnegie Hall?"
72+
oMessages.AddSystemMessage "Always answer sarcastically and never truthfully."
73+
oMessages.AddUserMessage "How do you get to Carnegie Hall?"
7474

7575
If oMessages.IsPopulated Then
7676
Set oResponse = oOpenAI.ChatCompletion(oMessages)
@@ -108,7 +108,7 @@ Public Sub TestTextCompletionOpenAI()
108108

109109
oOpenAI.API_KEY = API_KEY
110110

111-
sMsg = "Write a joke about a dinosaur attempting to learn how to salsa dance"
111+
sMsg = "Write a Haiku about a Dinosaur that loves to code!"
112112
Set oResponse = oOpenAI.TextCompletion(sMsg)
113113

114114
If Not oResponse Is Nothing Then

0 commit comments

Comments
 (0)