Enable previous_response_id chaining for internal calls on the first turn #2117
+121
−1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Relative Issue: #2020 (comment) (reported in a comment)
Relative PR: #1827
This PR enables
previous_response_idchaining during internal function calls inside the first turn, even though no realprevious_response_idexists yet.Only the first turn is special-cased; once the first real
response_idis obtained, all subsequent turns behave normally.Background
Currently,
previous_response_idchaining only enables when a real previous response ID is explicitly provided. This works fine for subsequent turns, but it has a limitation:For the first turn of a brand-new conversation, there is no existing
previous_response_id. As a result, there is no way to tell the SDK that internal function calls can useprevious_response_idchaining.Solution
Introduce a special flag value:
Setting "bootstrap" makes the internal function calls inside the first turn use proper response chaining.
Example usage:
Alternative solution
If the
"bootstrap"magic string is undesirable, an explicit parameter could be added:However, this introduces an extra API parameter solely for this niche feature and feels a little verbose.
I am open to switching to this approach if preferred.