Spaces:
Running
Running
KarthickAdopleAI
commited on
Update ContractGenerator.py
Browse files- ContractGenerator.py +11 -10
ContractGenerator.py
CHANGED
@@ -33,22 +33,23 @@ class ContractGenerator:
|
|
33 |
"""
|
34 |
|
35 |
# Define a prompt
|
|
|
|
|
|
|
|
|
|
|
36 |
conversation = [
|
37 |
{"role": "system", "content": "You are a helpful Contract Generator."},
|
38 |
{"role": "user", "content": f"""Your task is to generate a contract form based on user instructions. ***Instructions:{instructions}***"""}
|
39 |
]
|
40 |
|
41 |
# Call OpenAI GPT-3.5-turbo
|
42 |
-
chat_completion =
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
frequency_penalty=0,
|
49 |
-
presence_penalty=0,
|
50 |
-
stop=None
|
51 |
-
)
|
52 |
response = chat_completion.choices[0].message.content
|
53 |
return response
|
54 |
|
|
|
33 |
"""
|
34 |
|
35 |
# Define a prompt
|
36 |
+
client = AzureOpenAI(api_key=os.getenv("AZURE_OPENAI_KEY"),
|
37 |
+
api_version="2023-07-01-preview",
|
38 |
+
azure_endpoint = os.getenv("AZURE_OPENAI_ENDPOINT")
|
39 |
+
)
|
40 |
+
|
41 |
conversation = [
|
42 |
{"role": "system", "content": "You are a helpful Contract Generator."},
|
43 |
{"role": "user", "content": f"""Your task is to generate a contract form based on user instructions. ***Instructions:{instructions}***"""}
|
44 |
]
|
45 |
|
46 |
# Call OpenAI GPT-3.5-turbo
|
47 |
+
chat_completion = client.chat.completions.create(
|
48 |
+
model = "ChatGPT",
|
49 |
+
messages = conversation,
|
50 |
+
max_tokens=1000,
|
51 |
+
temperature=0
|
52 |
+
)
|
|
|
|
|
|
|
|
|
53 |
response = chat_completion.choices[0].message.content
|
54 |
return response
|
55 |
|