Spaces:
Runtime error
Runtime error
Update aggressive_content_finder.py
Browse files- aggressive_content_finder.py +11 -10
aggressive_content_finder.py
CHANGED
@@ -30,6 +30,11 @@ class AggressiveContentFinder:
|
|
30 |
str: Identified aggressive terms.
|
31 |
"""
|
32 |
try:
|
|
|
|
|
|
|
|
|
|
|
33 |
conversation = [
|
34 |
{"role": "system", "content": "You are a helpful Aggressive Terms Finder in Given Contract."},
|
35 |
{"role": "user", "content": f"""This is a contract document content. Your task is to identify aggressive terms like warning terms, penalties in the given contract:
|
@@ -37,16 +42,12 @@ class AggressiveContentFinder:
|
|
37 |
]
|
38 |
|
39 |
# Call OpenAI GPT-3.5-turbo
|
40 |
-
chat_completion =
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
frequency_penalty=0,
|
47 |
-
presence_penalty=0,
|
48 |
-
stop=None
|
49 |
-
)
|
50 |
response = chat_completion.choices[0].message.content
|
51 |
return response
|
52 |
|
|
|
30 |
str: Identified aggressive terms.
|
31 |
"""
|
32 |
try:
|
33 |
+
client = AzureOpenAI(api_key=os.getenv("AZURE_OPENAI_KEY"),
|
34 |
+
api_version="2023-07-01-preview",
|
35 |
+
azure_endpoint = os.getenv("AZURE_OPENAI_ENDPOINT")
|
36 |
+
)
|
37 |
+
|
38 |
conversation = [
|
39 |
{"role": "system", "content": "You are a helpful Aggressive Terms Finder in Given Contract."},
|
40 |
{"role": "user", "content": f"""This is a contract document content. Your task is to identify aggressive terms like warning terms, penalties in the given contract:
|
|
|
42 |
]
|
43 |
|
44 |
# Call OpenAI GPT-3.5-turbo
|
45 |
+
chat_completion = client.chat.completions.create(
|
46 |
+
model = "ChatGPT",
|
47 |
+
messages = conversation,
|
48 |
+
max_tokens=1000,
|
49 |
+
temperature=0
|
50 |
+
)
|
|
|
|
|
|
|
|
|
51 |
response = chat_completion.choices[0].message.content
|
52 |
return response
|
53 |
|