Skip to content

Conversation

@ShyamSathish005
Copy link

Fixes #86

Update llm_flow to handle escaped variables correctly and prevent KeyError.

  • Instructions Handling:

    • Add _replace_escaped function to handle escaped variables in src/google/adk/flows/llm_flows/instructions.py.
    • Modify _replace_match function to differentiate between escaped and non-escaped variables.
    • Update instruction_template to process escaped variables correctly.
  • Testing:

    • Add test case in src/google/adk/tests/integration/test_context_variable.py to verify handling of escaped variables.
    • Ensure test case covers both escaped and non-escaped variables.
    • Update existing test cases to use the correct agent.

Fixes google#86

Update `llm_flow` to handle escaped variables correctly and prevent `KeyError`.

* **Instructions Handling**:
  - Add `_replace_escaped` function to handle escaped variables in `src/google/adk/flows/llm_flows/instructions.py`.
  - Modify `_replace_match` function to differentiate between escaped and non-escaped variables.
  - Update `instruction_template` to process escaped variables correctly.

* **Testing**:
  - Add test case in `src/google/adk/tests/integration/test_context_variable.py` to verify handling of escaped variables.
  - Ensure test case covers both escaped and non-escaped variables.
  - Update existing test cases to use the correct agent.
@hangfei
Copy link
Collaborator

hangfei commented Apr 16, 2025

This approach won't work and have side effects. Closing it for now.

@hangfei hangfei closed this Apr 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Variable interpretation unescapable

2 participants