-
Notifications
You must be signed in to change notification settings - Fork 118
Difficult to Follow the Code Along with the Book Chapter 4 #16
Description
Hi,
After you read the issue feel free to close the it. My goal to read the book was to read the book and code as well my self. But the code snippet is incomplete in the book and evolved in the git repository. Which made it difficult to follow along with the book. I do not mind the book being large. Even if that is the case that it was required to make the book small then the code repository should have been tagged with versions. For example first chapter with tag v0.0.1 ... Just giving an example. I start reading agent First agent base class section 4.2.2 BaseAgent Listing 4.3 and 4.4 with the following code:
“class BaseAgent(ABC):
"""Abstract base class defining the core agent interface."""
def __init__(
self,
name: str,
instructions: str,
model_client: 'BaseChatCompletionClient',
tools: Optional[List] = None,
memory: Optional['BaseMemory'] = None,
context: Optional['AgentContext'] = None,
middleware: Optional[List] = None,
max_iterations: int = 10
):
self.name = name
self.instructions = instructions
self.model_client = model_client
# Process optional components with defaults
self.tools = self._process_tools(tools or [])
self.memory = memory
self.context = context or AgentContext()
self.middleware_chain = MiddlewareChain(
middleware or []
)
...There is no import of ABC, abstractmethod, I do not know where AgentContext() , MiddlewareChain(middleware or []) comes from.
IN the listing 4.6 when creating BaseChatCompletionClient created ABC and abstractmethod imported correctly.
When I checked the code repo _base.py It looks so different than actual base agent code from the book.
Am I reading the book wrong way. I am not interested to import code from pico agent and run it by My goal was to understand how pico agent is being created and how can I create one. But for now I do not see my goal will be reached by continuing to read this book.
Please provide any recommendation you have how best this book should be read or it is required to make some update to this book. This is the foundation chapter, If someone loose interest after reading this chapter probably won't continue to read the rest. The book is still excellent but I would like to see it as one of the top best.
Also something about the flow of the chapter 4. Agent depends on Chat Client, Messages Tools and other stuff then They should be build first and then when agent requirements are fullfilled then we should initialise the base agent. Middleware and other minor stuff could be left for later but the major dependency of agent should be created first then Agent base should be created that's my opinion.
Thanks