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

Feature/show openai error message #113

Merged
merged 10 commits into from
Aug 18, 2023

Conversation

minheibis
Copy link
Contributor

issue #112 への対応

libs/openai_client.ts
実装自体はこちらの変更で、openai のエラーの際のレスポンスを表示するようにしています。

tests/libs/actions.generate.test.ts
に"handles error when OpenAI API returns an error"というテストを追加したのですが、テストの書き方がこれで良かったのかわからないので、見ていただけるとありがたいです。

@codecov
Copy link

codecov bot commented Aug 13, 2023

Codecov Report

Merging #113 (c044cdf) into main (33da6a0) will not change coverage.
The diff coverage is 100.00%.

@@            Coverage Diff            @@
##              main      #113   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           20        20           
  Lines         1392      1429   +37     
  Branches       146       147    +1     
=========================================
+ Hits          1392      1429   +37     
Files Changed Coverage Δ
deps.ts 100.00% <100.00%> (ø)
libs/openai_client.ts 100.00% <100.00%> (ø)
tests/helper.ts 100.00% <100.00%> (ø)

@minheibis
Copy link
Contributor Author

エラーの場合、以下のように表示されます

deno run -A dim.ts generate -t "tests/test_data/valid_csv.csv" "Python code that converts this csv data to json"
⠦ Generate a code ...
error message by ky client: 
Request failed with status code 401 Unauthorized

error response by openai:
 {
  "error": {
    "message": "Incorrect API key provided: aaa. You can find your API key at https://platform.openai.com/account/api-keys.",
    "type": "invalid_request_error",
    "param": null,
    "code": "invalid_api_key"
  }
}

libs/openai_client.ts Outdated Show resolved Hide resolved
libs/openai_client.ts Outdated Show resolved Hide resolved
@ryo-ma
Copy link
Collaborator

ryo-ma commented Aug 14, 2023

@minheibis ありがとうございます。大方問題なさそうです。少し細かい点で指摘させていただきましたのでご確認ください。

@minheibis
Copy link
Contributor Author

@ryo-ma ご確認ありがとうございます、エラーメッセージの説明について、大文字から始まるように修正しました。

@ryo-ma
Copy link
Collaborator

ryo-ma commented Aug 18, 2023

@minheibis ありがとうございます。問題なさそうなのでマージしていきます。
またソーシャルハックデーでも一緒に開発しましょう。お待ちしております。

@ryo-ma ryo-ma merged commit 7196131 into c-3lab:main Aug 18, 2023
3 checks passed
@minheibis
Copy link
Contributor Author

早速マージありがとうございます!
はい、ぜひよろしくお願いします!

@minheibis minheibis deleted the feature/show-openai-error-message branch August 18, 2023 06:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants