Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix type of options #7

Merged
merged 1 commit into from
Apr 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading