Gain insights into how tool calling transforms interactions with LLMs, enabling structured outputs like dictionaries for enhanced API interaction, code execution, and JSON object creation.
Before you begin, ensure you have met the following requirements:
- You have installed Python 3.6+.
First, clone the repository to your local machine using the following command:
git clone [repository-url]
cd [repository-name]
Create a virtual environment using venv
:
python3 -m venv venv
Activate the virtual environment:
- On Windows:
venv\Scripts\activate
- On MacOS/Linux:
source venv/bin/activate
Install the required packages using pip
:
pip install -r requirements.txt
Create a .env
file in the root directory of the project. Use the .env.sample
file as a reference:
cp .env.sample .env
Open the .env
file and update the key values as necessary.
Run the environment setup script:
python3 setup_env.py
To run any in-class examples, execute the specific file directly from the command line. For example:
python3 in_class_examples/openai_function_call.py
To use any tools inside the tool_lib, you need to attach them to an agent. Follow these steps:
-
Copy the Function from
tool_lib
to Your Agent Script. -
Annotate the copied function with the
@tool
decorator. -
Add the annotated function to your agent's toolkit.
-
Bind the toolkit to the agent executor to make the tool available for use within the agent's workflow.