Two bugs in src/rosa/rosa.py:
Bug 1: _print_usage renders rich markup as literal text
The method uses plain print() with rich markup:
print(f"[bold]Prompt Tokens:[/bold] {cb.prompt_tokens}")
Standard print() does not interpret rich markup. With show_token_usage=True, the output literally prints [bold]Prompt Tokens:[/bold] 100 instead of formatted text. It should use rich.console.Console.print() to render the markup.
Bug 2: astream accumulates tokens with a spurious leading space
final_output += f" {content}"
This prepends a space before every token. When final_output is used as the fallback (no chain_output from on_chain_end), the recorded string starts with a leading space and has an extra space between every token. It should be: final_output += content
I am working on a patch for both issues and will open a pull request.
Two bugs in src/rosa/rosa.py:
Bug 1: _print_usage renders rich markup as literal text
The method uses plain print() with rich markup:
Standard print() does not interpret rich markup. With show_token_usage=True, the output literally prints [bold]Prompt Tokens:[/bold] 100 instead of formatted text. It should use rich.console.Console.print() to render the markup.
Bug 2: astream accumulates tokens with a spurious leading space
This prepends a space before every token. When final_output is used as the fallback (no chain_output from on_chain_end), the recorded string starts with a leading space and has an extra space between every token. It should be: final_output += content
I am working on a patch for both issues and will open a pull request.