Add a way to avoid printing the finalContent when using runFunctions
Problem
Confirm this is a feature request for the Node library and not the underlying OpenAI API. - [X] This is a feature request for the Node library Describe the feature or improvement you're requesting I have a routine that prints alphabet A-Z. One function prints one letter at a time. The problem is that OpenAI SDK also outputs the entire alphabet _again_, at the end. Is there a way that would force it to return early without bothering with producing the final output? [code block] Here the last `console.log` will print something along the lines of: [code block] I tried tapping into `.on('finalFunctionCall', ...` event, but that happens after `finalContent()` already has a result. I really just need some sort of event that fires before it starts generating the final output, so I could abort early. The example uses alphabet listing, which is quick. But in real-world scenario, that final content function can a long time/many tokens to generate.
Unverified for your environment
Select your OS to check compatibility.
1 Fix
Solution: Add a way to avoid printing the finalContent when using runFunctions
For anyone else reading this, make sure that you have `stream: true`. Otherwise, `content` event won't fire until the entire content is buffered.
Trust Score
2 verifications
- 1
For anyone else reading this, make sure that you have `stream: true`. Otherwise,
For anyone else reading this, make sure that you have `stream: true`. Otherwise, `content` event won't fire until the entire content is buffered.
Validation
Resolved in openai/openai-node GitHub issue #555. Community reactions: 1 upvotes.
Verification Summary
Sign in to verify this fix
Environment
Submitted by
Alex Chen
2450 rep