Skip to content

Commit

Permalink
Added Version Global
Browse files Browse the repository at this point in the history
  • Loading branch information
haseeb-heaven committed Mar 4, 2024
1 parent 414bd3f commit 724985f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
7 changes: 5 additions & 2 deletions interpreter.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,16 @@
import warnings
from libs.markdown_code import display_markdown_message

# The main version of the interpreter.
INTERPRETER_VERSION = "2.1"

def main():
parser = argparse.ArgumentParser(description='Code - Interpreter')
parser.add_argument('--exec', '-e', action='store_true', default=False, help='Execute the code')
parser.add_argument('--save_code', '-s', action='store_true', default=False, help='Save the generated code')
parser.add_argument('--mode', '-md', choices=['code', 'script', 'command','vision','chat'], help='Select the mode (`code` for generating code, `script` for generating shell scripts, `command` for generating single line commands) `vision` for generating text from images')
parser.add_argument('--model', '-m', type=str, default='code-llama', help='Set the model for code generation. (Defaults to gpt-3.5-turbo)')
parser.add_argument('--version', '-v', action='version', version='%(prog)s 2.1')
parser.add_argument('--version', '-v', action='version', version='%(prog)s '+ INTERPRETER_VERSION)
parser.add_argument('--lang', '-l', type=str, default='python', help='Set the interpreter language. (Defaults to Python)')
parser.add_argument('--display_code', '-dc', action='store_true', default=False, help='Display the code in output')
parser.add_argument('--history', '-hi', action='store_true', default=False, help='Use history as memory')
Expand All @@ -43,7 +46,7 @@ def main():

# Create an instance of the Interpreter class and call the main method.
interpreter = Interpreter(args)
interpreter.interpreter_main()
interpreter.interpreter_main(INTERPRETER_VERSION)

if __name__ == "__main__":
try:
Expand Down
6 changes: 4 additions & 2 deletions libs/interpreter_lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
class Interpreter:
logger = None
client = None
interpreter_version = "2.1"
interpreter_version = None

def __init__(self, args):
self.args = args
Expand Down Expand Up @@ -402,9 +402,11 @@ def execute_code(self, extracted_code, os_name):
else:
return None, None # Return None, None if user chooses not to execute the code

def interpreter_main(self):
def interpreter_main(self,version):

self.interpreter_version = version
self.logger.info(f"Interpreter - v{self.interpreter_version}")

os_platform = self.utility_manager.get_os_platform()
os_name = os_platform[0]
generated_output = None
Expand Down

0 comments on commit 724985f

Please sign in to comment.