taratrankennedy commited on
Commit
2860ff3
·
verified ·
1 Parent(s): 8caed8a

Refine code to reduce number of outputs

Browse files
Files changed (1) hide show
  1. app.py +9 -5
app.py CHANGED
@@ -11,8 +11,12 @@ retrieval_model_name = 'all-MiniLM-L6-v2' # Using a pre-trained model from Hugg
11
 
12
  openai.api_key = os.environ["OPENAI_API_KEY"]
13
 
14
- # Update the system message to provide more guidance on generating a to-do list
15
- system_message = "You are an assistant specialized in creating detailed to-do lists based on user input. Parse the input for tasks and generate a comprehensive list of actionable items. Output the items in a numbered list."
 
 
 
 
16
 
17
  # Initial system message to set the behavior of the assistant
18
  messages = [{"role": "system", "content": system_message}]
@@ -72,12 +76,12 @@ def generate_response(user_query):
72
  # Append user's message to messages list
73
  messages.append({"role": "user", "content": user_query})
74
 
75
- # Call OpenAI API to generate a to-do list based on the user query
76
  response = openai.ChatCompletion.create(
77
  model="gpt-4",
78
  messages=messages,
79
- max_tokens=200,
80
- temperature=0.2,
81
  top_p=1,
82
  frequency_penalty=0,
83
  presence_penalty=0
 
11
 
12
  openai.api_key = os.environ["OPENAI_API_KEY"]
13
 
14
+ # Update the system message to provide more guidance on generating a concise to-do list
15
+ system_message = (
16
+ "You are an assistant specialized in creating concise to-do lists based on user input. "
17
+ "Parse the input for tasks and generate a list of the most important actionable items. "
18
+ "Output the items in a numbered list, with a maximum of 3 items."
19
+ )
20
 
21
  # Initial system message to set the behavior of the assistant
22
  messages = [{"role": "system", "content": system_message}]
 
76
  # Append user's message to messages list
77
  messages.append({"role": "user", "content": user_query})
78
 
79
+ # Call OpenAI API to generate a concise to-do list based on the user query
80
  response = openai.ChatCompletion.create(
81
  model="gpt-4",
82
  messages=messages,
83
+ max_tokens=150, # Adjusted max tokens to reduce output length
84
+ temperature=0.3,
85
  top_p=1,
86
  frequency_penalty=0,
87
  presence_penalty=0