Skip to content

Commit

Permalink
Merge pull request #94 from codelion/feat-add-version
Browse files Browse the repository at this point in the history
Update optillm.py
  • Loading branch information
codelion authored Nov 14, 2024
2 parents 38504ff + f2bd002 commit c3535c4
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions optillm.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import re
from concurrent.futures import ThreadPoolExecutor
from typing import Tuple, Optional, Union, Dict, Any, List
from importlib.metadata import version

# Import approach modules
from optillm.mcts import chat_with_mcts
Expand Down Expand Up @@ -507,6 +508,16 @@ def health():

def parse_args():
parser = argparse.ArgumentParser(description="Run LLM inference with various approaches.")

# Add version argument using importlib.metadata
try:
package_version = version('optillm')
except Exception:
package_version = "unknown" # Fallback if package is not installed

parser.add_argument('--version', action='version',
version=f'%(prog)s {package_version}',
help="Show program's version number and exit")

# Define arguments and their corresponding environment variables
args_env = [
Expand Down

0 comments on commit c3535c4

Please sign in to comment.