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

Make OpenAI models compatible with the main API #574

Merged
merged 9 commits into from
Jan 26, 2024
Merged

Conversation

rlouf
Copy link
Member

@rlouf rlouf commented Jan 24, 2024

In this PR I add make OpenAI models compatible with the main API, for instance:

from outlines import models, generate

model = models.openai("gpt4")
generator = generate.text(model)
answer = generator("What is 2+2?", max_tokens=2)

It is thus now straightforward to swap and OpenAI model for an Open Source model by changing only one line of code. We raise a NotImplementedError whenever it is impossible to do structured generation with the API.

Closes #374. Closes #577. Closes #582. Closes #581.

TODO

@rlouf rlouf mentioned this pull request Jan 25, 2024
@rlouf rlouf marked this pull request as ready for review January 26, 2024 11:16
@rlouf rlouf merged commit 5d67a5a into main Jan 26, 2024
5 checks passed
@rlouf rlouf deleted the openai-interface branch January 26, 2024 11:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant