Skip to content

Commit

Permalink
fix example
Browse files Browse the repository at this point in the history
  • Loading branch information
jxnl committed Jan 3, 2024
1 parent bf74ffe commit 9f3e214
Showing 1 changed file with 5 additions and 12 deletions.
17 changes: 5 additions & 12 deletions examples/extract_user/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,10 @@ const user = await client.chat.completions.create({
model: "gpt-3.5-turbo",
response_model: UserSchema,
max_retries: 3
});


// let's now verify that the response type is inferred correctly

const age: number = user.age;
// @ts-expect-error - age is a number, not a string
const _age: string = user.age;
const name: string = user.name;

// @ts-expect-error - this property does not exist
user.missing;
})

console.log(user)
// {
// age: 30,
// name: "Jason Liu",
// }

0 comments on commit 9f3e214

Please sign in to comment.