-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
Issue #315: Display full completion in CLI #1068
base: main
Are you sure you want to change the base?
Conversation
@backus is this what you were looking for? |
Any news on this one? |
@gooroodev please review |
Thank you, @admsev, for involving me! 1. Summary of ChangesThe pull request introduces the following changes:
2. Issues, Bugs, or TyposIssue 1: Unnecessary WhitespaceIn the Current Code: help="""What sampling temperature to use. Higher values means the model will take more risks. Try 0.9 for more creative applications, and 0 (argmax sampling) for ones with a well-defined answer.
Mutually exclusive with `top_p`.""", Improved Code: help="""What sampling temperature to use. Higher values means the model will take more risks. Try 0.9 for more creative applications, and 0 (argmax sampling) for ones with a well-defined answer. Mutually exclusive with `top_p`.""", Issue 2: Import for
|
|
||
# If verbose output requested, print the entire completion | ||
if verbose_output: | ||
sys.stdout.write(completion.model_dump_json(indent=2)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sys.stdout.write(completion.model_dump_json(indent=2)) | |
sys.stdout.write(completion.to_json()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the time spent on this contribution, and for the patience on review!
I think --json
would be a better flag than --verbose
for this (I'd expect the latter to display more diagnostic information, while --json
should produce only JSON to stdout, so it can be piped to other programs like jq
.
Furthermore, this flag should work for all requests, not just chat completions.
Description
This PR addresses issue #315. The idea is introducing a new
--verbose
flag to the CLI to display the entire completion response.Implementation
--verbose
to CLICLIChatCompletionCreateArgs
verbose_output
flag to static method_create
Caveats
Since
verbose
is not achat.completions.create
argument, we can't pass it toCompletionCreateParams
. In my opinion it seems ok to have a flag for now, but I'm sure there's a cleaner way of doing it in the future if new args are introduced that aren't parameters for completions endpoint.Notes
Do we want this for
_stream_create
?Thanks in advance 😀 @RobertCraigie