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 OpenAI to LogitsGenerator #1181

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

ulfaslak
Copy link

This is tiny, and I might be wrong in case OpenAI (since it's basically an API wrapper) is in fact NOT a LogitsGenerator.

But adding it seems logical, and I want it to be in there for my use case (which is that I have a function that creates a model, and with this change I can specify the return type to be LogitsGenerator).

  • We should be able to understand what the PR does from its title only;
  • There is a high-level description of the changes;
  • If I add a new feature, there is an [issue][issues] discussing it already;
  • There are links to all the relevant issues, discussions and PRs;
  • The branch is rebased on the latest main commit;
  • Commit messages follow these [guidelines][git-guidelines];
  • One commit per logical change;
  • The code respects the current naming conventions;
  • Docstrings follow the [numpy style guide][docstring-guidelines];
  • pre-commit is installed and configured on your machine, and you ran it before opening the PR;
  • There are tests covering the changes;
  • The documentation is up-to-date;

Copy link
Contributor

@lapp0 lapp0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you help me understand what you're using the LogitsGenerator for in your codebase? Just generally to signify that it's an OutlinesModel?

Perhaps we should change this type to OutlinesModel?

@ulfaslak
Copy link
Author

ulfaslak commented Oct 7, 2024

Could you help me understand what you're using the LogitsGenerator for in your codebase? Just generally to signify that it's an OutlinesModel?

Perhaps we should change this type to OutlinesModel?

Yeah, so I have a function that accepts an argument model of type outlines.models.LogitsGenerator | outlines.models.OpenAI. I am using beartype for runtime type checking, so the outlines.models.LogitsGenerator is a convenient type because it allows all the model types that might get passed to the function.

I searched the codebase, can't find an OutlinesModel class anywhere. Maybe I misunderstand you?

@lapp0
Copy link
Contributor

lapp0 commented Oct 7, 2024

Thanks for helping me understand.

We don't have an OutlinesModel, but that'll likely be its name after a refactor.

@ulfaslak
Copy link
Author

ulfaslak commented Oct 8, 2024

Roger. Yes something like that will be useful. Also for cases outside of runtime type validation, I can think of many cases where you'd want to do one thing if the model is a ready-to-use OutlinesModel, and another thing if it's not (e.g. a string: then create the model)

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.

2 participants