Hi, I want to know that is there any source like website or solution to integrate rasa nlu with gpt-j. I have tried the LanguageModelFeaturizer component in the config file but it does not have the gpt-j model. Also I have tried to add the gpt-j api key in the actions.py file. I’m currently working on the transformer model GPT-J integration with Rasa NLU.
import openai
from typing import Any, Text, Dict, List
from rasa_sdk import Action, Tracker
from rasa_sdk.executor import CollectingDispatcher
def gptj(text):
api_key = "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"
response = openai.Completion.create(
model="gpt-j",
# 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']
# class ActionHelloWorld(Action):
# def name(self) -> Text:
# return "action_hello_world"
# def run(self, dispatcher: CollectingDispatcher,
# tracker: Tracker,
# domain: Dict[Text, Any]) -> List[Dict[Text, Any]]:
#
# dispatcher.utter_message(text="Hello World!")
#
# return []
#
class ActionDefaultFallback(Action):
def init(self):
# self.gptj = gptj()
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=gptj(query))
return [UserUtteranceReverted()]
The action python file does not work while I run the “rasa run actions” command in the terminal it has a lot of error and an indentation error for the code. When I run “rasa train” and “rasa shell”, it run and works normally without the gpt-j trained on it.
(rasa_flow) C:\Users\User\Desktop\RASA INIT>rasa run actions
C:\Users\User\anaconda3\envs\rasa_flow\lib\site-packages\sanic_cors\extension.py:39: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
SANIC_VERSION = LooseVersion(sanic_version)
2022-11-25 14:47:47 INFO rasa_sdk.endpoint - Starting action endpoint server...
2022-11-25 14:47:48 INFO rasa_sdk.executor - Registered function for 'action_default_fallback'.
2022-11-25 14:47:48 INFO rasa_sdk.endpoint - Action endpoint is up and running on http://0.0.0.0:5055
Is there a possible way to connect Rasa NLU with Transformer NLU?