8000 Google Vertex API requires location · Issue #175 · haesleinhuepf/bia-bob · GitHub
[go: up one dir, main page]

Skip to content
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Google Vertex API requires location","articleBody":"I see this error when using the Vertex API:\r\n\r\n```\r\n\r\nFile [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)\r\n 24 if image is None:\r\n 25 if Context.client is None or not isinstance(Context.client, ChatSession):\r\n---> 26 gemini_model = GenerativeModel(model)\r\n 27 Context.client = gemini_model.start_chat()\r\n 28 system_result = Context.client.send_message(\r\n 29 system_prompt + \"\\n\\nConfirm these general instructions by answering 'yes'.\").text\r\n\r\nFile [~\\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)\r\n 330 model_name = _reconcile_model_name(model_name, project, location)\r\n 332 prediction_resource_name = _get_resource_name_from_model_name(\r\n 333 model_name, project, location\r\n 334 )\r\n--> 336 location = aiplatform_utils.extract_project_and_location_from_parent(\r\n 337 prediction_resource_name\r\n 338 )[\"location\"]\r\n 340 self._model_name = model_name\r\n 341 self._prediction_resource_name = prediction_resource_name\r\n\r\nKeyError: 'location'\r\n```\r\n","author":{"url":"https://github.com/haesleinhuepf","@type":"Person","name":"haesleinhuepf"},"datePublished":"2024-07-21T10:06:13Z","url":"https://github.com/haesleinhuepf/bia-bob/issues/175"}

Google Vertex API requires location #175

Open

Description

@haesleinhuepf

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'

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      0