Skip to content

Commit

Permalink
update minor version
Browse files Browse the repository at this point in the history
  • Loading branch information
RexWzh committed Feb 1, 2024
1 parent 66c0919 commit b0794d2
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ langs = ["python", "java", "Julia", "C++"]
def data2chat(msg):
chat = Chat()
chat.user("请用语言 %s 打印 hello world" % msg)
# 注意,这里不需要 getresponse 而交给异步处理
return chat

async_chat_completion(langs, chkpoint="async_chat.jsonl", nproc=2, data2chat=data2chat)
Expand Down
2 changes: 2 additions & 0 deletions README_en.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ def msg2chat(msg):
chat = Chat()
chat.system("You are a helpful translator for numbers.")
chat.user(f"Please translate the digit to Roman numerals: {msg}")
# We need to call `getresponse` here to get the response
chat.getresponse()
return chat

Expand All @@ -80,6 +81,7 @@ langs = ["python", "java", "Julia", "C++"]
def data2chat(msg):
chat = Chat()
chat.user("Please print hello world using %s" % msg)
# Note that we don't need to call `getresponse` here, and leave it to the asynchronous processing
return chat

async_chat_completion(langs, chkpoint="async_chat.jsonl", nproc=2, data2chat=data2chat)
Expand Down
10 changes: 5 additions & 5 deletions chattool/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

__author__ = """Rex Wang"""
__email__ = '1073853456@qq.com'
__version__ = '3.0.1'
__version__ = '3.1.0'

import os, sys, requests
from .chattool import Chat, Resp
Expand All @@ -25,12 +25,12 @@ def load_envs(env:Union[None, str, dict]=None):
for key, value in env.items():
os.environ[key] = value
# else: load from environment variables
api_key = os.environ.get('OPENAI_API_KEY')
base_url = os.environ.get('OPENAI_API_BASE_URL', "https://api.openai.com")
api_base = os.environ.get('OPENAI_API_BASE', os.path.join(base_url, 'v1'))
api_key = os.getenv('OPENAI_API_KEY')
base_url = os.getenv('OPENAI_API_BASE_URL', "https://api.openai.com")
api_base = os.getenv('OPENAI_API_BASE', os.path.join(base_url, 'v1'))
base_url = request.normalize_url(base_url)
api_base = request.normalize_url(api_base)
model = os.environ.get('OPENAI_API_MODEL', "gpt-3.5-turbo")
model = os.getenv('OPENAI_API_MODEL', "gpt-3.5-turbo")
return True

def save_envs(env_file:str):
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
with open('README.md') as readme_file:
readme = readme_file.read()

VERSION = '3.0.1'
VERSION = '3.1.0'

requirements = [
'Click>=7.0', 'requests>=2.20', "responses>=0.23", 'aiohttp>=3.8',
Expand Down

0 comments on commit b0794d2

Please sign in to comment.