Skip to content

Commit c3535c4

Browse files
authored
Merge pull request #94 from codelion/feat-add-version
Update optillm.py
2 parents 38504ff + f2bd002 commit c3535c4

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

optillm.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import re
1313
from concurrent.futures import ThreadPoolExecutor
1414
from typing import Tuple, Optional, Union, Dict, Any, List
15+
from importlib.metadata import version
1516

1617
# Import approach modules
1718
from optillm.mcts import chat_with_mcts
@@ -507,6 +508,16 @@ def health():
507508

508509
def parse_args():
509510
parser = argparse.ArgumentParser(description="Run LLM inference with various approaches.")
511+
512+
# Add version argument using importlib.metadata
513+
try:
514+
package_version = version('optillm')
515+
except Exception:
516+
package_version = "unknown" # Fallback if package is not installed
517+
518+
parser.add_argument('--version', action='version',
519+
version=f'%(prog)s {package_version}',
520+
help="Show program's version number and exit")
510521

511522
# Define arguments and their corresponding environment variables
512523
args_env = [

0 commit comments

Comments
 (0)