Spaces:
Running
Running
KarthickAdopleAI
commited on
Commit
•
cc1b1ef
1
Parent(s):
b895d40
Update contract_missing_clausses.py
Browse files- contract_missing_clausses.py +11 -10
contract_missing_clausses.py
CHANGED
@@ -55,22 +55,23 @@ class ContractMissingClauses:
|
|
55 |
try:
|
56 |
LOGGER.info("Analyzing contract and extracting missing clauses...")
|
57 |
# Generate text using the OpenAI GPT-3 model
|
|
|
|
|
|
|
|
|
|
|
58 |
conversation = [
|
59 |
{"role": "system", "content": "You are a helpful incomplete sentences finder"},
|
60 |
{"role": "user", "content": f"""list out the incomplete sentences in the following text: {text}"""}
|
61 |
]
|
62 |
|
63 |
# Call OpenAI GPT-3.5-turbo
|
64 |
-
chat_completion =
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
frequency_penalty=0,
|
71 |
-
presence_penalty=0,
|
72 |
-
stop=None
|
73 |
-
)
|
74 |
response = chat_completion.choices[0].message.content
|
75 |
return response
|
76 |
|
|
|
55 |
try:
|
56 |
LOGGER.info("Analyzing contract and extracting missing clauses...")
|
57 |
# Generate text using the OpenAI GPT-3 model
|
58 |
+
client = AzureOpenAI(api_key=os.getenv("AZURE_OPENAI_KEY"),
|
59 |
+
api_version="2023-07-01-preview",
|
60 |
+
azure_endpoint = os.getenv("AZURE_OPENAI_ENDPOINT")
|
61 |
+
)
|
62 |
+
|
63 |
conversation = [
|
64 |
{"role": "system", "content": "You are a helpful incomplete sentences finder"},
|
65 |
{"role": "user", "content": f"""list out the incomplete sentences in the following text: {text}"""}
|
66 |
]
|
67 |
|
68 |
# Call OpenAI GPT-3.5-turbo
|
69 |
+
chat_completion = client.chat.completions.create(
|
70 |
+
model = "ChatGPT",
|
71 |
+
messages = conversation,
|
72 |
+
max_tokens=1000,
|
73 |
+
temperature=0
|
74 |
+
)
|
|
|
|
|
|
|
|
|
75 |
response = chat_completion.choices[0].message.content
|
76 |
return response
|
77 |
|