diff --git a/openai_api_call/__init__.py b/openai_api_call/__init__.py index 9457f92..bb0f2f0 100644 --- a/openai_api_call/__init__.py +++ b/openai_api_call/__init__.py @@ -2,7 +2,7 @@ __author__ = """Rex Wang""" __email__ = '1073853456@qq.com' -__version__ = '1.2.0' +__version__ = '1.3.0' import os, sys, requests from .chattool import Chat, Resp diff --git a/openai_api_call/chattool.py b/openai_api_call/chattool.py index c266481..8e7dffe 100644 --- a/openai_api_call/chattool.py +++ b/openai_api_call/chattool.py @@ -99,6 +99,7 @@ def getresponse( self timeout (int, optional): timeout for the API call. Defaults to 0(no timeout). timeinterval (int, optional): time interval between two API calls. Defaults to 0. update (bool, optional): whether to update the chat log. Defaults to True. + options (dict, optional): other options like `temperature`, `top_p`, etc. Returns: Resp: API response diff --git a/openai_api_call/response.py b/openai_api_call/response.py index 490618c..734b985 100644 --- a/openai_api_call/response.py +++ b/openai_api_call/response.py @@ -33,7 +33,7 @@ def cost(self): return response_cost(self.model, self.prompt_tokens, self.completion_tokens) def __repr__(self) -> str: - return f"`Resp`: {self.content}" + return "" def __str__(self) -> str: return self.content @@ -78,7 +78,7 @@ def message(self): @property def content(self): """Content of the response""" - return "" + return self.message['content'] @property def delta_content(self): diff --git a/setup.py b/setup.py index 298f9c5..c01430d 100644 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ with open('README.md') as readme_file: readme = readme_file.read() -VERSION = '1.2.0' +VERSION = '1.3.0' requirements = [ 'Click>=7.0', 'requests>=2.20', "responses>=0.23", diff --git a/tests/test_async.py b/tests/test_async.py index e84fde7..9ca3b5f 100644 --- a/tests/test_async.py +++ b/tests/test_async.py @@ -3,6 +3,7 @@ from openai_api_call.asynctool import async_chat_completion openai_api_call.api_key="free-123" openai_api_call.base_url = "https://api.wzhecnu.cn" +import asyncio # langs = ["Python", "Julia", "C++", "C", "Java", "JavaScript", "C#", "Go", "R", "Ruby"] langs = ["Python", "Julia", "C++"] diff --git a/tests/test_openai_api_call.py b/tests/test_openai_api_call.py index 23dbb43..a8e00ea 100644 --- a/tests/test_openai_api_call.py +++ b/tests/test_openai_api_call.py @@ -210,5 +210,5 @@ def test_valid(): def test_show(): resp = Resp(response=response) assert str(resp) == resp.content - assert repr(resp) == f"`Resp`: {resp.content}" + assert repr(resp) == "" \ No newline at end of file