added crai building methods that takes input stream