Skip to content
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

refactor: work on minimizing grounding prompt #4

Merged
merged 3 commits into from
Jan 6, 2025
Merged

Conversation

peternhale
Copy link
Contributor

@W-17432376@
refactored a bit of code into utils
worked on reducing grounding prompt size.

@W-17432376@
refactored a bit of code into utils
worked on reducing grounding prompt size.
@peternhale peternhale requested a review from daphne-sfdc January 3, 2025 22:21
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for changing sendApexPromptToLLM.ts to use the cleanupYaml() helper function.

I realized that the same change can be applied to this file sendRawPromptToLLM.ts. Lines 96-107 can be replaced with a call to cleanupYaml(). 🙂

@@ -110,25 +110,13 @@ const buildPromptAndCallLLM = async (systemPrompt: string, userPrompt: string, c
}

input +=
`\n\`\`\`\n${endOfPromptTag}\n${assistantTag}`;
`\n\`\`\`\n${endOfPromptTag}\n${assistantTag}\n`;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow, a newline makes a big difference here at the end of the prompt! Now that the newline is added, I am able to generate OpenAPI v3 specifications from Apex classes without getting any errors.

Copy link
Collaborator

@daphne-sfdc daphne-sfdc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for this great system prompt consolidation and code refactoring @peternhale! Now we have gotten back some additional tokens for the context. 🙂

@peternhale peternhale merged commit 301b142 into main Jan 6, 2025
1 check passed
@peternhale peternhale deleted the phale/grounding branch January 6, 2025 16:46
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.

2 participants