pvanand commited on
Commit
dee36e5
·
1 Parent(s): 0be4e58

Update actions/actions.py

Browse files
Files changed (1) hide show
  1. actions/actions.py +4 -4
actions/actions.py CHANGED
@@ -32,13 +32,13 @@ openai.api_key = secret_value_0
32
  # Provide your OpenAI API key
33
 
34
  #model_engine="text-davinci-002"
35
- def generate_openai_response(query, model_engine="gpt-3.5-turbo", max_tokens=256, temperature=0.8):
36
  """Generate a response using the OpenAI API."""
37
 
38
  # Run the main function from search_content.py and store the results in a variable
39
 
40
  #results = main_search(query)
41
- results = main_search(query["current_user_query"]+query["previous_user_query"])
42
 
43
  # Create context from the results
44
  context = "".join([f"#{str(i)}" for i in results])[:2014] # Trim the context to 2014 characters - Modify as necessory
@@ -75,8 +75,8 @@ class GetOpenAIResponse(Action):
75
 
76
  # Use OpenAI API to generate a response
77
  #query = tracker.latest_message.get('text')
78
- query = [FollowupAction("action_extract_history")]
79
- response = generate_openai_response(query)
80
 
81
  # Output the generated response to user
82
  dispatcher.utter_message(text=response)
 
32
  # Provide your OpenAI API key
33
 
34
  #model_engine="text-davinci-002"
35
+ def generate_openai_response(conversation_data, model_engine="gpt-3.5-turbo", max_tokens=256, temperature=0.5):
36
  """Generate a response using the OpenAI API."""
37
 
38
  # Run the main function from search_content.py and store the results in a variable
39
 
40
  #results = main_search(query)
41
+ results = main_search(conversation_data["current_user_query"]+conversation_data["previous_user_query"])
42
 
43
  # Create context from the results
44
  context = "".join([f"#{str(i)}" for i in results])[:2014] # Trim the context to 2014 characters - Modify as necessory
 
75
 
76
  # Use OpenAI API to generate a response
77
  #query = tracker.latest_message.get('text')
78
+ conversation_data = [FollowupAction("action_extract_history")]
79
+ response = generate_openai_response(conversation_data)
80
 
81
  # Output the generated response to user
82
  dispatcher.utter_message(text=response)