KarthickAdopleAI commited on
Commit
d20faaa
1 Parent(s): cd254ee

Update incorrect_sentence_finder.py

Browse files
Files changed (1) hide show
  1. incorrect_sentence_finder.py +11 -10
incorrect_sentence_finder.py CHANGED
@@ -32,6 +32,11 @@ class IncorrectSentenceFinder:
32
  str: Grammatically incorrect sentences identified by GPT-3.
33
  """
34
  # Create a request to OpenAI's GPT-3 engine to identify grammatically incorrect sentences.
 
 
 
 
 
35
  conversation = [
36
  {"role": "system", "content": "You are a helpful Error sentence finder."},
37
  {"role": "user", "content": f"""list out the grammatical error sentence in the given text:\n{text}
@@ -41,16 +46,12 @@ class IncorrectSentenceFinder:
41
  ]
42
 
43
  # Call OpenAI GPT-3.5-turbo
44
- chat_completion =openai.ChatCompletion.create(
45
- engine="ChatGPT",
46
- messages = conversation,
47
- temperature=0.7,
48
- max_tokens=800,
49
- top_p=0.95,
50
- frequency_penalty=0,
51
- presence_penalty=0,
52
- stop=None
53
- )
54
  response = chat_completion.choices[0].message.content
55
  return response
56
 
 
32
  str: Grammatically incorrect sentences identified by GPT-3.
33
  """
34
  # Create a request to OpenAI's GPT-3 engine to identify grammatically incorrect sentences.
35
+ client = AzureOpenAI(api_key=os.getenv("AZURE_OPENAI_KEY"),
36
+ api_version="2023-07-01-preview",
37
+ azure_endpoint = os.getenv("AZURE_OPENAI_ENDPOINT")
38
+ )
39
+
40
  conversation = [
41
  {"role": "system", "content": "You are a helpful Error sentence finder."},
42
  {"role": "user", "content": f"""list out the grammatical error sentence in the given text:\n{text}
 
46
  ]
47
 
48
  # Call OpenAI GPT-3.5-turbo
49
+ chat_completion = client.chat.completions.create(
50
+ model = "ChatGPT",
51
+ messages = conversation,
52
+ max_tokens=1000,
53
+ temperature=0
54
+ )
 
 
 
 
55
  response = chat_completion.choices[0].message.content
56
  return response
57