Skip to content

Commit

Permalink
Merge pull request #7 from cubenlp/rex/option
Browse files Browse the repository at this point in the history
fix type of options
  • Loading branch information
RexWzh authored Apr 29, 2024
2 parents bfa44ce + 2227012 commit 29c42e0
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
2 changes: 1 addition & 1 deletion askchat/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

__author__ = """Rex Wang"""
__email__ = '[email protected]'
__version__ = '1.1.3'
__version__ = '1.1.4'

import asyncio
from pathlib import Path
Expand Down
14 changes: 13 additions & 1 deletion askchat/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,19 @@ def main( message, model, base_url, api_base, api_key, use_env
click.echo("Please specify message!")
return
chat.user(message_text)
# Add chat response
# additinal options
if option:
option = dict(option)
ints = ['max_tokens', 'n', 'top_logprobs', 'seed']
floats = ['temperature', 'presence_penalty', 'frequency_penalty', 'top_p']
for key, value in option.items():
if key in ints:
option[key] = int(value)
elif key in floats:
option[key] = float(value)
else:
option = {}
# Add chat responses
chat.assistant(asyncio.run(show_resp(chat, **dict(option))))
chat.save(LAST_CHAT_FILE, mode='w')

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from setuptools import setup, find_packages

VERSION = '1.1.3'
VERSION = '1.1.4'

with open('README.md') as readme_file:
readme = readme_file.read()
Expand Down

0 comments on commit 29c42e0

Please sign in to comment.