From 972d9ae0592043f39b77977cf369d9f54dcd31e3 Mon Sep 17 00:00:00 2001 From: Dimitri Kennedy Date: Sat, 20 Apr 2024 22:35:38 -0400 Subject: [PATCH 1/3] Version Packages (#165) Co-authored-by: github-actions[bot] --- .changeset/curly-ants-tie.md | 5 ----- CHANGELOG.md | 6 ++++++ package.json | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) delete mode 100644 .changeset/curly-ants-tie.md diff --git a/.changeset/curly-ants-tie.md b/.changeset/curly-ants-tie.md deleted file mode 100644 index c551851e..00000000 --- a/.changeset/curly-ants-tie.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@instructor-ai/instructor": minor ---- - -adding request option pass through + handling non validation errors a little bit better and not retrying if not validation error specifically diff --git a/CHANGELOG.md b/CHANGELOG.md index 62368155..8bf08167 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # @instructor-ai/instructor +## 1.2.0 + +### Minor Changes + +- [#164](https://github.com/instructor-ai/instructor-js/pull/164) [`6942d65`](https://github.com/instructor-ai/instructor-js/commit/6942d652b7750fac4306c4d713399cdc03e86a9b) Thanks [@roodboi](https://github.com/roodboi)! - adding request option pass through + handling non validation errors a little bit better and not retrying if not validation error specifically + ## 1.1.2 ### Patch Changes diff --git a/package.json b/package.json index 5429dda3..72b08517 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@instructor-ai/instructor", - "version": "1.1.1", + "version": "1.2.0", "description": "structured outputs for llms", "publishConfig": { "access": "public" From ddfe2572c672708fb9ad20ad6726cb3af07c5148 Mon Sep 17 00:00:00 2001 From: Dimitri Kennedy Date: Sat, 20 Apr 2024 23:04:49 -0400 Subject: [PATCH 2/3] Include meta on standard completion (#166) --- .changeset/happy-suits-dress.md | 5 +++++ examples/extract_user/index.ts | 1 + src/instructor.ts | 2 +- tests/anthropic.test.ts | 2 +- 4 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 .changeset/happy-suits-dress.md diff --git a/.changeset/happy-suits-dress.md b/.changeset/happy-suits-dress.md new file mode 100644 index 00000000..5387309f --- /dev/null +++ b/.changeset/happy-suits-dress.md @@ -0,0 +1,5 @@ +--- +"@instructor-ai/instructor": patch +--- + +make sure we pass through \_meta on non stream completions diff --git a/examples/extract_user/index.ts b/examples/extract_user/index.ts index baaa72dd..3ac8fad3 100644 --- a/examples/extract_user/index.ts +++ b/examples/extract_user/index.ts @@ -29,6 +29,7 @@ const user = await client.chat.completions.create({ }) console.log(user) + // { // age: 30, // name: "Jason Liu", diff --git a/src/instructor.ts b/src/instructor.ts index 9376dae7..22acd873 100644 --- a/src/instructor.ts +++ b/src/instructor.ts @@ -221,7 +221,7 @@ class Instructor { } } - return validation.data + return { ...validation.data, _meta: data?._meta ?? {} } } catch (error) { if (!(error instanceof ZodError)) { throw error diff --git a/tests/anthropic.test.ts b/tests/anthropic.test.ts index 86e8ea09..832eafe8 100644 --- a/tests/anthropic.test.ts +++ b/tests/anthropic.test.ts @@ -142,7 +142,7 @@ describe("LLMClient Anthropic Provider - mode: MD_JSON", () => { } }) - expect(completion).toEqual({ name: "Dimitri Kennedy" }) + expect(omit(["_meta"], completion)).toEqual({ name: "Dimitri Kennedy" }) }) test("complex schema - streaming", async () => { From 187fb92805ed27bdef1ba6814cf116c438314c4b Mon Sep 17 00:00:00 2001 From: Dimitri Kennedy Date: Sat, 20 Apr 2024 23:13:33 -0400 Subject: [PATCH 3/3] Version Packages (#167) Co-authored-by: github-actions[bot] --- .changeset/happy-suits-dress.md | 5 ----- CHANGELOG.md | 6 ++++++ package.json | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) delete mode 100644 .changeset/happy-suits-dress.md diff --git a/.changeset/happy-suits-dress.md b/.changeset/happy-suits-dress.md deleted file mode 100644 index 5387309f..00000000 --- a/.changeset/happy-suits-dress.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@instructor-ai/instructor": patch ---- - -make sure we pass through \_meta on non stream completions diff --git a/CHANGELOG.md b/CHANGELOG.md index 8bf08167..a4de4995 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # @instructor-ai/instructor +## 1.2.1 + +### Patch Changes + +- [#166](https://github.com/instructor-ai/instructor-js/pull/166) [`ddfe257`](https://github.com/instructor-ai/instructor-js/commit/ddfe2572c672708fb9ad20ad6726cb3af07c5148) Thanks [@roodboi](https://github.com/roodboi)! - make sure we pass through \_meta on non stream completions + ## 1.2.0 ### Minor Changes diff --git a/package.json b/package.json index 72b08517..4c525692 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@instructor-ai/instructor", - "version": "1.2.0", + "version": "1.2.1", "description": "structured outputs for llms", "publishConfig": { "access": "public"