Class AIGenPipeline
- java.lang.Object
-
- net.stoerr.ai.aigenpipeline.commandline.AIGenPipeline
-
public class AIGenPipeline extends Object
The main entry point of the AI Generation Pipeline.
This class reads the command line arguments, reads the configuration files, and then executes the AI generation task.
-
-
Field Summary
Fields Modifier and Type Field Description static String
AIGENPIPELINE_CONFIG
Name of the environment variable where we read common configuration from.protected String
apiKey
protected boolean
check
static String
CONFIGFILE
Name of configuration files we scan upwards from the output directory.protected boolean
dryRun
protected Pattern
ENVVARIABLE_PATTERN
Pattern for accessing an environment variable, e.g.static PrintStream
ERR
protected String
explain
protected boolean
help
protected String
helpAIquestion
protected List<AIInOut>
hintFiles
protected String
infilePromptMarker
protected List<AIInOut>
inputFiles
protected Map<String,String>
keyValues
protected PrintStream
logStream
protected String
model
protected String
organizationId
static PrintStream
OUT
protected String
output
protected String
outputScan
protected boolean
printconfig
protected boolean
printdependencydiagram
protected List<AIInOut>
promptFiles
protected RegenerationCheckStrategy
regenerationCheckStrategy
protected File
rootDir
protected AIGenerationTask
task
protected AIInOut
taskOutput
protected Integer
tokens
protected boolean
update
protected String
url
protected boolean
verbose
protected boolean
version
protected String
writePart
protected WritingStrategy
writingStrategy
-
Constructor Summary
Constructors Constructor Description AIGenPipeline()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
answerHelpAIQuestion()
This reads the collected texts of the website from /helpaitexts.md and gives them to the AI, and then has it answer the #helpAIquestion from that.protected List<AIGenArgumentList>
collectArgLists(String[] args, File startDir)
protected void
executeTask()
protected String
getVersion()
protected boolean
isIgnoreEnvironmentArgs(AIGenArgumentList args)
protected boolean
isStopCfgfileScan(AIGenArgumentList args)
static void
main(String[] args)
AIChatBuilder
makeChatBuilder()
protected void
parseArguments(String[] args, File dir)
protected void
prepareTask()
protected void
printHelp(boolean onerror)
protected static void
processCommandFile(String cmdfilepath)
Read command lines from the given file.protected void
readArguments(String[] args, File startDir)
protected void
run()
protected void
run(String[] args)
protected static void
runWithCommandLine(String cmdline)
protected void
runWithOutputScan(String[] args)
Scans for files inoutputScan
and processes them.String
toString()
-
-
-
Field Detail
-
AIGENPIPELINE_CONFIG
public static final String AIGENPIPELINE_CONFIG
Name of the environment variable where we read common configuration from.- See Also:
- Constant Field Values
-
CONFIGFILE
public static final String CONFIGFILE
Name of configuration files we scan upwards from the output directory.- See Also:
- Constant Field Values
-
OUT
public static final PrintStream OUT
-
ERR
public static final PrintStream ERR
-
ENVVARIABLE_PATTERN
protected final Pattern ENVVARIABLE_PATTERN
Pattern for accessing an environment variable, e.g. $FOO or ${FOO}
-
help
protected boolean help
-
verbose
protected boolean verbose
-
dryRun
protected boolean dryRun
-
check
protected boolean check
-
version
protected boolean version
-
helpAIquestion
protected String helpAIquestion
-
output
protected String output
-
taskOutput
protected AIInOut taskOutput
-
explain
protected String explain
-
url
protected String url
-
apiKey
protected String apiKey
-
organizationId
protected String organizationId
-
model
protected String model
-
task
protected AIGenerationTask task
-
rootDir
protected File rootDir
-
logStream
protected PrintStream logStream
-
tokens
protected Integer tokens
-
regenerationCheckStrategy
protected RegenerationCheckStrategy regenerationCheckStrategy
-
writingStrategy
protected WritingStrategy writingStrategy
-
writePart
protected String writePart
-
printconfig
protected boolean printconfig
-
infilePromptMarker
protected String infilePromptMarker
-
outputScan
protected String outputScan
-
printdependencydiagram
protected boolean printdependencydiagram
-
update
protected boolean update
-
-
Method Detail
-
main
public static void main(String[] args) throws IOException
- Throws:
IOException
-
processCommandFile
protected static void processCommandFile(String cmdfilepath) throws IOException
Read command lines from the given file. Empty lines separate individual command lines. Lines starting with a # are ignored (comments). This saves the startup time when calling the tool multiple times. Incompatible to all other options.- Throws:
IOException
-
runWithCommandLine
protected static void runWithCommandLine(String cmdline) throws IOException
- Throws:
IOException
-
run
protected void run(String[] args) throws IOException
- Throws:
IOException
-
makeChatBuilder
public AIChatBuilder makeChatBuilder()
-
run
protected void run() throws IOException
- Throws:
IOException
-
prepareTask
protected void prepareTask() throws IOException
- Throws:
IOException
-
executeTask
protected void executeTask()
-
runWithOutputScan
protected void runWithOutputScan(String[] args)
Scans for files inoutputScan
and processes them.- Parameters:
args
- the command line arguments
-
readArguments
protected void readArguments(String[] args, @Nonnull File startDir) throws IOException
- Throws:
IOException
-
collectArgLists
protected List<AIGenArgumentList> collectArgLists(String[] args, File startDir)
-
isStopCfgfileScan
protected boolean isStopCfgfileScan(AIGenArgumentList args)
-
isIgnoreEnvironmentArgs
protected boolean isIgnoreEnvironmentArgs(AIGenArgumentList args)
-
parseArguments
protected void parseArguments(String[] args, File dir) throws IOException
- Throws:
IOException
-
answerHelpAIQuestion
protected void answerHelpAIQuestion() throws IOException
This reads the collected texts of the website from /helpaitexts.md and gives them to the AI, and then has it answer the #helpAIquestion from that.- Throws:
IOException
- if the help texts could not be read
-
getVersion
protected String getVersion() throws IOException
- Throws:
IOException
-
printHelp
protected void printHelp(boolean onerror)
-
-