Instructor Cookbooks¶
-
Text Processing
Extract structured information from text documents
-
Multi-Modal
Work with images and other media types
-
Data Tools
Integrate with databases and data processing tools
-
Deployment
Options for local and cloud deployment
Our cookbooks demonstrate how to use Instructor to solve real-world problems with structured outputs. Each example includes complete code and explanations to help you implement similar solutions in your own projects.
Text Processing¶
Classification Examples¶
| Example | Description | Use Case |
|---|---|---|
| Single Classification | Basic classification with a single category | Content categorization |
| Multiple Classification | Handling multiple classification categories | Multi-label document tagging |
| Enum-Based Classification | Using Python enums for structured classification | Standardized taxonomies |
| Batch Classification | Process multiple items efficiently | High-volume text processing |
| Batch Classification with LangSmith | Using LangSmith for batch processing | Performance monitoring |
| Local Classification | Classification without external APIs | Offline processing |
Information Extraction¶
| Example | Description | Use Case |
|---|---|---|
| Entity Resolution | Identify and disambiguate entities | Name standardization |
| Contact Information | Extract structured contact details | CRM data entry |
| PII Sanitization | Detect and redact sensitive information | Privacy compliance |
| Citation Extraction | Accurately extract formatted citations | Academic research |
| Action Items | Extract tasks from text | Meeting follow-ups |
| Search Query Processing | Structure complex search queries | Search enhancement |
Document Processing¶
| Example | Description | Use Case |
|---|---|---|
| Document Segmentation | Divide documents into meaningful sections | Long-form content analysis |
| Planning and Tasks | Break down complex queries into subtasks | Project management |
| Knowledge Graph Generation | Create relationship graphs from text | Information visualization |
| Knowledge Graph Building | Build and query knowledge graphs | Semantic data modeling |
| Chain of Density | Implement iterative summarization | Content distillation |
Multi-Modal Examples¶
Vision Processing¶
| Example | Description | Use Case |
|---|---|---|
| Table Extraction | Convert image tables to structured data | Data entry automation |
| Table Extraction with GPT-4 | Advanced table extraction | Complex table processing |
| Receipt Information | Extract data from receipt images | Expense management |
| Slide Content Extraction | Convert slides to structured text | Presentation analysis |
| Image to Ad Copy | Generate ad text from images | Marketing automation |
| YouTube Clip Analysis | Extract info from video clips | Content moderation |
Multi-Modal Processing¶
| Example | Description | Use Case |
|---|---|---|
| Gemini Multi-Modal | Process text, images, and other data | Mixed-media analysis |
Data Tools¶
Database Integration¶
| Example | Description | Use Case |
|---|---|---|
| SQLModel Integration | Store AI-generated data in SQL databases | Persistent storage |
| Pandas DataFrame | Work with structured data in Pandas | Data analysis |
Streaming and Processing¶
| Example | Description | Use Case |
|---|---|---|
| Partial Response Streaming | Stream partial results in real-time | Interactive applications |
| Self-Critique and Correction | Implement self-assessment | Quality improvement |
API Integration¶
| Example | Description | Use Case |
|---|---|---|
| Content Moderation | Implement content filtering | Trust & safety |
| Cost Optimization with Batch API | Reduce API costs | Production efficiency |
| Few-Shot Learning | Use contextual examples in prompts | Performance tuning |
Observability & Tracing¶
| Example | Description | Use Case |
|---|---|---|
| Langfuse Tracing | Open-source LLM engineering | Observability & Debugging |
Deployment Options¶
Model Providers¶
| Example | Description | Use Case |
|---|---|---|
| Groq Cloud API | High-performance inference | Low-latency applications |
| Mistral/Mixtral Models | Open-source model integration | Cost-effective deployment |
| IBM watsonx.ai | Enterprise AI platform | Business applications |
Local Deployment¶
| Example | Description | Use Case |
|---|---|---|
| Ollama Integration | Local open-source models | Privacy-focused applications |
Stay Updated¶
Subscribe to our newsletter for updates on new features and usage tips:
Looking for more structured learning? Check out our Tutorial series for step-by-step guides.