Cookbook \ Instructor \ Basics
Using LLM API connection presets from config file
Overview
Instructor allows you to define multiple API connection presets in llm.php
file.
This is useful when you want to use different LLMs or API providers in your application.
Connecting to LLM API via predefined connection is as simple as calling withPreset
method with the preset name.
Configuration file
Default LLM configuration file is located in /config/llm.php
in the root directory
of Instructor codebase.
You can set the location of the configuration file via INSTRUCTOR_CONFIG_PATH
environment
variable. You can use a copy of the default configuration file as a starting point.
LLM config file defines available connection presets to LLM APIs and their parameters. It also specifies the default provider and parameters to be used when calling Instructor.