Skip to content

Inference Put - Client Raises 400 Error Stating Model Already Exists #2726

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

Closed
brewcore opened this issue Dec 13, 2024 · 1 comment
Closed

Comments

@brewcore
Copy link

Elasticsearch version: 8.16.1
Python Client version: 8.16.0
Python version: 3.12

Sample Code:

import os
from elasticsearch import Elasticsearch, NotFoundError

es_client = Elasticsearch(
    cloud_id=os.getenv('ELASTIC_CLOUD_ID'),
    basic_auth=(os.getenv('ELASTIC_USERNAME'), os.getenv('ELASTIC_PASSWORD'))
)

res = es_client.inference.put(
    inference_id="my_elser_model",
    task_type="sparse_embedding",
    body={
        "service": "elasticsearch",
        "service_settings": {
            "num_threads": 1,
            "num_allocations": 1,
            "model_id": ".elser_model_2" 
        },
        "chunking_settings": {
            "strategy": "sentence",
            "max_chunk_size": 250,
            "sentence_overlap": 1
        }
    }
)

print(res)

Expected result: inference endpoint is created, Elasticsearch client returns an ObjectApiResponse object without raising an error.

Actual/observed result: inference endpoint is created, Elasticsearch client raises elasticsearch.BadRequestError: BadRequestError(400, 'resource_already_exists_exception', 'Inference endpoint [my_model] already exists') I've triple-checked that the resource does not exist before the script is run.

@brewcore
Copy link
Author

brewcore commented Jan 7, 2025

Doesn't seem to be occurring in the latest version.

@brewcore brewcore closed this as completed Jan 7, 2025
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

No branches or pull requests

1 participant