Skip to content

Commit

Permalink
Fix logging
Browse files Browse the repository at this point in the history
  • Loading branch information
svilupp authored Sep 22, 2024
1 parent 826fceb commit 76b528d
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Fixed

## [0.56.1]

### Fixed
- Removed accidental INFO log in Anthropic's `aigenerate`
- Changed internal logging in `streamcallback` to use `@debug` when printing raw data chunks.

## [0.56.0]

### Updated
Expand Down
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "PromptingTools"
uuid = "670122d1-24a8-4d70-bfce-740807c42192"
authors = ["J S @svilupp and contributors"]
version = "0.56.0"
version = "0.56.1"

[deps]
AbstractTrees = "1520ce14-60c1-5f80-bbc7-55ef81b5835c"
Expand Down
1 change: 0 additions & 1 deletion src/llm_anthropic.jl
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,6 @@ function aigenerate(
prompt_schema, prompt; no_system_message, aiprefill, conversation, cache, kwargs...)

if !dry_run
@info conv_rendered.conversation
time = @elapsed resp = anthropic_api(
prompt_schema, conv_rendered.conversation; api_key,
conv_rendered.system, endpoint = "messages", model = model_id, streamcallback, http_kwargs, cache,
Expand Down
5 changes: 3 additions & 2 deletions src/streaming.jl
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ For more complex use cases, you can define your own `callback`. See the interfac
- `out`: The output stream, eg, `stdout` or a pipe.
- `flavor`: The stream flavor which might or might not differ between different providers, eg, `OpenAIStream` or `AnthropicStream`.
- `chunks`: The list of received `StreamChunk` chunks.
- `verbose`: Whether to print verbose information.
- `verbose`: Whether to print verbose information. If you enable DEBUG logging, you will see the chunks as they come in.
- `throw_on_error`: Whether to throw an error if an error message is detected in the streaming response.
- `kwargs`: Any custom keyword arguments required for your use case.
Expand Down Expand Up @@ -458,7 +458,8 @@ function streamed_request!(cb::AbstractStreamCallback, url, headers, input; kwar
cb.flavor, masterchunk; verbose, spillover, cb.kwargs...)

for chunk in chunks
verbose && @info "Chunk Data: $(chunk.data)"
## Note you must have debug logging enabled to see this
verbose && @debug "Chunk Data: $(chunk.data)"
## look for errors
handle_error_message(chunk; cb.throw_on_error, verbose, cb.kwargs...)
## look for termination signal, but process all remaining chunks first
Expand Down

2 comments on commit 76b528d

@svilupp
Copy link
Owner Author

Choose a reason for hiding this comment

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

@JuliaRegistrator register

Fixed

  • Removed accidental INFO log in Anthropic's aigenerate
  • Changed internal logging in streamcallback to use @debug when printing raw data chunks.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

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

Registration pull request created: JuliaRegistries/General/115683

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.56.1 -m "<description of version>" 76b528d7241fefb0c1a6c183460311c7de4d12b4
git push origin v0.56.1

Please sign in to comment.