Skip to content

Add verbosity argument to req_peform_connection()#632

Merged
hadley merged 9 commits intomainfrom
resp-stream-verbosity
Jan 10, 2025
Merged

Add verbosity argument to req_peform_connection()#632
hadley merged 9 commits intomainfrom
resp-stream-verbosity

Conversation

@hadley
Copy link
Member

@hadley hadley commented Jan 6, 2025

Fixes #599

  • Check that output looks good with ellmer

if (include_trailer && length(buffer) > 0) {
return(buffer)
} else {
if (length(buffer) == 0) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jcheng5 I don't think I've changed the logic here, just tweaked it a bit so we can warn when we get an unexpected end of input.

if (include_trailer) {
return(buffer)
} else {
cli::cli_warn("Premature end of input; ignoring final partial chunk")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it make sense to log the buffer here, under certain verbosity levels?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think that's likely to be useful? i.e. going from raw bytes to understand what's gone wrong seems like it will be a challenge.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if we just enabled print_buffer() when verbosity >= 3?

@hadley hadley merged commit 0ee28a6 into main Jan 10, 2025
13 checks passed
@hadley hadley deleted the resp-stream-verbosity branch January 10, 2025 16:14
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.

Make resp_stream_*() respect verbosity

2 participants