1212from .auto import AutoGenerator
1313from .agents_generator import AgentsGenerator
1414from .inbuilt_tools import *
15+ from .inc .config import generate_config
1516import shutil
1617import subprocess
1718import logging
@@ -130,17 +131,20 @@ def main(self):
130131
131132 if args .agent_file == 'train' :
132133 package_root = os .path .dirname (os .path .abspath (__file__ ))
133- config_yaml_source = os .path .join (package_root , 'setup' , 'config.yaml' )
134134 config_yaml_destination = os .path .join (os .getcwd (), 'config.yaml' )
135135
136- if not os .path .exists (config_yaml_destination ):
137- try :
138- shutil .copyfile (config_yaml_source , config_yaml_destination )
139- print ("config.yaml copied to the current directory." )
140- except FileExistsError :
141- print ("config.yaml already exists in the current directory. Skipping copy." )
142- else :
143- print ("config.yaml already exists in the current directory. Skipping copy." )
136+ # Generate config.yaml using the function
137+ config = generate_config (
138+ model_name = args .model ,
139+ hf_model_name = args .hf ,
140+ ollama_model_name = args .ollama ,
141+ dataset = [{
142+ "name" : args .dataset
143+ }]
144+ )
145+ with open ('config.yaml' , 'w' ) as f :
146+ yaml .dump (config , f , default_flow_style = False , indent = 2 )
147+
144148
145149 if 'init' in sys .argv :
146150 from praisonai .setup .setup_conda_env import main as setup_conda_main
@@ -150,12 +154,12 @@ def main(self):
150154
151155 try :
152156 result = subprocess .check_output (['conda' , 'env' , 'list' ])
153- if 'prasion_env ' in result .decode ('utf-8' ):
154- print ("Conda environment 'prasion_env ' found." )
157+ if 'praison_env ' in result .decode ('utf-8' ):
158+ print ("Conda environment 'praison_env ' found." )
155159 else :
156160 raise subprocess .CalledProcessError (1 , 'grep' )
157161 except subprocess .CalledProcessError :
158- print ("Conda environment 'prasion_env ' not found. Setting it up..." )
162+ print ("Conda environment 'praison_env ' not found. Setting it up..." )
159163 from praisonai .setup .setup_conda_env import main as setup_conda_main
160164 setup_conda_main ()
161165 print ("All packages installed." )
@@ -167,7 +171,7 @@ def main(self):
167171 env = os .environ .copy ()
168172 env ['PYTHONUNBUFFERED' ] = '1'
169173
170- stream_subprocess (['conda' , 'run' , '--no-capture-output' , '--name' , 'prasion_env ' , 'python' , '-u' , train_script_path , 'train' ] + train_args , env = env )
174+ stream_subprocess (['conda' , 'run' , '--no-capture-output' , '--name' , 'praison_env ' , 'python' , '-u' , train_script_path , 'train' ] + train_args , env = env )
171175 return
172176
173177 invocation_cmd = "praisonai"
@@ -240,7 +244,11 @@ def parse_args(self):
240244 parser .add_argument ("--auto" , nargs = argparse .REMAINDER , help = "Enable auto mode and pass arguments for it" )
241245 parser .add_argument ("--init" , nargs = argparse .REMAINDER , help = "Enable auto mode and pass arguments for it" )
242246 parser .add_argument ("agent_file" , nargs = "?" , help = "Specify the agent file" )
243- parser .add_argument ("--deploy" , action = "store_true" , help = "Deploy the application" ) # New argument
247+ parser .add_argument ("--deploy" , action = "store_true" , help = "Deploy the application" )
248+ parser .add_argument ("--model" , type = str , help = "Model name" )
249+ parser .add_argument ("--hf" , type = str , help = "Hugging Face model name" )
250+ parser .add_argument ("--ollama" , type = str , help = "Ollama model name" )
251+ parser .add_argument ("--dataset" , type = str , help = "Dataset name for training" , default = "yahma/alpaca-cleaned" )
244252 args , unknown_args = parser .parse_known_args ()
245253
246254 if unknown_args and unknown_args [0 ] == '-b' and unknown_args [1 ] == 'api:app' :
0 commit comments