Replace AI::Response with Hash - #13
Merged
Merged
Conversation
There was a problem hiding this comment.
Important
Looks good to me! 👍
Reviewed everything up to 73a67a2 in 2 minutes and 5 seconds. Click for details.
- Reviewed
138lines of code in4files - Skipped
1files when reviewing. - Skipped posting
3draft comments. View those below. - Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. lib/ai/chat.rb:106
- Draft comment:
The 'chat_response' hash in generate! is missing a :total_tokens key; add it (e.g., total_tokens: response.usage.to_h[:total_tokens]) to match the tests. - Reason this comment was not posted:
Comment looked like it was already resolved.
2. lib/ai/chat.rb:214
- Draft comment:
In prepare_messages_for_api, message[:response] is now a Hash, so replace '.id' with hash access (e.g., message[:response][:id]) to correctly compare with previous_response_id. - Reason this comment was not posted:
Comment was not on a location in the diff, so it can't be submitted as a review comment.
3. README.md:585
- Draft comment:
There is a potential inconsistency: the README usage example shows keys :prompt_tokens/:completion_tokens, while generate! slices :input_tokens/:output_tokens. Verify and adjust the key names so they are consistent. - Reason this comment was not posted:
Comment was on unchanged code.
Workflow ID: wflow_PEB4cugVCPOYdxuL
You can customize by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.
There was a problem hiding this comment.
Caution
Changes requested ❌
Reviewed 3077189 in 1 minute and 22 seconds. Click for details.
- Reviewed
19lines of code in1files - Skipped
0files when reviewing. - Skipped posting
1draft comments. View those below. - Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. lib/ai/chat.rb:105
- Draft comment:
Extracting response_usage improves clarity. Confirm that response.usage always responds to to_h. - Reason this comment was not posted:
Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 10% vs. threshold = 50% The first part about clarity is just praise, not actionable. The second part asks for confirmation about API behavior, which violates our rule about not asking authors to verify things. If response.usage didn't respond to to_h, it would fail at runtime and be caught by tests. We should trust that the author tested their code. The comment does point out a potential runtime error that could occur if the API changes. Maybe this is a valid concern about defensive programming? No - we should assume the author tested their code and that the OpenAI API is stable. Asking for confirmation adds no value and just creates unnecessary back-and-forth. Delete the comment. It's partly praise (not actionable) and partly asking for confirmation (which violates our rules).
Workflow ID: wflow_vFTqlRfZhAnK1BGx
You can customize by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves #10
Important
Replaces
AI::Responseclass with aHashfor response details, updatingchat.rb,examples/02_core.rb, andREADME.mdaccordingly.AI::Responseclass with aHashfor storing response details ingenerate!()inchat.rb.examples/02_core.rbto useHashkeys instead of object attributes.README.mdto reflect changes in response handling, usingHashsyntax for accessing response details.response.rb, removing theAI::Responseclass entirely.This description was created by
for 3077189. You can customize this summary. It will automatically update as commits are pushed.