Change8

v1.12.0

📦 instructorView on GitHub →
6 features🐛 9 fixes2 deprecations🔧 10 symbols

Summary

This release introduces enhanced retry tracking, per-call hooks, and xAI streaming support while fixing critical bugs in OpenAI JSON mode and Gemini response handling. It also marks the transition from validation_context to a unified context parameter.

Migration Steps

  1. Update code to use the 'context' parameter instead of 'validation_context' in validation logic.
  2. If using Gemini, ensure 'thinking_config' is only used within 'GenerateContentConfig'.
  3. If using OpenRouter, explicitly set 'async_client=False' if using the synchronous client as per updated documentation.

✨ New Features

  • Added mkdocs-llmstxt plugin and llms.txt support.
  • Enhanced retry logic with comprehensive tracking of all failed attempts and exceptions.
  • Added support for hook combination and per-call hooks.
  • Propagated failed attempts through reask handlers.
  • Added streaming support for the xAI provider.
  • Improved Cohere V2 API version detection.

🐛 Bug Fixes

  • Restored multimodal import compatibility.
  • Generalized tool call parsing for reasoning models.
  • Fixed OpenAI reask functionality broken in JSON mode since v1.9.0.
  • Removed duplicate schema from messages in JSON_SCHEMA mode for OpenAI.
  • Handled Anthropic tool_use retries on ValidationError.
  • Fixed Gemini chunk.text ValueError when finish_reason=1.
  • Fixed Bedrock OpenAI models response parsing where reasoning appears before text.
  • Fixed Python 3.13 compatibility and import path corrections.
  • Fixed parse error hook emission issues.

🔧 Affected Symbols

instructor.hooksinstructor.retryinstructor.clientGenerateContentConfigvalidation_contextcontexthandle_genai_toolsxAICohereBedrock

⚡ Deprecations

  • The 'validation_context' parameter is deprecated in favor of the 'context' parameter.
  • The 'gpt-3.5-turbo-0613' model reference has been replaced with 'gpt-4o-mini' in internal logic/examples.