Add runtime extra instruction files to pvmap generator prompt#1972
Add runtime extra instruction files to pvmap generator prompt#1972rohitkumarbhagat wants to merge 1 commit intodatacommonsorg:masterfrom
Conversation
… PVMap generation prompt
There was a problem hiding this comment.
Code Review
This pull request introduces the ability to provide extra instruction files to the Gemini agent during the PVMap generation process. It includes new configuration flags, validation logic for file size and encoding, and updates to the prompt template to incorporate these instructions. Feedback was provided regarding the enforcement of working directory boundaries for these extra files to ensure they are accessible when sandboxing is enabled.
| def _validate_extra_instruction_file(self, path: str) -> Path: | ||
| """Resolve and validate an extra instruction file.""" | ||
| resolved_path = self._resolve_path(path) |
There was a problem hiding this comment.
The _validate_extra_instruction_file method uses _resolve_path which allows files outside the working directory. However, if enable_sandboxing is set to True (which is the default on macOS), the Gemini agent running in the sandbox will likely be restricted to the working directory and will fail to read these extra instruction files at runtime.
To ensure the agent can actually access these files, consider enforcing the same working directory boundary as input_data and input_metadata by using _validate_and_convert_path instead of _resolve_path.
| def _validate_extra_instruction_file(self, path: str) -> Path: | |
| """Resolve and validate an extra instruction file.""" | |
| resolved_path = self._resolve_path(path) | |
| def _validate_extra_instruction_file(self, path: str) -> Path: | |
| """Resolve and validate an extra instruction file.""" | |
| resolved_path = self._validate_and_convert_path(path) |
There was a problem hiding this comment.
pls check if Gemini suggestion for sandbox mode should be supported
| file_size = resolved_path.stat().st_size | ||
| max_bytes = self._config.extra_instruction_max_bytes | ||
| if file_size > max_bytes: | ||
| raise ValueError( |
There was a problem hiding this comment.
can we truncate file with a warning rather than terminate program or in future summarize the file to fit in size threshold?
Summary
--extra_instruction_filesand--extra_instruction_max_bytestopvmap_generator.py