# Summary of Function Calling with Instructor Library ## Overview - The Instructor library simplifies function calling for data extraction. - It works with [[OpenAI|GPT]] models, including GPT-3.5 Turbo and GPT-4. - Instructor uses the [[Pydantic|Pydantic]] library to define data structures. - Data can be extracted, validated, and saved to CSV using [[Pandas|Pandas]]. ## Capabilities - Extracts structured data from text without complex function definitions. - Validates output to prevent objectionable content and handle errors. - Supports retries for error handling. - Allows for easy JSON output and data parsing. ## Usage - Requires installation of Pydantic and Instructor. - Define data structures with Pydantic classes. - Use `Instructor.patch` to integrate with OpenAI completions. - Define response models to structure the data extracted from the AI's responses. ## Examples - Extracting name and age from a text snippet. - Extracting pyramid details from a text file. - Defining data frames and saving them as CSV files. - Using Pydantic for data validation and structure definition. ## Additional Information - Code files available for free on the creator's Patreon. - More complex examples and exclusive videos for patrons. - Website with searchable content and code downloads for patrons. ## Pydantic - A Python library for data validation and settings management. - Ensures data fits a certain structure and is parsable. - Useful for validating user input, like emails and passwords. ## Conclusion - Instructor and Pydantic simplify the process of function calling with AI models. - They reduce the complexity of data extraction and validation. - The creator provides resources and support through Patreon and a dedicated website.