Brillig Understanding, Inc.

You can't' have missed all the buzz about GPT-CHAT and it's abilities to talk about most anything. Well, you don't need to be jealous. You can add that to ChatScript easily enough, to augment whatever your bot wants to talk about. ChatScript allows you to easily use external APIs with CS native abilities. You can call upon remote machine learning models, GPT-CHAT (when they release it) or GPT-3 (now) or weather reports, or whatever, and make them accessible within your script.

While GPT-3 requires you call an API of theirs to potentially censor their own response, their censor is not that good and you could still end up insulting your customers with a GPT3 answer. But it's easy to write filters that kill off unpleasant answers.'

You can easily add rules in CS to review their answer and censor it more completely. The simpleest rule involves merely looking for the word you/your and any negative affect words in the sentence returned by GPT3, using code like:

	if (PATTERN << you ~badwords >> ) ... cancel output
You can use ChatScript script to invoke programs on the local machine using ^popen() or access remote websites that support JSON calling conventions using ^jsonopen(). This is how you call GPT-3 etc.


Here is a sample call to remote GPT-3. In your cs_init.txt file, set up your password variable with your gpt login details. Normally you don't put them in code that you might give others.

Then in your scripts file.
outputmacro: ^gpt3_check($_txt) # their censorship call
	$_headers = ^"Authorization: Bearer $gpt3"
	$_body = ^'{"input": "$_txt"}'
	^nofail(RULE $_result = ^jsonopen(transient post $_body $_headers))
	$_bad = $_result.results[0].flagged
	if ($_bad != 0 AND $_bad != false) {} # they censored us
	else { ^fail(CALL)}

outputmacro: ^call_gpt3($_message $_input ) # their main call
	$_body = ^'{"model": "$gpt3_model" , "prompt": "$_message", "temperature": 0.8 , "n":1,  "user": "%login", "max_tokens": 220}'
	$_headers = ^"Authorization: Bearer $gpt3"  # variable from cs_init
	$_result = ^jsonopen(transient post $_body $_headers)
	# remote call failed
	if (%httpresponse != 200) {^fail(CALL)} 

	# pull out and return their answer after letting them censor it
	$_txt = $_result.choices[0].text
	if (^gpt3_check($_txt)) {^fail(CALL) }

Now you can have all the personality that ChatScript can create for your bot, with all the factoids (or falsities) that GPT-3 can supply.

About Us Technology External APIs Projects Testimonials ChatBot Demo Awards/Press Publications Contact