From 2d734d67c66dc1ba2399a93fc2f4d862e0d5ea4f Mon Sep 17 00:00:00 2001 From: sfkrieger Date: Mon, 11 Aug 2025 11:09:21 -0700 Subject: [PATCH] fix(docs): update Windows encoding note for LiteLLM to improve clarity --- docs/agents/models.md | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/docs/agents/models.md b/docs/agents/models.md index 5ccf04b44..b14ecc052 100644 --- a/docs/agents/models.md +++ b/docs/agents/models.md @@ -315,22 +315,19 @@ layer, providing a standardized, OpenAI-compatible interface to over 100+ LLMs. ) ``` -!!!info "Note for Windows users" +!!!warning "Windows Encoding Note for LiteLLM" + + When using ADK agents with LiteLLM on Windows, you might encounter a `UnicodeDecodeError`. This error occurs because LiteLLM may attempt to read cached files using the default Windows encoding (`cp1252`) instead of UTF-8. + + To prevent this, we recommend setting the `PYTHONUTF8` environment variable to `1`. This forces Python to use UTF-8 for all file I/O. - ### Avoiding LiteLLM UnicodeDecodeError on Windows - When using ADK agents with LiteLlm on Windows, users might encounter the following error: - ``` - UnicodeDecodeError: 'charmap' codec can't decode byte... - ``` - This issue occurs because `litellm` (used by LiteLlm) reads cached files (e.g., model pricing information) using the default Windows encoding (`cp1252`) instead of UTF-8. - Windows users can prevent this issue by setting the `PYTHONUTF8` environment variable to `1`. This forces Python to use UTF-8 globally. **Example (PowerShell):** ```powershell - # Set for current session + # Set for the current session $env:PYTHONUTF8 = "1" + # Set persistently for the user [System.Environment]::SetEnvironmentVariable('PYTHONUTF8', '1', [System.EnvironmentVariableTarget]::User) - Applying this setting ensures that Python reads cached files using UTF-8, avoiding the decoding error. ```