bia-bob icon indicating copy to clipboard operation
bia-bob copied to clipboard

Google Vertex API requires location

Open haesleinhuepf opened this issue 7 months ago • 0 comments

I see this error when using the Vertex API:


File [C:\structure\code\bia-bob\src\bia_bob\endpoints\_googlevertex.py:26](file:///C:/structure/code/bia-bob/src/bia_bob/endpoints/_googlevertex.py#line=25), in generate_response_from_vertex_ai(model, system_prompt, user_prompt, chat_history, image, vision_model, vision_system_prompt)
     24 if image is None:
     25     if Context.client is None or not isinstance(Context.client, ChatSession):
---> 26         gemini_model = GenerativeModel(model)
     27         Context.client = gemini_model.start_chat()
     28         system_result = Context.client.send_message(
     29             system_prompt + "\n\nConfirm these general instructions by answering 'yes'.").text

File [~\miniconda3\envs\bob-env\Lib\site-packages\vertexai\generative_models\_generative_models.py:336](http://localhost:8888/lab/tree/demo/~/miniconda3/envs/bob-env/Lib/site-packages/vertexai/generative_models/_generative_models.py#line=335), in _GenerativeModel.__init__(self, model_name, generation_config, safety_settings, tools, tool_config, system_instruction)
    330 model_name = _reconcile_model_name(model_name, project, location)
    332 prediction_resource_name = _get_resource_name_from_model_name(
    333     model_name, project, location
    334 )
--> 336 location = aiplatform_utils.extract_project_and_location_from_parent(
    337     prediction_resource_name
    338 )["location"]
    340 self._model_name = model_name
    341 self._prediction_resource_name = prediction_resource_name

KeyError: 'location'

haesleinhuepf avatar Jul 21 '24 10:07 haesleinhuepf