v1.15.1
📦 instructorView on GitHub →
✨ 2 features🐛 9 fixes🔧 15 symbols
Summary
This release significantly enhances security by blocking remote URL fetching in Bedrock and PDF processing, alongside numerous bug fixes across Anthropic, OpenRouter, and Bedrock integrations. New keyword arguments were added to completion error hooks.
✨ New Features
- Added `completion:error` and `completion:last_attempt` hook handlers to receive `attempt_number`, `max_attempts`, and `is_last_attempt` as keyword arguments.
- Added `User-Agent: instructor/<version>` header to the Anthropic client when initialized via `from_provider("anthropic/...")`.
🐛 Bug Fixes
- Blocked remote HTTP(S) image URL fetching in `_openai_image_part_to_bedrock`; only `data:` URLs are accepted.
- Blocked remote URL and local file fetching in `PDF.to_bedrock`; only base64 data or `s3://` sources are supported.
- Correctly initialized usage for `ANTHROPIC_REASONING_TOOLS` and `ANTHROPIC_PARALLEL_TOOLS` modes.
- Switched OpenRouter structured outputs retries to use `reask_md_json` instead of `reask_default`.
- Fixed templating to return `kwargs` unchanged instead of `None` in `handle_templating` when the message list is empty or unrecognized.
- Allowed `Mode.JSON_SCHEMA` for the OpenAI provider when using `from_openai`.
- Ensured `cachePoint` dicts in message content are passed through unchanged for Bedrock (fixing regression since v1.13.0).
- Allowed `Mode.MD_JSON` in `from_bedrock`.
- Fixed `AttributeError` by ensuring `ParallelBase` generator is consumed into `ListResponse` in sync and async paths.