@@ -30,7 +30,7 @@ codebase = Codebase.from_repo("fastapi/fastapi")
3030# Create the agent with GPT-4
3131agent = create_codebase_agent(
3232 codebase = codebase,
33- model_name = " gpt-4 " ,
33+ model_name = " gpt-4o " ,
3434 temperature = 0 ,
3535 verbose = True
3636)
@@ -71,28 +71,22 @@ Let's see some examples of how to interact with the agent:
7171``` python
7272# Analyze dependencies
7373result = agent.invoke(
74- {
75- " input" : " What are the dependencies of the FastAPI class?" ,
76- " config" : {" configurable" : {" session_id" : " demo" }}
77- }
74+ {" input" : " What are the dependencies of the FastAPI class?" },
75+ confeg = {" configurable" : {" session_id" : " demo" }}
7876)
7977print (result[" output" ])
8078
8179# Find usage patterns
8280result = agent.invoke(
83- {
84- " input" : " Show me examples of dependency injection in the codebase" ,
85- " config" : {" configurable" : {" session_id" : " demo" }}
86- }
81+ {" input" : " Show me examples of dependency injection in the codebase" },
82+ config = {" configurable" : {" session_id" : " demo" }}
8783)
8884print (result[" output" ])
8985
9086# Perform code analysis
9187result = agent.invoke(
92- {
93- " input" : " What's the most complex function in terms of dependencies?" ,
94- " config" : {" configurable" : {" session_id" : " demo" }}
95- }
88+ {" input" : " What's the most complex function in terms of dependencies?" },
89+ config = {" configurable" : {" session_id" : " demo" }}
9690)
9791print (result[" output" ])
9892```
@@ -106,26 +100,20 @@ The agent can also perform code changes:
106100``` python
107101# Move a function to a new file
108102result = agent.invoke(
109- {
110- " input" : " Move the validate_email function to validation_utils.py" ,
111- " config" : {" configurable" : {" session_id" : " demo" }}
112- }
103+ {" input" : " Move the validate_email function to validation_utils.py" },
104+ config = {" configurable" : {" session_id" : " demo" }}
113105)
114106
115107# Rename a class and update all references
116108result = agent.invoke(
117- {
118- " input" : " Rename the UserModel class to User and update all imports" ,
119- " config" : {" configurable" : {" session_id" : " demo" }}
120- }
109+ {" input" : " Rename the UserModel class to User and update all imports" },
110+ config = {" configurable" : {" session_id" : " demo" }}
121111)
122112
123113# Add error handling
124114result = agent.invoke(
125- {
126- " input" : " Add proper error handling to the process_data function" ,
127- " config" : {" configurable" : {" session_id" : " demo" }}
128- }
115+ {" input" : " Add proper error handling to the process_data function" },
116+ config = {" configurable" : {" session_id" : " demo" }}
129117)
130118```
131119
@@ -164,6 +152,6 @@ tools.append(CustomCodeTool())
164152agent = create_codebase_agent(
165153 codebase = codebase,
166154 tools = tools,
167- model_name = " gpt-4 "
155+ model_name = " gpt-4o "
168156)
169157```
0 commit comments