Instructor Text Agent
The InstructorTextAgent
is designed to process text inputs and extract structured data.
Currently Instructor Agents only work with OpenAI models.
Initialization
Parameters
The InstructorTextAgent
is initialized with two arguments:
Specifies the structure of the data that the OpenAI API is expected to return. This structured model helps in parsing and validating the data returned from the API, ensuring it adheres to the expected format.
This parameter expects a class that is a subclass of BaseModel
from the pydantic
library.
Specifies the model identifier used by the OpenAI API to process the image. The default value is "gpt-4o"
.
You can find a comprehensive list of all OpenAI API models here.
Execution
Parameters
The Workflow
is expected to have some sort of text input that needs to be processed.
Example
Here is an example of the InstructorTextAgent
as part of a Workflow
for counting vehicles.
Step 1. Define a response_model
.
This model expects the analysis to return the counts of different types of vehicles and a timestamp indicating the time of the image capture.
Step 2. Use InstructorTextAgent
.