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..a4de4995 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,17 @@ # @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 + +- [#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/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/package.json b/package.json index 5429dda3..4c525692 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@instructor-ai/instructor", - "version": "1.1.1", + "version": "1.2.1", "description": "structured outputs for llms", "publishConfig": { "access": "public" 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 () => {