Spaces:
Running
Running
naveenvenkatesh
commited on
Commit
•
0124e48
1
Parent(s):
3c65a2f
Update Clauses_Extractor.py
Browse files- Clauses_Extractor.py +16 -9
Clauses_Extractor.py
CHANGED
@@ -1,12 +1,15 @@
|
|
1 |
import openai
|
2 |
import os
|
3 |
-
from openai import OpenAI
|
4 |
|
5 |
# Define the Clauses class
|
6 |
class Clauses:
|
|
|
7 |
def __init__(self):
|
8 |
-
|
9 |
-
|
|
|
|
|
|
|
10 |
|
11 |
def get_extracted_clauses(self,extracted_summary):
|
12 |
"""
|
@@ -26,12 +29,16 @@ class Clauses:
|
|
26 |
]
|
27 |
|
28 |
# Call OpenAI GPT-3.5-turbo
|
29 |
-
chat_completion =
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
|
|
|
|
|
|
|
|
35 |
response = chat_completion.choices[0].message.content
|
36 |
return response
|
37 |
|
|
|
1 |
import openai
|
2 |
import os
|
|
|
3 |
|
4 |
# Define the Clauses class
|
5 |
class Clauses:
|
6 |
+
|
7 |
def __init__(self):
|
8 |
+
|
9 |
+
openai.api_type = os.getenviron['api_type']
|
10 |
+
openai.api_base = os.getenviron['api_base']
|
11 |
+
openai.api_version = os.getenviron['api_version']
|
12 |
+
openai.api_key = os.getenviron['api_key']
|
13 |
|
14 |
def get_extracted_clauses(self,extracted_summary):
|
15 |
"""
|
|
|
29 |
]
|
30 |
|
31 |
# Call OpenAI GPT-3.5-turbo
|
32 |
+
chat_completion = openai.ChatCompletion.create(
|
33 |
+
engine="ChatGPT",
|
34 |
+
messages = conversation,
|
35 |
+
temperature=0.7,
|
36 |
+
max_tokens=800,
|
37 |
+
top_p=0.95,
|
38 |
+
frequency_penalty=0,
|
39 |
+
presence_penalty=0,
|
40 |
+
stop=None
|
41 |
+
)
|
42 |
response = chat_completion.choices[0].message.content
|
43 |
return response
|
44 |
|