Skip to content

Commit

Permalink
fix: error code in connection_error, return token_usage in last frame…
Browse files Browse the repository at this point in the history
… during using stream/astream
  • Loading branch information
whybeyoung committed May 13, 2024
1 parent 8aefe32 commit beaf8f6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions sparkai/errors/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,5 @@ class SparkAIClientConfigurationError(SparkAIClientError):
class SparkAIConnectionError(ConnectionError):
def __init__(self, error_code, message):
self.error_code = error_code
self.message = message
super().__init__(message)
4 changes: 2 additions & 2 deletions tests/examples/llm_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -419,15 +419,15 @@ def test_error():
try:
error_func()
except ConnectionError as e:
print(e.error_code)
print(e.error_code, str(e))

if __name__ == '__main__':
# import asyncio
# test_26b()
# asyncio.run(test_26b())
# test_once()
#test_stream()
#test_error()
test_error()
# test_function_call_once()
# test_function_call_stream()
# test_image()
Expand Down

0 comments on commit beaf8f6

Please sign in to comment.