pvanand commited on
Commit
adba56d
·
1 Parent(s): 2067ac1

Update actions/actions.py

Browse files
Files changed (1) hide show
  1. actions/actions.py +5 -3
actions/actions.py CHANGED
@@ -29,6 +29,7 @@ openai.api_key = secret_value_0
29
 
30
  def generate_openai_response(query, model_engine="text-davinci-002", max_tokens=124, temperature=0.8):
31
  """Generate a response using the OpenAI API."""
 
32
  # Run the main function from search_content.py and store the results in a variable
33
  results = main_search(query)
34
 
@@ -59,10 +60,11 @@ class GetOpenAIResponse(Action):
59
  domain: Dict[Text, Any]) -> List[Dict[Text, Any]]:
60
 
61
  # Use OpenAI API to generate a response
62
-
 
 
63
  # Output the generated response to user
64
- generated_text = response.choices[0].text
65
- dispatcher.utter_message(text=generated_text)
66
 
67
  class GeneralHelp(Action):
68
  def name(self) -> Text:
 
29
 
30
  def generate_openai_response(query, model_engine="text-davinci-002", max_tokens=124, temperature=0.8):
31
  """Generate a response using the OpenAI API."""
32
+
33
  # Run the main function from search_content.py and store the results in a variable
34
  results = main_search(query)
35
 
 
60
  domain: Dict[Text, Any]) -> List[Dict[Text, Any]]:
61
 
62
  # Use OpenAI API to generate a response
63
+ query = tracker.latest_message.get('text')
64
+ response = generate_openai_response(query)
65
+
66
  # Output the generated response to user
67
+ dispatcher.utter_message(text=response)
 
68
 
69
  class GeneralHelp(Action):
70
  def name(self) -> Text: