Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
ToolCallResult,
)
from llama_index.core.base.llms.types import ChatResponse
from llama_index.core.bridge.pydantic import BaseModel
from llama_index.core.bridge.pydantic import BaseModel, Field
from llama_index.core.llms import ChatMessage
from llama_index.core.memory import BaseMemory
from llama_index.core.tools import AsyncBaseTool
Expand All @@ -20,6 +20,9 @@ class FunctionAgent(SingleAgentRunnerMixin, BaseWorkflowAgent):
"""Function calling agent implementation."""

scratchpad_key: str = "scratchpad"
allow_parallel_tool_calls: bool = Field(
default=True, description="If True, the agent will call multiple tools in parallel. If False, the agent will call tools sequentially."
)

async def take_step(
self,
Expand All @@ -40,7 +43,9 @@ async def take_step(
)

response = await self.llm.astream_chat_with_tools( # type: ignore
tools, chat_history=current_llm_input, allow_parallel_tool_calls=True
tools=tools,
chat_history=current_llm_input,
allow_parallel_tool_calls=self.allow_parallel_tool_calls,
)
# last_chat_response will be used later, after the loop.
# We initialize it so it's valid even when 'response' is empty
Expand Down