Skip to content

docs(examples): Add canonical OpenAI starter example (#2082)#2083

Open
navanpreet wants to merge 2 commits into567-labs:mainfrom
navanpreet:docs/openai-starter-example
Open

docs(examples): Add canonical OpenAI starter example (#2082)#2083
navanpreet wants to merge 2 commits into567-labs:mainfrom
navanpreet:docs/openai-starter-example

Conversation

@navanpreet
Copy link

This PR addresses issue #2082 by adding a canonical OpenAI starter example at examples/openai/run.py.

This example demonstrates:

  • How to initialize the instructor client using instructor.from_provider("openai/<model>").
  • The definition of a small Pydantic response_model.
  • A basic .chat.completions.create(...) call utilizing the response_model.

Motivation

This example serves as a clear, minimal entry point for new users looking to quickly get started with instructor and OpenAI, addressing the fragmentation of existing examples mentioned in the issue. It focuses on the core functionality without additional complexity.

All code has been formatted with ruff format and linted with ruff check, and type-checked with mypy --strict to ensure compliance with the project's contributing guidelines.

Resolves #2082

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

docs(examples): add canonical OpenAI starter example under examples/openai

1 participant