Forum Discussion

Lakshmi_145's avatar
Lakshmi_145
Iron Contributor
Oct 18, 2023

Gpt3 model for spelling correction is not working for every sentances

I have used GPT-3 model for correcting the spelling mistakes in questions we are providing to the bot.

Used the below code for connecting to model,

 

var requestData = new                 
{                     
prompt = $"Correct the spelling in the following text: '{question}'",                     max_tokens = 50,                     
temperature = 0.7,                     
stop = "\n"                 
};  
                
string apiKey = "open ai key";             
string endpoint = "https://api.openai.com/v1/engines/davinci/completions";  

using (HttpClient client = new HttpClient())                 {                     client.DefaultRequestHeaders.Add("Authorization", $"Bearer   {apiKey}");                     var requestData1 = new                     
{                         
	prompt = prompt,                         
	max_tokens = 50,                     
};                     
var content = new StringContent(Newtonsoft.Json.JsonConvert.SerializeObject(requestData1), Encoding.UTF8, "application/json");                     

var response = await client.PostAsync(endpoint, content);

 

GPT-3 provides the corrected text for few words. But it does not provide the corrected text for long sentences.

 

No RepliesBe the first to reply

Resources