Skip to content

Fix handling of escaped variables in llm_flow #90

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed

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