FOROS PROFESIONALES
WINDEV
,
WEBDEV
y
WINDEV Mobile
Inicio
|
Mensajes recientes
|
Conéctese...
|
Desconectar
|
Español
Inicio
→
WEBDEV 2024
→
request openIA
request openIA
Iniciado por rafael tapia, 17,abr. 2023 18:02 - No hay respuesta
Conéctese…
rafael tapia
#1
Publicado el 17,abril 2023 - 18:02
Hola Amigos, como codificarían en WEBDEV el llamado a la api de openIA ?
la especificacion dada por openIA es:
curl
https://api.openai.com/v1/chat/completions
\
-H "Content-Type: application/json" \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-d '{
"model": "gpt-3.5-turbo",
"messages": [{"role": "user", "content": "Say this is a test!"}],
"temperature": 0.7
}'
en webDev yo codifique asi: (pero no me funciona)
gcRequest is httpRequest
gcResponse is httpResponse
// Arma, envia y recibe
gcRequest..URL = "
https://api.openai.com/v1/chat/completions/
"
gcRequest..ContentType = typeMimeJSON
gcRequest..Method = httpGet
gcRequest..Content = sPide
gcRequest..Header["Authorization"] = "sk-XXXXX-XXXXX-XXXXX_XXXXX"
gcRequest..Header["OpenAI-Organization"] = "rtSoftware" // "org-ojpfP6TqLFBCF8LLZV1atBQH" //= "rtSoftware"
gcResponse = HTTPSend(gcRequest)
IF ErrorOccurred THEN
Info(" ERROR:",ErrorInfo())
ELSE
Info(" Respuesta:",gcResponse..Content)
END
me responde que no estoy enviando correctamente la APIKEY que es es la que coloco en Header["Authorization"]
"message": "You didn't provide an API key. You need to provide your API key in an Authorization header using Bearer auth (i.e. Authorization: Bearer YOUR_KEY)f or as the password field (with blank username) if you're accessing the API from your browser and are prompted for a username and password. You can obtain an API key from
https://platform.openai.com/account/api-keys
.",
"type": "invalid_request_error",
"param": null,
"code": null
>
Gracias !
Informar
0
0
→ Volver a WEBDEV 2024
WINDEV 2024
WEBDEV 2024
Français
English
Español
Portuguesa
Fermer cette fenêtre
Búsqueda Tipo
Sólo temas
Todos los mensajes
Periodo Buscar
Cualquier fecha
Última hora
Última 24 horas
Última semana
Último mes
Último año
Cancelar
Vista previa del mensaje
Añadiendo una imagen
Importar una imagen desde una URL
Enviar una imagen desde un archivo de su disco
Arrastrar un archivo o click en "Examinar..."
o
Cancelar
0%
WLanguage
SQL
XML, HTML
JAVA, Javascript
Texto