-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating
AI Agents in Practice
By :
This category refers to logic that is explicitly defined by the developer, either through traditional programming constructs (hardcoded logic) or using natural language descriptions (semantic functions).
Hardcoded functions are traditional pieces of logic implemented in code. They are deterministic and task-specific, meaning they do exactly what the developer tells them to do. These functions are ideal for simple utilities, calculations, formatting, or business rules that don’t require external APIs or learning.
For example, we could have a tool to convert the temperature from Celsius to Fahrenheit:
def convert_celsius_to_fahrenheit(celsius: float) -> float:
return (celsius * 9/5) + 32
We can wrap this function as a tool for our AI agent by adding two additional ingredients: name and description. Among the various methods we have to do that, we can leverage LangChain’...