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

[Merged by Bors] - fix: minor prompt optimizations (LLM-001) #516

Closed
wants to merge 2 commits into from

Conversation

DecathectZero
Copy link
Member

Mono-chunking:
we now combine all the fetched chunks into one single blob of text.
context: ${chunk1}\n${chunk2}....

This has the added benefit of:
less tokens (just barely)
less reference, ("based on document 1, ....", "based on the provided references, ....")

Time Stamp injection:
https://www.notion.so/voiceflow/v3-KB-Optimization-Prompts-24a947d158fc43af8adeead21a6211c0?pvs=4#ffed22a3847c43b59e9e4f532ea05645
We now provide it with the time

AI Restrictions:
https://www.notion.so/voiceflow/v3-KB-Optimization-Prompts-24a947d158fc43af8adeead21a6211c0?pvs=4#eb1166b77cab443fb494c49b837598c5
GPT-3 is more liberal and can answer more things.

Comment on lines 56 to 59
const output = response.output?.trim().toUpperCase();

if (output?.includes('UNKNOWN') || output?.startsWith("I'M SORRY,") || output?.includes('AS AN AI'))
return { ...response, output: null };
Copy link
Member Author

Choose a reason for hiding this comment

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

AI restrictions

Copy link
Contributor

Choose a reason for hiding this comment

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

"unknown" may still be present in a valid response:

Q: Who is D.B. Cooper?
A: D.B. was an unknown man who stole money from a plane.

Copy link
Member Author

@DecathectZero DecathectZero May 15, 2023

Choose a reason for hiding this comment

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

okay we can swap it back to NOT_FOUND, the main thing is it that it needs to sound somewhat natural to the model for better results


const options = { model, system: systemWithTime, temperature, maxTokens };

const context = data.chunks.map(({ originalText }) => originalText).join('\n');
Copy link
Member Author

Choose a reason for hiding this comment

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

monolith-chunking

@DecathectZero
Copy link
Member Author

bors r+

bors-vf bot pushed a commit that referenced this pull request May 15, 2023
Mono-chunking:
we now combine all the fetched chunks into one single blob of text.
`context: ${chunk1}\n${chunk2}`....

This has the added benefit of: 
less tokens (just barely) 
less reference, ("based on document 1, ....", "based on the provided references, ....")

Time Stamp injection:
https://www.notion.so/voiceflow/v3-KB-Optimization-Prompts-24a947d158fc43af8adeead21a6211c0?pvs=4#ffed22a3847c43b59e9e4f532ea05645
We now provide it with the time

AI Restrictions:
https://www.notion.so/voiceflow/v3-KB-Optimization-Prompts-24a947d158fc43af8adeead21a6211c0?pvs=4#eb1166b77cab443fb494c49b837598c5
GPT-3 is more liberal and can answer more things.

Co-authored-by: Tyler Han <tylerhan97@gmail.com>
@sonarcloud
Copy link

sonarcloud bot commented May 15, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

8.7% 8.7% Coverage
0.0% 0.0% Duplication

@bors-vf
Copy link

bors-vf bot commented May 15, 2023

@bors-vf bors-vf bot changed the title fix: minor prompt optimizations (LLM-001) [Merged by Bors] - fix: minor prompt optimizations (LLM-001) May 15, 2023
@bors-vf bors-vf bot closed this May 15, 2023
@bors-vf bors-vf bot deleted the tyler/prompt-optimization/LLM-001 branch May 15, 2023 16:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants