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

Add tutorials #154

Merged
merged 14 commits into from
Nov 19, 2023
18 changes: 18 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,24 @@ model = await aclient.chat.completions.create(
assert isinstance(model, UserExtract)
```

!!! note "Accessing the original response"

If you want to access anything like usage or other metadata, the original response is available on the `Model._raw_response` attribute.

```python
user: UserDetail = client.chat.completions.create(
model="gpt-3.5-turbo",
response_model=UserDetail,
messages=[
{"role": "user", "content": "Extract Jason is 25 years old"},
]
)

from openai.types.chat.chat_completion import ChatCompletion

assert isinstance(user._raw_response, ChatCompletion)
```

## Why use Instructor?

The question of using Instructor is fundamentally a question of why to use Pydantic.
Expand Down
625 changes: 625 additions & 0 deletions tutorials/1.introduction.ipynb

Large diffs are not rendered by default.

Loading