Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: use CJS shims for stream #179

Merged
merged 3 commits into from
Jun 16, 2024
Merged

Conversation

morgante
Copy link
Contributor

Explicitly importing the .mjs module breaks CommonJS compatibility, we should instead import the streaming path which will choose between ESM and CommonJS automatically.

Copy link

changeset-bot bot commented May 27, 2024

🦋 Changeset detected

Latest commit: d7e228a

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@instructor-ai/instructor Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@morgante
Copy link
Contributor Author

@roodboi Can you take a look?

Copy link
Collaborator

@roodboi roodboi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good, thanks!

@jeremypress
Copy link

whoops, opened here as well #180. closing mine

@jeremypress
Copy link

hey @morgante 👋🏻 @roodboi can land? I'd like to remove my pnpm patch so I can distribute my code

@morgante
Copy link
Contributor Author

morgante commented Jun 5, 2024

Yes I think @roodboi needs to merge.

@pakamienny
Copy link

hey has this been solved?
I am still running into an error:

Error [ERR_REQUIRE_ESM]: require() of ES Module /Users/pakamienny/Documents/hackathons/batman/node_modules/openai/streaming.mjs not supported.
Instead change the require of /Users/pakamienny/Documents/hackathons/batman/node_modules/openai/streaming.mjs to a dynamic import() which is available in all CommonJS modules.
at Object. (/Users/pakamienny/Documents/hackathons/batman/node_modules/@instructor-ai/instructor/dist/index.cjs:1:806) {
code: 'ERR_REQUIRE_ESM'
}

@roodboi roodboi merged commit 1b56bd1 into instructor-ai:main Jun 16, 2024
1 check passed
@roodboi roodboi mentioned this pull request Jun 16, 2024
@morgante morgante deleted the fix-streaming branch June 16, 2024 11:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants