feat(chat): add ParallelToolCalls option to ChatOptions and update related functionality

- Introduced a new ParallelToolCalls field in ChatOptions to control parallel execution of tool calls.
- Updated the BuildChatCompletionRequest method to handle the new ParallelToolCalls option, ensuring it is correctly propagated in requests.
- Enhanced the streamThinkingToEventBus function to utilize the ParallelToolCalls setting.
- Added comprehensive tests to validate the behavior of ParallelToolCalls in various scenarios, ensuring correct propagation and default handling.
This commit is contained in:
wizardchen
2026-03-24 18:08:03 +08:00
committed by lyingbug
parent af2956fdf1
commit de0169d7c0
4 changed files with 138 additions and 14 deletions
+5 -3
View File
@@ -95,10 +95,12 @@ func (e *AgentEngine) streamThinkingToEventBus(
logger.Debugf(ctx, "[Agent][Thinking] Iteration-%d: temp=%.2f, tools=%d, thinking=%v",
iteration+1, e.config.Temperature, len(tools), e.config.Thinking)
parallelToolCalls := true
opts := &chat.ChatOptions{
Temperature: e.config.Temperature,
Tools: tools,
Thinking: e.config.Thinking,
Temperature: e.config.Temperature,
Tools: tools,
Thinking: e.config.Thinking,
ParallelToolCalls: &parallelToolCalls,
}
pendingToolCalls := make(map[string]bool)