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

is there any notebook example that works ? (all those I tried are obsolete) #526

Closed
younes-io opened this issue Dec 9, 2023 · 13 comments
Closed

Comments

@younes-io
Copy link
Contributor

younes-io commented Dec 9, 2023

The bug
I spent hours for days trying to make one single example on guidance work... (Im using Azure OpenAI API), and I can't manage to do that.. I got a few errors, but the main reason it's failing is because most of these notebooks are obsolete unfortunately..

If guidance re-invents its API & its modules every release, then maybe its better to have those notebooks / examples associated with the guidance version that was used to test them.. I have taken at least 5 examples, and none of them works.. it's really unproductive :/

@younes-io younes-io changed the title is there any notebook example that works ? (all those I tried are obselete) is there any notebook example that works ? (all those I tried are obsolete) Dec 9, 2023
@wiiiktor
Copy link

wiiiktor commented Dec 9, 2023

I made some kaggle / colab notebooks:
#527
#520

@younes-io
Copy link
Contributor Author

@wiiiktor : are you aware of any other alternatives ?

@younes-io
Copy link
Contributor Author

image

For instance, I downloaded this notebook from the repo examples and I'm using guidance 0.1.5 and you can see the AzureOpenAIChat class doesn't even exist.. am I supposed to keep decrementing the guidance version and install until it works ???

This isn't the only broken example I came across..

@wiiiktor
Copy link

wiiiktor commented Dec 9, 2023

I started using guidance after 1.0 release :) and have no clue about anything that worked earlier, sorry...

@younes-io
Copy link
Contributor Author

younes-io commented Dec 9, 2023

@slundberg : Do you have an idea of when will this be released ?
https://github.com/guidance-ai/guidance/commits/ed07f12a5c3ee41d6aeac71755caf1c9d9d30c7b/guidance/models/_azure_openai.py

also tagging @Harsha-Nori if you have any comments please

@wiiiktor
Copy link

wiiiktor commented Dec 9, 2023

no idea, srry...

@Harsha-Nori
Copy link
Collaborator

Harsha-Nori commented Dec 11, 2023

Hey @younes-io, we're working through the notebooks and updating them slowly, but apologies for many of them still being out of date. The best source of documentation at the moment is our README (and we could also use help updating the notebooks if anyone is looking to make PRs!).

Perhaps we could shift all the old notebooks into a clearly marked folder to prevent this confusion while we transition the notebooks over? What do you think?

For getting pre-release code, you can install from source on main by cloning the repo and running:
pip install pybind11
pip install -e .

from the repo root. We'll push out a proper PyPI update in the near future but hope this helps in the short term

@younes-io
Copy link
Contributor Author

younes-io commented Dec 11, 2023

Hi @Harsha-Nori ,
I'm okay with anything that would help prevent this confusion.. whatever you see fit :)
I'll try the workaround in the meantime and will stick to the README example until I get sth working.. For the PRs, I'd be glad to do that but I can't afford to now since I've never been able to run guidance code using Azure OpenAI API and Active Directory (which are the only two options I have to call LLMs). Until then, I'll keep an eye on the repo :)
Thank you for your feedback and for your great work! This library is really awesome and I really am looking forward to integrating it to my code!

@marcotcr
Copy link
Collaborator

These ones use the new version, but none use Azure: tutorial.ipynb, chat_with_search.ipynb, code generation.

@slundberg
Copy link
Collaborator

Courtesy of @riedgar-ms we do have one Azure one: https://github.com/guidance-ai/guidance/blob/main/notebooks/tutorial_azureai_openai.ipynb

And I second the apologies about out of date notebooks. We planned to update them faster, and hesitated to rename ones that would break external links.

@younes-io
Copy link
Contributor Author

@slundberg : I think this is the new link : https://github.com/guidance-ai/guidance/blob/main/notebooks/api_examples/models/AzureOpenAI.ipynb

I'll test it and let you know :) Thank you

@younes-io
Copy link
Contributor Author

I added this PR #583 to expose the azure_deployment argument which is necessary for API Key Auth on Azure (since there are two ways to connect on Azure OpenAI API);

from guidance import models, gen
import tiktoken

azureai_model = models.AzureOpenAI(
    model='gpt-3.5-turbo',
    azure_endpoint=azure_endpoint,
    azure_deployment='my_crazy_deployment_name',
    api_key=api_key,
)

@slundberg
Copy link
Collaborator

We have updated lots of notebooks so hopefully this is not a big issue anymore. Closing for now, feel free to flag more.

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

No branches or pull requests

5 participants