From 94a5f693e19ec4a1ca63bc6577272690c1dcc4f5 Mon Sep 17 00:00:00 2001 From: Morgante Pell Date: Mon, 27 May 2024 16:38:27 -0700 Subject: [PATCH 1/2] fix: use CJS shims for stream --- src/instructor.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/instructor.ts b/src/instructor.ts index c6bd97f..3f12d07 100644 --- a/src/instructor.ts +++ b/src/instructor.ts @@ -9,7 +9,7 @@ import { ReturnTypeBasedOnParams } from "@/types" import OpenAI from "openai" -import { Stream } from "openai/streaming.mjs" +import { Stream } from "openai/streaming" import { z, ZodError } from "zod" import ZodStream, { OAIResponseParser, OAIStream, withResponseModel, type Mode } from "zod-stream" import { fromZodError } from "zod-validation-error" From e054b0a3221df9c94c19960669dc3c659721e193 Mon Sep 17 00:00:00 2001 From: Morgante Pell Date: Mon, 27 May 2024 16:43:23 -0700 Subject: [PATCH 2/2] add changeset --- .changeset/eighty-zoos-walk.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/eighty-zoos-walk.md diff --git a/.changeset/eighty-zoos-walk.md b/.changeset/eighty-zoos-walk.md new file mode 100644 index 0000000..dc706e0 --- /dev/null +++ b/.changeset/eighty-zoos-walk.md @@ -0,0 +1,5 @@ +--- +"@instructor-ai/instructor": minor +--- + +Restore CommonJS compatibility for OpenAI streaming