RASA: Automatic generation of stories - chatbot

I want to know whether it is possible to automatically generate stories to train the chatbot using RASA.
I have built my training data using the online training session to generate the stories and I found it very impractical. I would like to know whether there is some automatic way to do the story conversion of any conversation.

You can use interactive learning to create training data while speaking to the bot. See the docs here for more information on how to use interactive learning.

This is probably too late of a response but it is for the rest of the community who might still need an answer to this. A few months ago, I personally experienced that it would take too long to conduct interactive learning to train your RASA bot (especially when you have hundreds of intents and actions).
What I did was:
1) Compile all my named intents and actions(utter_) into a .csv file with following column headers : [subject] | [intent_name] | [utter_name]
2) Parse the intent name along with its respective action name in the same row into Markdown(.md) format while adding the respective strings to follow the formatting of the stories.md file
Package this into a function and call in a for loop:
subcell = "## " + column[0] + "\n" # [subject] header for stories
subcell += "* " + column[1] + "\n" + " - " + column[2] + "\n" + "\n" # [intent_name] + [utter_name]
3) The generated stories.md output will have all the direct intent-action pairings for your simple conversation flows. Likewise, you can apply this concept for generating domain.yml
Hope this helps!

Related

When using OPT-2.7B or any other natural language model, is there a way to trick it into having a conversation/ give it a pre prompt in the code

Using this code, or a variant of, is there anything that can be added to "trick" opt into conversing as another user in a style more similar to a chatbot. As of now it will either start something more similar to an article or have a conversation with itself for a few lines as seen below.
val = input("Enter your value: ")
input_ids = tokenizer((val), return_tensors='pt').input_ids
output = model.generate(input_ids, min_length=1, max_length=1024, penalty_alpha=0.6, top_k=6)
print("Output:\n" + 100 * '-')
print(tokenizer.decode(output[0], skip_special_tokens=True))
print("" + 100 * '-')
with open("OutputText.txt", "w") as f:
f.write(tokenizer.decode(output[0], skip_special_tokens=True))
Here's an example of the current output:
*User Input:
Hello There.
Model Output:
Hello there. I have an egg that matches your TSV. Would you mind hatching it for me?
Sure, I'll add you now. Let me know when you're online.
Sorry for the late reply. I'm online now for the next few hours. Just send me a trade request whenever you're ready.
No probs, I'm in the middle of a battle at the moment, but I'll get you as soon as I'm done.
Thank you very much for the hatch. Have a nice day :D
*
I've attempted to add a prompt to the start and it hasn't made a difference.

Why Am I getting Duplicate Keys When I am not making any additions to the Table

Having a problem with a very old Access Program.
I had to create a form for updating a Table, I do not want to add any records!
The form only references one Table.
I use the Input Box for the Data I am looking up.
I then find the record in the database from the information I have entered using the open.recordset
Set Rst = ich.openRecordset("Select * From Waters Where '" & txtOne & "' = State and '" & txtTwo & "' = County and '" & txtThree & "' = Sector and '" & txtFour & "' = Water")
This part works great!
I then make the bad water changes and in no way is there a duplicate.
Somewhere using the Form tied to the Recordset is causing a conflict. It always worked in Access 1.0, but after an upgrade to Windows 11 and Access2013. It has not worked.
How do I tell it that it should ignore the fields that are the key fields I search on.
I put the additions = NO on the Table but them the screen goes blank and ignores the form.
How do I get around this?
I could do a massive re-write with another approach, but this application is for finding water that may be making people sick.
Thanks in Advance for any help
Tony
vdsv#zianet.com

how do duckduckgo spice IA secondary API calls get their parameters?

I have been looking through the spice instant answer source code. Yes, I know it is in maintenance mode, but I am still curious.
The documentation makes it fairly clear that the primary spice to API gets its numerical parameters $1, $2, etc. from the handle function.
My question: should there be secondary API calls included with spice alt_to as, say, in the movie spice IA, where do the numerical parameters to that API call come from?
Note, for instance, the $1 in both the movie_image and cast_image secondary API calls in spice alt_to at the preceding link. I am asking which regex capture returns those instances of $1.
I believe I see how this works now. The flow of information is still a bit murky to me, but at least I see how all of the requisite information is there.
I'll take the cryptocurrency instant answer as an example. The alt_to element in the perl package file at that link has a key named cryptonator. The corresponding .js file constructs a matching endpoint:
var endpoint = "/js/spice/cryptonator/" + from + "/" + to;
Note the general shape of the "remainder" past /js/spice/cryptonator: from/to, where from and to will be two strings.
Back in the perl package the hash alt_to->{cryptonator} has a key from which receives, I think, this remainder from/to. The value corresponding to that key is a regex meant to split up that string into its two constituents:
from => '([^/]+)/([^/]*)'
Applied to from/to, that regex will return $1=from and $2=to. These, then, are the $1 and $2 that go into
to => 'https://api.cryptonator.com/api/full/$1-$2'
in alt_to.
In short:
The to field of alt_to->{blah} receives its numerical parameters by having the from regex operate on the remainder past /js/spice/blah/ of the name of the corresponding endpoint constructed in the relevant .js file.

how to solve actions on google-Api.ai error

Screenshot 2The one screen shot of this errorissue I am building an app using api.ai , an syllabus app which tells you the syllabus, but when I invoke it with desired parameters like branch and semester I have made each individual intent for it even then I'm getting miss answers sometimes like when asked for sem 4 and branch electronics its showing sem 3 sem 4 or of other branch . I have given sem and branch as required n given few invoking statements even then getting this. Tried even training it manually for free 30s of actions on api.ai no solution please help. Not using any web hook , context , event.
Short answer - check here for screenshots http://imgur.com/a/tVBlD
Long answer - You have two options
1) Create 3 separate custom entities for each branch type (computer science, civil, communication) which you need to attach to your branch parameter
2) Using the sys.any entity and attaching it to your branch parameter; then determining what the incoming parameter value is on a server then sending back a response through a webhook.
If you go the second route, you have to create a webhook and hardcode recognized words like 'computer science' in IF statements which check the incoming parameter (sent through JSON from API.AI). This route will be more difficult but I think you will have to travel it regardless because you will have backend architecture which you access to find and return the syllabus.
Note the second route is what I did to solve a similar issue.
You can also use regex to match an item in a list which limits the amount of hardcoding and if statements you have to do.
Python regex search example
baseurl = "http://mywebsite.com:9001/"
# Parse the document
# Build the URL + File Path and Parse the Document
url = baseurl + 'Data'
xmlLink = urllib.request.urlopen(url)
xmlData = etree.parse(xmlLink)
xmlLink.close()
# Find the number of elements to cycle through
numberOfElements = xmlData.xpath("count(//myData/data)")
numberOfElements = int(numberOfElements)
types = xmlData.xpath("//myData/data")
# Search the string
i = 0
while numberOfElements > i:
listSearch= types[i].text
match = re.search(parameter, listSearch, re.IGNORECASE)
if match is None:
i += 1
else:
# Grab the ID
elementID = types[i].get('id')
i = 0
break
An simple trick would be what i did, just have an entity saved for both branch and semester , use sys.original parameters and an common phrase for provoking each intent saves up the hard work.

Can we pull REXX SQL output values into ISPF panel?

I Have created a REXX program to fetch 3 columns from a table.
I have kept temporary variables to hold SQL values (takes automatic datatype as per input)
Its like:
ADDRESS DSNREXX "EXECSQL FETCH C1 INTO :IN, :CR, :TN"
Now i have created A Panel, but i only know that we assign options.
Which is done like giving
%option_name
But havent got any book or online forum about how to display those REXX program variables to screen.
There are forums only for Calling a panel which have its own functionality.
In ISPF panels, any 8 character rexx variable can be displayed either using the &var. format or prefixing it with a field definition char (say _ for an entry field). e.g.
Rexx:
v1 = '...'
v2 = '..'
v3 = '.'
ISPF Panel:
)body
+ V1 = &v1. Display the value (... will be displayed)
+ v2 :_V2 + Allow the user to update v2
See http://publib.boulder.ibm.com/infocenter/zvm/v5r4/index.jsp?topic=/com.ibm.zvm.v54.dmsa3/ispfpan.htm
Sample ispf panel definition
)BODY
%--------------------------- EMPLOYEE RECORDS ------------------------------
%COMMAND ===>_ZCMD
%
%EMPLOYEE SERIAL: &EMPSER
+
+ TYPE OF CHANGE%===>_TYPECHG + (NEW, UPDATE, OR DELETE)
+
+ EMPLOYEE NAME:
+ LAST %===>_LNAME +
+ FIRST %===>_FNAME +
+ INITIAL%===>_I+
+
+ HOME ADDRESS:
+ LINE 1 %===>_ADDR1 +
+ LINE 2 %===>_ADDR2 +
+ LINE 3 %===>_ADDR3 +
If more than 1 row is being displayed, you may find it useful to
Add the returned rows to a ISPF table
Display the table using the TBDISPL service.
Note: for Table display panels you must include a )Model section for data in the table
If you want to use ISPF Tables see http://rexxpertise.blogspot.com.au/2011/11/ispf-tables-defining-and-building.html for examples of TBCREATE and TBADD
Also for a complicated example ISPF Table
Have a look at question
General ISPF info is available at:
OS/390 V2R5.0-V2R7.0 ISPF Examples
OS/390 V2R10.0 ISPF Dialog Developer's Guide and Reference
OS/390 V2R10.0 ISPF Services Guide