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

[Bug]: MethodNotImplemented: 501 Received http2 header with status: 404 - While creating Vertex Search Datastore #1339

Closed
1 task done
sidoncloud opened this issue Oct 26, 2024 · 1 comment · Fixed by #1366

Comments

@sidoncloud
Copy link

File Name

https://github.com/GoogleCloudPlatform/generative-ai/blob/main/search/create_datastore_and_search.ipynb

What happened?

These guys can't be serious!! 50% of their code repository pertaining to Vertex AI/Gen AI with Python SDK is a large pile of junk and technical debt that wouldn't work. I really wonder how exactly do these guys work.

Error occurs while executing the below lines of code.

request = discoveryengine.CreateDataStoreRequest(
        parent=discoveryengine.DataStoreServiceClient.collection_path(
            project_id, location, "default_collection"
        ),
        data_store=data_store,
        data_store_id=data_store_id,
    )
    operation = client.create_data_store(request=request)

Relevant log output

---------------------------------------------------------------------------
_InactiveRpcError                         Traceback (most recent call last)
File /opt/conda/lib/python3.10/site-packages/google/api_core/grpc_helpers.py:76, in _wrap_unary_errors.<locals>.error_remapped_callable(*args, **kwargs)
     75 try:
---> 76     return callable_(*args, **kwargs)
     77 except grpc.RpcError as exc:

File /opt/conda/lib/python3.10/site-packages/grpc/_channel.py:1181, in _UnaryUnaryMultiCallable.__call__(self, request, timeout, metadata, credentials, wait_for_ready, compression)
   1175 (
   1176     state,
   1177     call,
   1178 ) = self._blocking(
   1179     request, timeout, metadata, credentials, wait_for_ready, compression
   1180 )
-> 1181 return _end_unary_response_blocking(state, call, False, None)

File /opt/conda/lib/python3.10/site-packages/grpc/_channel.py:1006, in _end_unary_response_blocking(state, call, with_call, deadline)
   1005 else:
-> 1006     raise _InactiveRpcError(state)

_InactiveRpcError: <_InactiveRpcError of RPC that terminated with:
	status = StatusCode.UNIMPLEMENTED
	details = "Received http2 header with status: 404"
	debug_error_string = "UNKNOWN:Error received from peer  {created_time:"2024-10-26T06:52:28.248496722+00:00", grpc_status:12, grpc_message:"Received http2 header with status: 404"}"
>

The above exception was the direct cause of the following exception:

MethodNotImplemented                      Traceback (most recent call last)
Cell In[10], line 1
----> 1 create_data_store(PROJECT_ID, LOCATION, DATASTORE_NAME, DATASTORE_ID)

Cell In[9], line 35, in create_data_store(project_id, location, data_store_name, data_store_id)
     22 data_store = discoveryengine.DataStore(
     23     display_name=data_store_name,
     24     industry_vertical="GENERIC",
     25     content_config="CONTENT_REQUIRED",
     26 )
     28 request = discoveryengine.CreateDataStoreRequest(
     29     parent=discoveryengine.DataStoreServiceClient.collection_path(
     30         project_id, location, "default_collection"
   (...)
     33     data_store_id=data_store_id,
     34 )
---> 35 operation = client.create_data_store(request=request)
     37 # Make the request
     38 # The try block is necessary to prevent execution from halting due to an error being thrown when the datastore takes a while to instantiate
     39 try:

File /opt/conda/lib/python3.10/site-packages/google/cloud/discoveryengine_v1beta/services/data_store_service/client.py:916, in DataStoreServiceClient.create_data_store(self, request, parent, data_store, data_store_id, retry, timeout, metadata)
    913 self._validate_universe_domain()
    915 # Send the request.
--> 916 response = rpc(
    917     request,
    918     retry=retry,
    919     timeout=timeout,
    920     metadata=metadata,
    921 )
    923 # Wrap the response in an operation future.
    924 response = operation.from_gapic(
    925     response,
    926     self._transport.operations_client,
    927     gcd_data_store.DataStore,
    928     metadata_type=data_store_service.CreateDataStoreMetadata,
    929 )

File /opt/conda/lib/python3.10/site-packages/google/api_core/gapic_v1/method.py:131, in _GapicCallable.__call__(self, timeout, retry, compression, *args, **kwargs)
    128 if self._compression is not None:
    129     kwargs["compression"] = compression
--> 131 return wrapped_func(*args, **kwargs)

File /opt/conda/lib/python3.10/site-packages/google/api_core/grpc_helpers.py:78, in _wrap_unary_errors.<locals>.error_remapped_callable(*args, **kwargs)
     76     return callable_(*args, **kwargs)
     77 except grpc.RpcError as exc:
---> 78     raise exceptions.from_grpc_error(exc) from exc

MethodNotImplemented: 501 Received http2 header with status: 404

Code of Conduct

  • I agree to follow this project's Code of Conduct
@prattcmp
Copy link

prattcmp commented Oct 26, 2024

I probably would have stated it more kindly, but yeah...

This is the response I get from the Vertex AI SDK for PHP:

[2024-10-26 16:23:49] local.ERROR: Google Vertex AI call exception  
[2024-10-26 16:23:49] local.ERROR: {
    "message": "Received http2 header with status: 404",
    "code": 12,
    "status": "UNIMPLEMENTED",
    "details": []
}  

Here's my code:

// Create a client.
        $prediction_service_client = new PredictionServiceClient();

        // Prepare the request message.
        $generation_config = (new GenerationConfig())
            ->setMaxOutputTokens(8192)
            ->setTemperature($parameters['temperature']);

        [$system_instructions, $contents] = self::openai_to_google_messages($parameters['messages']);
        $request = (new GenerateContentRequest())
            ->setModel($full_model_name)
            ->setSystemInstruction($system_instructions)
            ->setGenerationConfig($generation_config)
            ->setContents($contents);

        // Call the API and handle any network failures.
        try {
            if ($stream) {
                $response_stream = $prediction_service_client->streamGenerateContent($request);
                foreach ($response_stream->readAll() as $element) {
                    Log::debug('Element data: ' . $element->serializeToJsonString());
                    $stream(null, $element->serializeToJsonString());
                }
            } else {
                $response = $prediction_service_client->generateContent($request);
                Log::debug('Response data: ' . $response->serializeToJsonString());
            }
        } catch (ApiException $ex) {
            // Handle exception
            Log::error("Google Vertex AI call exception");
            Log::error($ex->getMessage());
            Log::error($ex->getTraceAsString());
            $response = null;
        }

holtskinner added a commit that referenced this issue Oct 31, 2024
Fixes #1339

- Added ADC authentication
- Changed Search to use Engine
holtskinner added a commit that referenced this issue Oct 31, 2024
Fixes #1339

- Added ADC authentication
- Changed Search to use Engine
holtskinner added a commit that referenced this issue Oct 31, 2024
Fixes #1339

- Added ADC authentication
- Changed Search to use Engine
inardini pushed a commit to inardini/generative-ai that referenced this issue Dec 7, 2024
Fixes GoogleCloudPlatform#1339

- Added ADC authentication
- Changed Search to use Engine
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

Successfully merging a pull request may close this issue.

2 participants