Spaces:
Sleeping
Sleeping
Update contract_missing_clausses.py
Browse files- 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 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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
|