Performance: OpenAI functions agent
MEDIUM IMPACT
This concept affects the responsiveness and latency of AI-driven interactions by managing how function calls are integrated and executed within the agent workflow.
agent = OpenAIFunctionsAgent(llm=llm, functions=selected_functions, verbose=True) response = await agent.arun(user_input) # Functions are filtered and loaded asynchronously only when needed
agent = OpenAIFunctionsAgent(llm=llm, functions=all_functions, verbose=True) response = agent.run(user_input) # All functions loaded and checked on every call synchronously
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Synchronous function calls on every input | Minimal | 0 | Low | [X] Bad |
| Asynchronous selective function calls | Minimal | 0 | Low | [OK] Good |