naveenvenkatesh commited on
Commit
7f2d761
·
verified ·
1 Parent(s): f8d40ff

Update contract_missing_clausses.py

Browse files
Files changed (1) hide show
  1. contract_missing_clausses.py +16 -11
contract_missing_clausses.py CHANGED
@@ -48,17 +48,22 @@ class ContractMissingClauses:
48
  contract (str): The text of the contract.
49
  """
50
  try:
51
- LOGGER.info("Analyzing contract and extracting missing clauses...")
52
- # Generate text using the OpenAI GPT-3 model
53
- response = openai.Completion.create(
54
- engine="text-davinci-003", # You can specify different engines
55
- prompt="identify missing clauses,sub-clauses and terms from given contrct ***{contract}*** return only missing (clauses,sub-clauses and terms) seperately.",
56
- temperature=0,
57
- max_tokens=500, # The maximum number of tokens (words) in the generated text
58
- )
59
-
60
- # Print the generated text
61
- return response.choices[0].text
 
 
 
 
 
62
 
63
  except Exception as e:
64
  # If an error occurs during the key-value extraction process, log the error
 
48
  contract (str): The text of the contract.
49
  """
50
  try:
51
+ LOGGER.info("Analyzing contract and extracting missing clauses...")
52
+ # Generate text using the OpenAI GPT-3 model
53
+ conversation = [
54
+ {"role": "system", "content": "You are a helpful missing clauses,sub-clauses and terms Finder in Given Contract."},
55
+ {"role": "user", "content": f"""identify missing clauses,sub-clauses and terms from given contrct ***{contract}*** return only missing (clauses,sub-clauses and terms) seperately."""}
56
+ ]
57
+
58
+ # Call OpenAI GPT-3.5-turbo
59
+ chat_completion = self.client.chat.completions.create(
60
+ model = "gpt-3.5-turbo",
61
+ messages = conversation,
62
+ max_tokens=500,
63
+ temperature=0
64
+ )
65
+ response = chat_completion.choices[0].message.content
66
+ return response
67
 
68
  except Exception as e:
69
  # If an error occurs during the key-value extraction process, log the error