pvanand commited on
Commit
cd5ac8a
·
verified ·
1 Parent(s): dd390d7

Update actions/actions.py

Browse files
Files changed (1) hide show
  1. actions/actions.py +2 -7
actions/actions.py CHANGED
@@ -77,19 +77,14 @@ def generate_openai_response(user_queries, model_engine="gpt-3.5-turbo", max_tok
77
  # Create context from the results
78
  context = "".join([f"#{str(i)}" for i in results])[:2014] # Trim the context to 2014 characters - Modify as necessory
79
 
80
- messages=[
81
- {"role": "system", "content": f"You are a helpful assistant tasked to answer user queries using the following context: {context}"}
82
  ]
83
  max_user_queries_to_include = min(1,len(user_queries))
84
  # The latest query is at the end of the list
85
- for i in range(len(user_queries)):
86
- if i<max_user_queries_to_include:
87
- messages.append({"role": "user", "content": user_queries[-max_user_queries_to_include+i]})
88
-
89
 
90
  co = cohere.Client(secret_value_0)
91
 
92
- response = co.generate(prompt=messages,)
93
  print(response)
94
  return response[0].text.strip()#+"Debug Info:
95
 
 
77
  # Create context from the results
78
  context = "".join([f"#{str(i)}" for i in results])[:2014] # Trim the context to 2014 characters - Modify as necessory
79
 
80
+ messages=f"You are a helpful assistant tasked to answer user query :{user_queries[-1]} using the following context: {context}"
 
81
  ]
82
  max_user_queries_to_include = min(1,len(user_queries))
83
  # The latest query is at the end of the list
 
 
 
 
84
 
85
  co = cohere.Client(secret_value_0)
86
 
87
+ response = co.generate(prompt=messages)
88
  print(response)
89
  return response[0].text.strip()#+"Debug Info:
90