Combine GPT3 with RASA

Viewed 26

I am trying to integrate rasa with gpt3, but not getting the proper response. Can help me out to look at my code and tell me issue.

def gpt3(text):
response = openai.Completion.create(
    model="code-cushman-001",
    # engine="ada",
    prompt="\n\n" + text,
    temperature=0,
    logprobs=10,
    max_tokens=150,
    top_p=0,
    frequency_penalty=0,
    presence_penalty=0,
    stop=[" \n\n"]
) 
return response['choices'][0]['text']

action.py

class ActionDefaultFallback(Action):
def init(self):
    # self.gpt3 = gpt3()
    super()._init_()

def name(self) -> Text:
    return "action_default_fallback"

async def run(self, dispatcher, tracker, domain):
    query = tracker.latest_message['text']
    dispatcher.utter_message(text=gpt3(query))

    return [UserUtteranceReverted()]

Not able to understand the issue. Help me out to solve this.

Thanks

0 Answers
Related