Closed mohdaliiqbal closed 5 months ago
ML commons client generate embedding method is failing. I believe it is path issue - path should be
path = '_plugins/_ml/models/'+model_id+'/_predict'
Following is the error message that I get.
RequestError: RequestError(400, 'no handler found for uri [/_plugins/_ml/_predict/text_embedding/] and method [POST]', 'no handler found for uri [/_plugins/_ml/_predict/text_embedding/] and method [POST]')
Following is the line that is throwing exception.
https://github.com/opensearch-project/opensearch-py-ml/blob/ec7e0235d9092cb26fe3d889d8ab7fae28dccefe/opensearch_py_ml/ml_commons/ml_commons_client.py#L514C1-L515C1
1 input_sentences = ["wine for my food"] ----> 2 embedding_output = ml_client.generate_embedding(f"{model_id}", input_sentences) 3 embed = json.loads(embedding_output)['inference_results'][0]['output'][0]['data'] 4 print(embed[:10]) File ~/anaconda3/envs/pytorch_p310/lib/python3.10/site-packages/opensearch_py_ml/ml_commons/ml_commons_client.py:490, in MLCommonClient.generate_embedding(self, model_id, sentences) 486 API_URL = f"{ML_BASE_URI}/_predict/text_embedding/{model_id}" 488 API_BODY = {"text_docs": sentences, "target_response": ["sentence_embedding"]} --> 490 return self._client.transport.perform_request( 491 method="POST", 492 url=API_URL, 493 body=API_BODY, 494 )
ML commons client generate embedding method is failing. I believe it is path issue - path should be
Following is the error message that I get.
Following is the line that is throwing exception.
https://github.com/opensearch-project/opensearch-py-ml/blob/ec7e0235d9092cb26fe3d889d8ab7fae28dccefe/opensearch_py_ml/ml_commons/ml_commons_client.py#L514C1-L515C1