Fix effective_context variable scope and calculate total tokens for streaming responses
- Pass effective_context as parameter to stream_generator functions - Update _create_streaming_response signature to accept effective_context - Update all calls to _create_streaming_response to pass effective_context - Track accumulated response text for token counting in streaming - Calculate completion tokens for Google responses (since Google doesn't provide them) - Calculate completion tokens for non-Google providers when they don't provide token counts - Include prompt_tokens, completion_tokens, total_tokens, and effective_context in final chunk - Fixes 'name effective_context is not defined' error in streaming responses - Fixes issue where streaming responses had null token counts
Showing
This diff is collapsed.
Please
register
or
sign in
to comment