python behave not able to detect step definition

I am trying to implement bdd test cases for flask application api end points. i am getting following error.

**You can implement step definitions for undefined steps with these snippets:

@then(u’the response should contain JSON with “result” equal to 12′)
def step_impl(context):
raise NotImplementedError(u’STEP: Then the response should contain JSON with “result” equal to 12′)**

from flask import Flask, jsonify, request

app = Flask(__name__)

@app.route('/api/greet', methods=['GET'])
def greet():
    name = request.args.get('name', 'World')
    return jsonify(message=f"Hello, {name}!")

@app.route('/api/add', methods=['POST'])
def add():
    data = request.get_json()
    result = data['a'] + data['b']
    return jsonify(result=result)

@app.route('/api/subtract', methods=['POST'])
def subtract():
    data = request.get_json()
    result = data['a'] - data['b']
    return jsonify(result=result)

if __name__ == '__main__':
    app.run(host='0.0.0.0')

Feature file:

Feature: Flask API Endpoints
  Scenario: Greet endpoint with query parameter
    Given the API is running
    When I send a GET request to "/api/greet" with query parameter "name" set to "Alice"
    Then the response status code should be 200
    And the response should contain JSON with "message" equal to "Hello, Alice!"
  Scenario: Add endpoint with JSON payload
    Given the API is running
    When I send a POST request to "/api/add" with JSON payload:
      """
      {
        "a": 5,
        "b": 7
      }
      """
    Then the response status code should be 200
    And the response should contain JSON with "result" equal to 12
  Scenario: Subtract endpoint with JSON payload
    Given the API is running
    When I send a POST request to "/api/subtract" with JSON payload:
      """
      {
        "a": 10,
        "b": 4
      }
      """
    Then the response status code should be 200
    Then the response should contain JSON with "result" equal to 6

Step definition:

from behave import given, when, then
import requests
import json
from flask import Flask
import threading
import time

# Import the Flask app
from app import app

# Helper function to run the Flask app in a separate thread
def start_flask_app():
    app.run(port=5000)

# Start the Flask app in a separate thread
thread = threading.Thread(target=start_flask_app)
thread.daemon = True
thread.start()

# Wait a bit for the server to start
time.sleep(1)

@given('the API is running')
def step_impl(context):
    response = requests.get('http://localhost:5000/api/greet')
    assert response.status_code == 200

@when('I send a GET request to "{endpoint}" with query parameter "name" set to "{name}"')
def step_impl(context, endpoint, name):
    context.response = requests.get(f'http://localhost:5000{endpoint}', params={'name': name})

@when('I send a POST request to "{endpoint}" with JSON payload')
def step_impl(context, endpoint):
    print("ENDPOINT:{}".format(endpoint))
    payload = json.loads(context.text)
    context.response = requests.post(f'http://localhost:5000{endpoint}', json=payload)

@then('the response status code should be {status_code:d}')
def step_impl(context, status_code):
    assert context.response.status_code == status_code

# @then('the response should contain JSON with "{key}" equal to "{value}"')
# def step_impl(context, key, value):
#     response_json = context.response.json()
#     if key.isdigit():
#         assert response_json[key] == int(value)
#     else:
#         assert response_json[key] == value

@then('the response should contain JSON with "{key}" equal to "{value}"')
def step_impl(context, key, value):
    response_json = context.response.json()
    # Convert value to the appropriate type (e.g., int or str)
    if value.isdigit():
        value = int(value)
    else:
        try:
            value = float(value)
        except ValueError:
            pass
    assert response_json[key] == value, f"Expected {key} to be {value}, but got {response_json[key]}"

for some reason it is not able to read.
@then(‘the response should contain JSON with “{key}” equal to “{value}”‘)
and I am getting undefined step error

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật