Solucionado (ver solução)
Solucionado
(ver solução)
1
resposta

Estou enfrentando esse erro no 5º passo

WARNING:langchain_google_genai.chat_models:Retrying langchain_google_genai.chat_models._chat_with_retry.<locals>._chat_with_retry in 2.0 seconds as it raised NotFound: 404 models/gemini-pro is not found for API version v1beta, or is not supported for generateContent. Call ListModels to see the list of available models and their supported methods..
WARNING:langchain_google_genai.chat_models:Retrying langchain_google_genai.chat_models._chat_with_retry.<locals>._chat_with_retry in 4.0 seconds as it raised NotFound: 404 models/gemini-pro is not found for API version v1beta, or is not supported for generateContent. Call ListModels to see the list of available models and their supported methods..
WARNING:langchain_google_genai.chat_models:Retrying langchain_google_genai.chat_models._chat_with_retry.<locals>._chat_with_retry in 8.0 seconds as it raised NotFound: 404 models/gemini-pro is not found for API version v1beta, or is not supported for generateContent. Call ListModels to see the list of available models and their supported methods..
WARNING:langchain_google_genai.chat_models:Retrying langchain_google_genai.chat_models._chat_with_retry.<locals>._chat_with_retry in 16.0 seconds as it raised NotFound: 404 models/gemini-pro is not found for API version v1beta, or is not supported for generateContent. Call ListModels to see the list of available models and their supported methods..
WARNING:langchain_google_genai.chat_models:Retrying langchain_google_genai.chat_models._chat_with_retry.<locals>._chat_with_retry in 32.0 seconds as it raised NotFound: 404 models/gemini-pro is not found for API version v1beta, or is not supported for generateContent. Call ListModels to see the list of available models and their supported methods..
---------------------------------------------------------------------------
NotFound                                  Traceback (most recent call last)
/tmp/ipython-input-3857894618.py in <cell line: 0>()
      1 chain_tradicional = prompt_tradicional | llm
      2 
----> 3 resposta_tradicional = chain_tradicional.invoke({"pergunta": pergunta})

24 frames
/usr/local/lib/python3.12/dist-packages/google/api_core/grpc_helpers.py in error_remapped_callable(*args, **kwargs)
     75             return callable_(*args, **kwargs)
     76         except grpc.RpcError as exc:
---> 77             raise exceptions.from_grpc_error(exc) from exc
     78 
     79     return error_remapped_callable


NotFound: 404 models/gemini-pro is not found for API version v1beta, or is not supported for generateContent. Call ListModels to see the list of available models and their supported methods.
1 resposta
solução!

Olá Dmitri, tudo bem?

O erro NotFound: 404 models/gemini-pro is not found for API version v1beta indica que o modelo especificado não está disponível ou não é compatível com a versão da API que você está utilizando.

Peço que teste outro modelo, como o gemini-2.5-pro. Para isso, recomendo o seguinte ajuste, troque o model="gemini-1.5-pro-latest" por gemini-2.5-pro. Assim:

llm = ChatGoogleGenerativeAI(model="gemini-2.5-pro", temperature=0)

Em seguida, reinicie o Notebook, seguindo estes passos:

  1. No menu de ferramentas do Google Colaboratory, clicar em "Ambientes de execução";

  2. Selecionar a opção "Reiniciar sessão e executar tudo".

Para realizar essas etapas, você pode acompanhar a imagem abaixo:

Reiniciar sessão e executar tudo, no Google Colaboratory

Fico à disposição. Abraço e bons estudos!

Caso este post tenha lhe ajudado, por favor, marcar como solucionado ✓. Bons estudos!