"usage" field missing, then we crash and the error is due to we want to read nothing value.#296
Open
Cvikli wants to merge 1 commit intosvilupp:mainfrom
Open
"usage" field missing, then we crash and the error is due to we want to read nothing value.#296Cvikli wants to merge 1 commit intosvilupp:mainfrom
Cvikli wants to merge 1 commit intosvilupp:mainfrom
Conversation
Owner
|
Do you have some MWE to get this fail? I remember Tamas asking for some changes in the StreamingCallbacks in this vein, but we could never replicate it. |
Author
|
It was totally random. It can be even issue on the other side. Not sure how to replicate. Actually happened during a workflow. And I couldn't get actually any data from the case as it actually fails before we could get any data. :D |
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.
We have to handle the case where there is no "usage" field.
I don't know if my solution the the best way, but it spare the immediate error, so we can handle the issue somehow else.
What we got due to the error:
┌ Error: Task failed
│ exception =
│ MethodError: no method matching getindex(::Nothing, ::Symbol)
│ The function
getindexexists, but no method is defined for this combination of argument types.└ @ TODO4AI ~/repo/todoforai/agent/src/interfaces/clientAPI/handlers_agent.jl:109
Stacktrace:
[1] aigenerate(prompt_schema::PromptingTools.AnthropicSchema, prompt::Vector{PromptingTools.AbstractChatMessage}; verbose::Bool, api_key::String, model::String, return_all::Bool, dry_run::Bool, conversation::Vector{PromptingTools.AbstractMessage}, streamcallback::StreamCallbacksExt.StreamCallbackWithHooks, no_system_message::Bool, aiprefill::Nothing, http_kwargs::@NamedTuple{}, api_kwargs::@NamedTuple{top_p::Float64, temperature::Float64, max_tokens::Int64, stop_sequences::Vector{String}}, cache::Symbol, betas::Nothing, kwargs::@kwargs{}) @ PromptingTools ~/.julia/packages/PromptingTools/XSraD/src/llm_anthropic.jl:520
[2] aigenerate(prompt::Vector{PromptingTools.AbstractChatMessage}; model::String, kwargs::@kwargs{cache::Symbol, api_kwargs::@NamedTuple{top_p::Float64, temperature::Float64, max_tokens::Int64, stop_sequences::Vector{String}}, streamcallback::StreamCallbacksExt.StreamCallbackWithHooks, verbose::Bool}) @ PromptingTools ~/.julia/packages/PromptingTools/XSraD/src/llm_interface.jl:511
[3] work(agent::EasyContext.FluidAgent{EasyContext.SysMessageV1}, conv::EasyContext.Session{EasyContext.Message}; cache::Symbol, no_confirm::Bool, highlight_enabled::Bool, process_enabled::Bool, on_error::Function, on_done::typeof(EasyContext.noop), on_start::Function, io::TODO4AI.TodoIOWrapper, tool_kwargs::Dict{String, String}, thinking::Nothing, MAX_NUMBER_OF_TOOL_CALLS::Int64) @ EasyContext ~/repo/EasyContext.jl/src/agents/FluidAgent.jl:171
Or what would be the best way to handle these cases?