Hidayatmahar commited on
Commit
028f66b
·
verified ·
1 Parent(s): 1a9b615

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -16,15 +16,15 @@ def generate_legal_document(doc_type, terms, party_1, party_2):
16
  Please provide a professional legal document based on these details.
17
  """
18
 
19
- # Call OpenAI's GPT-3 model to generate the document
20
- response = openai.Completion.create(
21
- model="text-davinci-003", # Use a model suited for legal text
22
- prompt=prompt,
23
  max_tokens=1500
24
  )
25
 
26
  # Return the generated text
27
- return response.choices[0].text.strip()
28
 
29
  # Streamlit UI to collect user inputs
30
  st.title("Legal Document Generator")
 
16
  Please provide a professional legal document based on these details.
17
  """
18
 
19
+ # Call OpenAI's new chat completion API
20
+ response = openai.chat_completions.create(
21
+ model="gpt-4", # or "gpt-3.5-turbo"
22
+ messages=[{"role": "user", "content": prompt}],
23
  max_tokens=1500
24
  )
25
 
26
  # Return the generated text
27
+ return response['choices'][0]['message']['content']
28
 
29
  # Streamlit UI to collect user inputs
30
  st.title("Legal Document Generator")