We request the agent to generate a random string, which forces it to use the code interpreter. By using the show_code_use
flag, we can see that the agent invokes the code interpreter to evaluate the Python code it generates.
## create a random id for session initiator id
session_id:str = str(uuid.uuid1())
memory_id:str = 'TST_MEM_ID'
query = "Please generate a 10 character long string of random characters"
invoke_agent_helper(query, session_id, agent_id, agent_alias_id, enable_trace=False, memory_id=memory_id, show_code_use=True)
Similarly, the agent will write Python code and invoke the code interpreter to solve a mathematical problem.
query = "What is 75 * sin(.75)?"
invoke_agent_helper(query, session_id, agent_id, agent_alias_id, enable_trace=False, memory_id=memory_id,
show_code_use=True)
On the other hand, actions where the model does not need to execute code will not invoke the code interpreter.
query = "thank you!"
invoke_agent_helper(query, session_id, agent_id, agent_alias_id, enable_trace=False, memory_id=memory_id, show_code_use=True)