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
Public Function GPT(ByVal strPrompt) As String
'Purpose: This function is an example of how to create a UDF using the OpenAI API
' so that it can be called directly on a worksheet in Excel
Dim oOpenAI As clsOpenAI
Dim oMessages As New clsOpenAIMessages
Dim oResponse As clsOpenAIResponse
GPT = Empty
Set oOpenAI = New clsOpenAI
oOpenAI.API_KEY = API_KEY
oMessages.AddUserMessage strPrompt
Set oResponse = oOpenAI.ChatCompletion(oMessages)
If Not oResponse Is Nothing Then
GPT = oResponse.MessageContent
End If
Set oResponse = Nothing
Set oOpenAI = Nothing
Set oMessages = Nothing
End Function
Cell prompt
=GPT("As a marketing expert, your job is to figure out who would probably be most interested in a specific product or service, based on a short description. Please give a brief answer that includes the most likely characteristics of the customers. This should i"&"nclude things like their age, gender, how much money they make, what they're interested in, their habits, and what's important to them. This should all be related to the product and how it's meant to be used. Format your response exactly like this:
Targ"&"et Audience for [Instert Product or Service]
Target Audience Description:
Personality Attributes:
Age:
Income:
Interests:
Values:
This is the PRODUCT or SERVICE:"&A2)
Simpler prompts work:
=GPT("Say "&B8)
Cell B8 is "OK" and the response is "OK" so it works
or
=GPT("Say OK")
Any idea what causes the issue in longer prompts?
The text was updated successfully, but these errors were encountered:
Token size is 3072, so that should not be issue. I managed to somehow get the cell to work, I think by removing \n (new lines), but the output was very broken. It contained \n everywhere.
Function
Cell prompt
=GPT("As a marketing expert, your job is to figure out who would probably be most interested in a specific product or service, based on a short description. Please give a brief answer that includes the most likely characteristics of the customers. This should i"&"nclude things like their age, gender, how much money they make, what they're interested in, their habits, and what's important to them. This should all be related to the product and how it's meant to be used. Format your response exactly like this:
Targ"&"et Audience for [Instert Product or Service]
Target Audience Description:
Personality Attributes:
Age:
Income:
Interests:
Values:
This is the PRODUCT or SERVICE:"&A2)
Simpler prompts work:
=GPT("Say "&B8)
Cell B8 is "OK" and the response is "OK" so it works
or
=GPT("Say OK")
Any idea what causes the issue in longer prompts?
The text was updated successfully, but these errors were encountered: