Spaces:
Running
Running
naveenvenkatesh
commited on
Commit
•
66f3b9d
1
Parent(s):
1ff524b
Update contract_missing_clausses.py
Browse files- contract_missing_clausses.py +16 -9
contract_missing_clausses.py
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
|
2 |
from PyPDF2 import PdfReader
|
3 |
import logging
|
4 |
|
@@ -38,8 +38,11 @@ class ContractMissingClauses:
|
|
38 |
Initialize the ContractMissingClauses class and set up the OpenAI API client.
|
39 |
"""
|
40 |
|
41 |
-
|
42 |
-
|
|
|
|
|
|
|
43 |
def get_missing_clauses(self, contract: str):
|
44 |
|
45 |
"""
|
@@ -57,12 +60,16 @@ class ContractMissingClauses:
|
|
57 |
]
|
58 |
|
59 |
# Call OpenAI GPT-3.5-turbo
|
60 |
-
chat_completion =
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
|
|
|
|
|
|
|
|
66 |
response = chat_completion.choices[0].message.content
|
67 |
return response
|
68 |
|
|
|
1 |
+
import openai
|
2 |
from PyPDF2 import PdfReader
|
3 |
import logging
|
4 |
|
|
|
38 |
Initialize the ContractMissingClauses class and set up the OpenAI API client.
|
39 |
"""
|
40 |
|
41 |
+
openai.api_type = os.getenv['api_type']
|
42 |
+
openai.api_base = os.getenv['api_base']
|
43 |
+
openai.api_version = os.getenv['api_version']
|
44 |
+
openai.api_key = os.getenv['api_key']
|
45 |
+
|
46 |
def get_missing_clauses(self, contract: str):
|
47 |
|
48 |
"""
|
|
|
60 |
]
|
61 |
|
62 |
# Call OpenAI GPT-3.5-turbo
|
63 |
+
chat_completion = openai.ChatCompletion.create(
|
64 |
+
engine="ChatGPT",
|
65 |
+
messages = conversation,
|
66 |
+
temperature=0.7,
|
67 |
+
max_tokens=800,
|
68 |
+
top_p=0.95,
|
69 |
+
frequency_penalty=0,
|
70 |
+
presence_penalty=0,
|
71 |
+
stop=None
|
72 |
+
)
|
73 |
response = chat_completion.choices[0].message.content
|
74 |
return response
|
75 |
|