followupquestionbuilder
codebolt.codeboltutils.FollowUpQuestionBuilder(): InferenceParamsCreates the next prompt for the AI agent by incorporating previous conversation, tool results, and summarizing long interactions when needed.
Example
const codebolt = require('@codebolt/codeboltjs').default;
const { FollowUpPromptBuilder } = require("@codebolt/codeboltjs/utils");
const followUpBuilder = new FollowUpQuestionBuilder(codebolt);
const nextPrompt = await followUpBuilder
.addPreviousConversation(previousPrompt)
.addToolResult(toolResults)
.checkAndSummarizeConversationIfLong()
.buildInferenceParams();
Methods
The FollowUpQuestionBuilder class provides the following chainable methods:
addPreviousConversation(previousPrompt): Adds the previous conversation context to the new promptaddToolResult(toolResults): Incorporates tool execution results into the promptcheckAndSummarizeConversationIfLong(): Automatically summarizes the conversation if it becomes too longbuildInferenceParams(): Builds and returns the final inference parameters for the next AI interaction
Usage Notes
- All methods return the FollowUpQuestionBuilder instance, allowing for method chaining
- The constructor requires a
codeboltparameter - Use this class to maintain conversation context across multiple AI interactions
- The summarization feature helps manage long conversations by condensing previous interactions
- The final
buildInferenceParams()method returns anInferenceParamsobject ready for the next LLM call