KarthickAdopleAI commited on
Commit
b895d40
·
verified ·
1 Parent(s): 1000f0b

Update aggressive_content_finder.py

Browse files
Files changed (1) hide show
  1. aggressive_content_finder.py +11 -10
aggressive_content_finder.py CHANGED
@@ -30,6 +30,11 @@ class AggressiveContentFinder:
30
  str: Identified aggressive terms.
31
  """
32
  try:
 
 
 
 
 
33
  conversation = [
34
  {"role": "system", "content": "You are a helpful Aggressive Terms Finder in Given Contract."},
35
  {"role": "user", "content": f"""This is a contract document content. Your task is to identify aggressive terms like warning terms, penalties in the given contract:
@@ -37,16 +42,12 @@ class AggressiveContentFinder:
37
  ]
38
 
39
  # Call OpenAI GPT-3.5-turbo
40
- chat_completion = openai.ChatCompletion.create(
41
- engine="ChatGPT",
42
- messages = conversation,
43
- temperature=0.7,
44
- max_tokens=800,
45
- top_p=0.95,
46
- frequency_penalty=0,
47
- presence_penalty=0,
48
- stop=None
49
- )
50
  response = chat_completion.choices[0].message.content
51
  return response
52
 
 
30
  str: Identified aggressive terms.
31
  """
32
  try:
33
+ client = AzureOpenAI(api_key=os.getenv("AZURE_OPENAI_KEY"),
34
+ api_version="2023-07-01-preview",
35
+ azure_endpoint = os.getenv("AZURE_OPENAI_ENDPOINT")
36
+ )
37
+
38
  conversation = [
39
  {"role": "system", "content": "You are a helpful Aggressive Terms Finder in Given Contract."},
40
  {"role": "user", "content": f"""This is a contract document content. Your task is to identify aggressive terms like warning terms, penalties in the given contract:
 
42
  ]
43
 
44
  # Call OpenAI GPT-3.5-turbo
45
+ chat_completion = client.chat.completions.create(
46
+ model = "ChatGPT",
47
+ messages = conversation,
48
+ max_tokens=1000,
49
+ temperature=0
50
+ )
 
 
 
 
51
  response = chat_completion.choices[0].message.content
52
  return response
53