sAPIKEY est une chaîne = "votreclé"
sSAI_REPONSE est une chaîne
APIURL est une chaîne = "https://api.mistral.ai/v1/chat/completions"
reqGPT est un httpRequête
reqGPT.URL = APIURL
reqGPT.ContentType = "application/json"
reqGPT.Entête["Authorization"] = "Bearer " + sAPIKEY
sParam est une chaîne
sParam2 est un JSON
sParam=[
{
"model": "mistral-large-latest",
"messages": [{"role": "user", "content": "%1%"}]
}
]
sParam2=ChaîneConstruit(sParam,SAI_PROMPT)
reqGPT.Contenu = sParam2
reqGPT.Méthode = httpPost
RepGPT est un httpRéponse = HTTPEnvoie(reqGPT)
SI ErreurDétectée ALORS
Erreur(ErreurInfo(errComplet))
SINON
Reponse est un JSON = RepGPT.Contenu
SAI_REP=Reponse.choices[1].message.content
FIN
Partager