-
Notifications
You must be signed in to change notification settings - Fork 88
Open
Labels
Description
TODO subtract length of rest of prompt
AutoPR/autopr/actions/prompt.py
Lines 60 to 70 in 1d818f4
| def build_prompt_and_instructions(self, inputs: Inputs) -> tuple[str, str]: | |
| # Build prompt | |
| prompt_elements = [] | |
| if inputs.prompt_context: | |
| # TODO subtract length of rest of prompt | |
| prompt_elements.append( | |
| str( | |
| trim_context( | |
| inputs.prompt_context, | |
| inputs.max_prompt_tokens, |
AutoPR/autopr/actions/choice.py
Lines 57 to 67 in 1d818f4
| choices_bullet_points = "\n".join(f"- {choice}" for choice in inputs.choices) | |
| # Build prompt | |
| prompt_elements = [] | |
| if inputs.prompt_context: | |
| # TODO subtract length of rest of prompt | |
| prompt_elements.append( | |
| str( | |
| trim_context( | |
| inputs.prompt_context, | |
| inputs.max_prompt_tokens, |
To resolve this TODO, you can start by calculating the length of the rest of the prompt. Then, subtract that length from the total length of the prompt to get the desired result. Make sure to handle any edge cases or error scenarios that may arise.