44Module for the llms_wrapper_test command to perform a simple test to check
55if one or more LLMs are working.
66"""
7+ import sys
78import argparse
89import re
910from loguru import logger
1011from llms_wrapper .log import configure_logging
1112from llms_wrapper .llms import LLMS
1213from llms_wrapper .config import read_config_file , update_llm_config
1314from llms_wrapper .utils import pp_config , dict_except
15+ from llms_wrapper .version import __version__
1416
1517DEFAULT_PROMPT = """What is the first name of Einstein who developed the theory of relativity?
1618Only give the name and no additional text?"""
@@ -22,7 +24,6 @@ def get_args() -> dict:
2224 """
2325 Get the command line arguments
2426 """
25- print ("ENTERING get_args" )
2627 parser = argparse .ArgumentParser (description = 'Test llms' )
2728 parser .add_argument ('--llms' , '-l' , nargs = "*" , type = str , default = [], help = 'LLMs to use for the queries (or use config)' , required = False )
2829 parser .add_argument ('--use' , '-u' , nargs = "*" , type = str , default = [], help = 'Subset of LLMs to use (all)' , required = False )
@@ -35,12 +36,14 @@ def get_args() -> dict:
3536 parser .add_argument ("--show_response" , action = "store_true" , help = "Show thefull response from the LLM" , required = False )
3637 parser .add_argument ("--show_cost" , action = "store_true" , help = "Show token counts and cost" , required = False )
3738 parser .add_argument ("--logfile" , "-f" , type = str , help = "Log file" , required = False )
39+ parser .add_argument ("--version" , action = "store_true" , help = "Show version and exit" )
3840 args = parser .parse_args ()
39- print ("after parse_args" )
41+ if args .version :
42+ print ("llms_wrapper version:" , __version__ )
43+ sys .exit ()
4044 loglevel1 = "INFO"
4145 if args .debug :
4246 loglevel1 = "DEBUG"
43- print ("before configure_logging" )
4447 configure_logging (level = loglevel1 , logfile = args .logfile )
4548 # logger.enable("llms_wrapper")
4649 # TODO: for testing, remove once logging works properly
@@ -169,14 +172,10 @@ def run(config: dict):
169172
170173
171174def main ():
172- print ("Entering main()" )
173175 args = get_args ()
174- print ("After get_args()" )
175176 run (args )
176177
177178
178179if __name__ == '__main__' :
179- print ("Entering if __main__" )
180180 logger .enable ("llms_wrapper" )
181- print ("Before main()" )
182181 main ()
0 commit comments