Commit ed2d642
authored
Investigate instructor client import errors (#1818)
fix: re-expose instructor.client for backward compatibility
## Describe your changes
This PR addresses the critical breaking change where `instructor.client`
was no longer directly accessible, causing `AttributeError` for users.
The changes re-expose `client` in `instructor/__init__.py` to restore
backward compatibility, allowing `instructor.client.Instructor` and
`instructor.client.AsyncInstructor` to function again. Deprecation
warnings are in place to guide users towards the new direct import
paths. Additionally, an internal reference in
`instructor/providers/writer/client.py` was updated for consistency.
## Issue ticket number and link
#1816
## Checklist before requesting a review
- [ ] I have performed a self-review of my code
- [ ] If it is a core feature, I have added thorough tests.
- [ ] If it is a core feature, I have added documentation.
---
[Slack
Thread](https://567-studio.slack.com/archives/C08U5CAP8KV/p1758785426626979?thread_ts=1758785426.626979&cid=C08U5CAP8KV)
<a
href="https://cursor.com/background-agent?bcId=bc-4c062dcf-ca79-46b8-b16e-dcc5bbf1b509"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://cursor.com/open-in-cursor-dark.svg"><source
media="(prefers-color-scheme: light)"
srcset="https://cursor.com/open-in-cursor-light.svg"><img alt="Open in
Cursor"
src="https://cursor.com/open-in-cursor.svg"></picture></a> <a
href="https://cursor.com/agents?id=bc-4c062dcf-ca79-46b8-b16e-dcc5bbf1b509"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://cursor.com/open-in-web-dark.svg"><source
media="(prefers-color-scheme: light)"
srcset="https://cursor.com/open-in-web-light.svg"><img alt="Open in Web"
src="https://cursor.com/open-in-web.svg"></picture></a>
<!-- ELLIPSIS_HIDDEN -->
----
> [!IMPORTANT]
> Re-expose `instructor.client` for backward compatibility and update
internal references in `from_writer()`.
>
> - **Behavior**:
> - Re-expose `client` in `instructor/__init__.py` for backward
compatibility, allowing `instructor.client.Instructor` and
`instructor.client.AsyncInstructor` to work.
> - Add deprecation warnings to guide users to new import paths.
> - **Internal References**:
> - Update return type in `from_writer()` in
`instructor/providers/writer/client.py` to use `instructor.Instructor`
and `instructor.AsyncInstructor` directly.
>
> <sup>This description was created by </sup>[<img alt="Ellipsis"
src="https://img.shields.io/badge/Ellipsis-blue?color=175173">](https://www.ellipsis.dev?ref=567-labs%2Finstructor&utm_source=github&utm_medium=referral)<sup>
for 91245da. You can
[customize](https://app.ellipsis.dev/567-labs/settings/summaries) this
summary. It will automatically update as commits are pushed.</sup>
<!-- ELLIPSIS_HIDDEN -->2 files changed
+6
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
| 66 | + | |
66 | 67 | | |
67 | 68 | | |
68 | 69 | | |
69 | 70 | | |
70 | 71 | | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
71 | 76 | | |
72 | 77 | | |
73 | 78 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
| 30 | + | |
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| |||
0 commit comments