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

Docs suggestion: brief description of how instructor works #1351

Open
mbforbes opened this issue Feb 19, 2025 · 1 comment
Open

Docs suggestion: brief description of how instructor works #1351

mbforbes opened this issue Feb 19, 2025 · 1 comment
Labels
documentation Improvements or additions to documentation question Further information is requested

Comments

@mbforbes
Copy link

Hi there, I was reading the readme and the docs, but I couldn't find a concise explanation for how instructor actually works!

I was evaluating whether to use instructor, and wanted to know whether it used constrained decoding, prompting, tool APIs, or something else.

I think it'd be really helpful to have 1–2 sentences in the readme and docs that says something like:

Here's how instructor gets LLMs to produce responses that follow the provided schema:

  • If an LLM exposes a structured endpoint, we use that
  • Otherwise, if an LLM exposes a tool call endpoint, we use that
  • Otherwise, we fall back to a prompt to ask the model to output a response of the provided schema. If it fails, we retry N times
  • We don't implement constrained decoding for LLMs that produce logits, but may implement that in the future

(I don't know if the above is accurate!)

As a user of the library, knowing these details are really helpful to understand whether the schema is guaranteed by the LLM in a single call, or whether it's best-effort. Linking to the prompt would be helpful too.

Many thanks for your consideration, and thank you for making and open-sourcing this library!

Is your feature request related to a problem? Please describe.
Understanding instructor's approach.

Describe the solution you'd like
Brief documentation update

Describe alternatives you've considered
Reading the code to figure it out (it's what I did!)

Additional context
n/a

@github-actions github-actions bot added documentation Improvements or additions to documentation question Further information is requested labels Feb 19, 2025
@psharma28
Copy link

psharma28 commented Feb 20, 2025

In my experience, I noticed that the process kept defaulting back to the prompt to give a structured output, which resulted in a Pydantic errors.

I opened up this issue: #1341

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants