Error: NotFound: 404 POST

I’m running the notebook in the course console and I get this error when I run completion = generate_text(prompt)

NotFound: 404 POST http://jupyter-api-proxy.internal.dlai/rev-proxy/google_generative_ai/v1beta2/models/text-bison-001:generateText?%24alt=json%3Benum-encoding%3Dint: Requested entity was not found.

1 Like

Looks like the course content is not up-to-date, and some of the libraries and tools are being decomissioned.

As a workaround, I’m following the quick-start from gemini api in a Colab notebook and it’s being util.

Pd. Be aware that you may need to tweak a little be the code shown in the video to make it work with the new gemini-ai library.

@lesly.zerna can you please check into this.

Regards
DP

1 Like

Hi asieh_harati!
thank you for reporting this! We’re actually working in updating these notebooks due to the recent updates in the Google LLMs!
While we’re working on this and have it ready (I’ll notify you here! :slight_smile:)
Give a check to this Short Course about using Multimodality with Gemini

Happy Learning!

Thanks @lesly.zerna

just to add to help whoever may land here while waiting for the update

1 Unless you have already, you’ll need an API key from Google aistudio apikey page (aistudio dot google dot com/app/apikey ; can’t include links)

2 you’ll need to pip install the current google-generativeai in the environment that you run a copy of the notebook in; similarly make your API key accessible

3 (even though we’ll be using Gemini – for simplicity not renaming palm variable in the notebook to the more current genai found in the Google docs) the configure() call changes to

palm.configure(
    api_key=get_api_key(),
    transport="rest"
)

4 (similarly, for relative simplicity, not renaming the _bison model, the model is

model_bison = palm.GenerativeModel("gemini-1.5-flash")

5 generate_text() function changes to

def generate_text(prompt,
                  model=model_bison,
                  temperature=0.0):
    return model.generate_content(prompt,
                                  generation_config={'temperature':temperature})

6 print(completion.result) changes to print(completion.text)

HTH

Attached file (L4-technical_debt_202410.ipynb (18.1 KB)) is L4 with variables renamed; NB get_api_key() needs to return your valid API key, while google.generativeai import should be current pip google-generativeai)

2 Likes