// WARNING: Please don't edit this file. It was generated by Python/WinRT v3.2.1

#include "py.Microsoft.Windows.AI.Text.h"

namespace py::cpp::Microsoft::Windows::AI::Text
{
    // ----- LanguageModel class --------------------

    static PyObject* _new_LanguageModel(PyTypeObject* /*unused*/, PyObject* /*unused*/, PyObject* /*unused*/) noexcept
    {
        static_assert(py::py_type<winrt::Microsoft::Windows::AI::Text::LanguageModel>::type_name);
        py::set_invalid_activation_error(py::py_type<winrt::Microsoft::Windows::AI::Text::LanguageModel>::type_name);
        return nullptr;
    }

    static void _dealloc_LanguageModel(py::wrapper::Microsoft::Windows::AI::Text::LanguageModel* self) noexcept
    {
        auto tp = Py_TYPE(self);
        std::destroy_at(&self->obj);
        tp->tp_free(self);
        Py_DECREF(tp);
    }

    static PyObject* LanguageModel_Close(py::wrapper::Microsoft::Windows::AI::Text::LanguageModel* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_GET_SIZE(args);

        if (arg_count == 0)
        {
            try
            {
                static std::optional<bool> is_overload_present{};

                if (!is_overload_present.has_value())
                {
                    is_overload_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Microsoft.Windows.AI.Text.LanguageModel", L"Close", 0);
                }

                if (!is_overload_present.value())
                {
                    py::set_arg_count_version_error(0);
                    return nullptr;
                }

                {
                    auto _gil = release_gil();
                    self->obj.Close();
                }

                Py_RETURN_NONE;
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* LanguageModel_CreateAsync(PyObject* /*unused*/, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_GET_SIZE(args);

        if (arg_count == 0)
        {
            try
            {
                static std::optional<bool> is_overload_present{};

                if (!is_overload_present.has_value())
                {
                    is_overload_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Microsoft.Windows.AI.Text.LanguageModel", L"CreateAsync", 0);
                }

                if (!is_overload_present.value())
                {
                    py::set_arg_count_version_error(0);
                    return nullptr;
                }

                return py::convert([&]()
                {
                    auto _gil = release_gil();
                    return winrt::Microsoft::Windows::AI::Text::LanguageModel::CreateAsync();
                }());
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* LanguageModel_EnsureReadyAsync(PyObject* /*unused*/, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_GET_SIZE(args);

        if (arg_count == 0)
        {
            try
            {
                static std::optional<bool> is_overload_present{};

                if (!is_overload_present.has_value())
                {
                    is_overload_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Microsoft.Windows.AI.Text.LanguageModel", L"EnsureReadyAsync", 0);
                }

                if (!is_overload_present.value())
                {
                    py::set_arg_count_version_error(0);
                    return nullptr;
                }

                return py::convert([&]()
                {
                    auto _gil = release_gil();
                    return winrt::Microsoft::Windows::AI::Text::LanguageModel::EnsureReadyAsync();
                }());
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* LanguageModel_GetReadyState(PyObject* /*unused*/, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_GET_SIZE(args);

        if (arg_count == 0)
        {
            try
            {
                static std::optional<bool> is_overload_present{};

                if (!is_overload_present.has_value())
                {
                    is_overload_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Microsoft.Windows.AI.Text.LanguageModel", L"GetReadyState", 0);
                }

                if (!is_overload_present.value())
                {
                    py::set_arg_count_version_error(0);
                    return nullptr;
                }

                return py::convert([&]()
                {
                    auto _gil = release_gil();
                    return winrt::Microsoft::Windows::AI::Text::LanguageModel::GetReadyState();
                }());
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* _assign_array_LanguageModel(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        auto array = std::make_unique<py::ComArray<winrt::Microsoft::Windows::AI::Text::LanguageModel>>();
        if (!py::cpp::_winrt::Array_Assign(arg, std::move(array)))
        {
            return nullptr;
        }
        Py_RETURN_NONE;
    }

    static PyObject* _from_LanguageModel(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        try
        {
            auto return_value = py::convert_to<winrt::Windows::Foundation::IInspectable>(arg);
            return py::convert(return_value.as<winrt::Microsoft::Windows::AI::Text::LanguageModel>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* _enter_LanguageModel(py::wrapper::Microsoft::Windows::AI::Text::LanguageModel* self, PyObject* /*unused*/) noexcept
    {
        return Py_NewRef(self);
    }

    static PyObject* _exit_LanguageModel(py::wrapper::Microsoft::Windows::AI::Text::LanguageModel* self, PyObject* /*unused*/) noexcept
    {
        try
        {
            {
                auto _gil = py::release_gil();
                self->obj.Close();
            }

            Py_RETURN_FALSE;
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef _methods_LanguageModel[] = {
        { "close", reinterpret_cast<PyCFunction>(LanguageModel_Close), METH_VARARGS, nullptr },
        { "_assign_array_", _assign_array_LanguageModel, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_LanguageModel), METH_O | METH_STATIC, nullptr },
        { "__enter__", reinterpret_cast<PyCFunction>(_enter_LanguageModel), METH_NOARGS, nullptr },
        { "__exit__", reinterpret_cast<PyCFunction>(_exit_LanguageModel), METH_VARARGS, nullptr },
        { }};

    static PyGetSetDef _getset_LanguageModel[] = {
        { }};

    static PyType_Slot _type_slots_LanguageModel[] = {
        { Py_tp_new, reinterpret_cast<void*>(_new_LanguageModel) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_LanguageModel) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_LanguageModel) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_LanguageModel) },
        { }};

    static PyType_Spec type_spec_LanguageModel = {
        "winui3._winui3_microsoft_windows_ai_text.LanguageModel",
        sizeof(py::wrapper::Microsoft::Windows::AI::Text::LanguageModel),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_LanguageModel};

    static PyGetSetDef getset_LanguageModel_Static[] = {
        { }};

    static PyMethodDef methods_LanguageModel_Static[] = {
        { "create_async", reinterpret_cast<PyCFunction>(LanguageModel_CreateAsync), METH_VARARGS, nullptr },
        { "ensure_ready_async", reinterpret_cast<PyCFunction>(LanguageModel_EnsureReadyAsync), METH_VARARGS, nullptr },
        { "get_ready_state", reinterpret_cast<PyCFunction>(LanguageModel_GetReadyState), METH_VARARGS, nullptr },
        { }};

    static PyType_Slot type_slots_LanguageModel_Static[] = 
    {
        { Py_tp_base, reinterpret_cast<void*>(&PyType_Type) },
        { Py_tp_getset, reinterpret_cast<void*>(getset_LanguageModel_Static) },
        { Py_tp_methods, reinterpret_cast<void*>(methods_LanguageModel_Static) },
        { }
    };

    static PyType_Spec type_spec_LanguageModel_Static = {
        "winui3._winui3_microsoft_windows_ai_text.LanguageModel_Static",
        static_cast<int>(PyType_Type.tp_basicsize),
        static_cast<int>(PyType_Type.tp_itemsize),
        Py_TPFLAGS_DEFAULT,
        type_slots_LanguageModel_Static};

    // ----- LanguageModelContext class --------------------

    static PyObject* _new_LanguageModelContext(PyTypeObject* /*unused*/, PyObject* /*unused*/, PyObject* /*unused*/) noexcept
    {
        static_assert(py::py_type<winrt::Microsoft::Windows::AI::Text::LanguageModelContext>::type_name);
        py::set_invalid_activation_error(py::py_type<winrt::Microsoft::Windows::AI::Text::LanguageModelContext>::type_name);
        return nullptr;
    }

    static void _dealloc_LanguageModelContext(py::wrapper::Microsoft::Windows::AI::Text::LanguageModelContext* self) noexcept
    {
        auto tp = Py_TYPE(self);
        std::destroy_at(&self->obj);
        tp->tp_free(self);
        Py_DECREF(tp);
    }

    static PyObject* LanguageModelContext_Close(py::wrapper::Microsoft::Windows::AI::Text::LanguageModelContext* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_GET_SIZE(args);

        if (arg_count == 0)
        {
            try
            {
                static std::optional<bool> is_overload_present{};

                if (!is_overload_present.has_value())
                {
                    is_overload_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Microsoft.Windows.AI.Text.LanguageModelContext", L"Close", 0);
                }

                if (!is_overload_present.value())
                {
                    py::set_arg_count_version_error(0);
                    return nullptr;
                }

                {
                    auto _gil = release_gil();
                    self->obj.Close();
                }

                Py_RETURN_NONE;
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* _assign_array_LanguageModelContext(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        auto array = std::make_unique<py::ComArray<winrt::Microsoft::Windows::AI::Text::LanguageModelContext>>();
        if (!py::cpp::_winrt::Array_Assign(arg, std::move(array)))
        {
            return nullptr;
        }
        Py_RETURN_NONE;
    }

    static PyObject* _from_LanguageModelContext(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        try
        {
            auto return_value = py::convert_to<winrt::Windows::Foundation::IInspectable>(arg);
            return py::convert(return_value.as<winrt::Microsoft::Windows::AI::Text::LanguageModelContext>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* _enter_LanguageModelContext(py::wrapper::Microsoft::Windows::AI::Text::LanguageModelContext* self, PyObject* /*unused*/) noexcept
    {
        return Py_NewRef(self);
    }

    static PyObject* _exit_LanguageModelContext(py::wrapper::Microsoft::Windows::AI::Text::LanguageModelContext* self, PyObject* /*unused*/) noexcept
    {
        try
        {
            {
                auto _gil = py::release_gil();
                self->obj.Close();
            }

            Py_RETURN_FALSE;
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef _methods_LanguageModelContext[] = {
        { "close", reinterpret_cast<PyCFunction>(LanguageModelContext_Close), METH_VARARGS, nullptr },
        { "_assign_array_", _assign_array_LanguageModelContext, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_LanguageModelContext), METH_O | METH_STATIC, nullptr },
        { "__enter__", reinterpret_cast<PyCFunction>(_enter_LanguageModelContext), METH_NOARGS, nullptr },
        { "__exit__", reinterpret_cast<PyCFunction>(_exit_LanguageModelContext), METH_VARARGS, nullptr },
        { }};

    static PyGetSetDef _getset_LanguageModelContext[] = {
        { }};

    static PyType_Slot _type_slots_LanguageModelContext[] = {
        { Py_tp_new, reinterpret_cast<void*>(_new_LanguageModelContext) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_LanguageModelContext) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_LanguageModelContext) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_LanguageModelContext) },
        { }};

    static PyType_Spec type_spec_LanguageModelContext = {
        "winui3._winui3_microsoft_windows_ai_text.LanguageModelContext",
        sizeof(py::wrapper::Microsoft::Windows::AI::Text::LanguageModelContext),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_LanguageModelContext};

    // ----- LanguageModelOptions class --------------------

    static PyObject* _new_LanguageModelOptions(PyTypeObject* type, PyObject* args, PyObject* kwds) noexcept
    {
        if (kwds)
        {
            py::set_invalid_kwd_args_error();
            return nullptr;
        }

        auto arg_count = PyTuple_GET_SIZE(args);
        if (arg_count == 0)
        {
            try
            {
                winrt::Microsoft::Windows::AI::Text::LanguageModelOptions instance{};
                return py::wrap(instance, type);
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static void _dealloc_LanguageModelOptions(py::wrapper::Microsoft::Windows::AI::Text::LanguageModelOptions* self) noexcept
    {
        auto tp = Py_TYPE(self);
        std::destroy_at(&self->obj);
        tp->tp_free(self);
        Py_DECREF(tp);
    }

    static PyObject* LanguageModelOptions_get_TopP(py::wrapper::Microsoft::Windows::AI::Text::LanguageModelOptions* self, void* /*unused*/) noexcept
    {
        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Microsoft.Windows.AI.Text.LanguageModelOptions", L"TopP");
            }

            if (!is_property_present.value())
            {
                PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
                return nullptr;
            }

            return py::convert([&]()
            {
                auto _gil = release_gil();
                return self->obj.TopP();
            }());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static int LanguageModelOptions_put_TopP(py::wrapper::Microsoft::Windows::AI::Text::LanguageModelOptions* self, PyObject* arg, void* /*unused*/) noexcept
    {
        if (!arg)
        {
            PyErr_SetString(PyExc_AttributeError, "can't delete attribute");
            return -1;
        }

        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Microsoft.Windows.AI.Text.LanguageModelOptions", L"TopP");
            }

            if (!is_property_present.value())
            {
                PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
                return -1;
            }

            auto param0 = py::convert_to<float>(arg);

            {
                auto _gil = release_gil();
                self->obj.TopP(param0);
            }

            return 0;
        }
        catch (...)
        {
            py::to_PyErr();
            return -1;
        }
    }

    static PyObject* LanguageModelOptions_get_TopK(py::wrapper::Microsoft::Windows::AI::Text::LanguageModelOptions* self, void* /*unused*/) noexcept
    {
        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Microsoft.Windows.AI.Text.LanguageModelOptions", L"TopK");
            }

            if (!is_property_present.value())
            {
                PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
                return nullptr;
            }

            return py::convert([&]()
            {
                auto _gil = release_gil();
                return self->obj.TopK();
            }());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static int LanguageModelOptions_put_TopK(py::wrapper::Microsoft::Windows::AI::Text::LanguageModelOptions* self, PyObject* arg, void* /*unused*/) noexcept
    {
        if (!arg)
        {
            PyErr_SetString(PyExc_AttributeError, "can't delete attribute");
            return -1;
        }

        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Microsoft.Windows.AI.Text.LanguageModelOptions", L"TopK");
            }

            if (!is_property_present.value())
            {
                PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
                return -1;
            }

            auto param0 = py::convert_to<uint32_t>(arg);

            {
                auto _gil = release_gil();
                self->obj.TopK(param0);
            }

            return 0;
        }
        catch (...)
        {
            py::to_PyErr();
            return -1;
        }
    }

    static PyObject* LanguageModelOptions_get_Temperature(py::wrapper::Microsoft::Windows::AI::Text::LanguageModelOptions* self, void* /*unused*/) noexcept
    {
        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Microsoft.Windows.AI.Text.LanguageModelOptions", L"Temperature");
            }

            if (!is_property_present.value())
            {
                PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
                return nullptr;
            }

            return py::convert([&]()
            {
                auto _gil = release_gil();
                return self->obj.Temperature();
            }());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static int LanguageModelOptions_put_Temperature(py::wrapper::Microsoft::Windows::AI::Text::LanguageModelOptions* self, PyObject* arg, void* /*unused*/) noexcept
    {
        if (!arg)
        {
            PyErr_SetString(PyExc_AttributeError, "can't delete attribute");
            return -1;
        }

        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Microsoft.Windows.AI.Text.LanguageModelOptions", L"Temperature");
            }

            if (!is_property_present.value())
            {
                PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
                return -1;
            }

            auto param0 = py::convert_to<float>(arg);

            {
                auto _gil = release_gil();
                self->obj.Temperature(param0);
            }

            return 0;
        }
        catch (...)
        {
            py::to_PyErr();
            return -1;
        }
    }

    static PyObject* LanguageModelOptions_get_ContentFilterOptions(py::wrapper::Microsoft::Windows::AI::Text::LanguageModelOptions* self, void* /*unused*/) noexcept
    {
        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Microsoft.Windows.AI.Text.LanguageModelOptions", L"ContentFilterOptions");
            }

            if (!is_property_present.value())
            {
                PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
                return nullptr;
            }

            return py::convert([&]()
            {
                auto _gil = release_gil();
                return self->obj.ContentFilterOptions();
            }());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static int LanguageModelOptions_put_ContentFilterOptions(py::wrapper::Microsoft::Windows::AI::Text::LanguageModelOptions* self, PyObject* arg, void* /*unused*/) noexcept
    {
        if (!arg)
        {
            PyErr_SetString(PyExc_AttributeError, "can't delete attribute");
            return -1;
        }

        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Microsoft.Windows.AI.Text.LanguageModelOptions", L"ContentFilterOptions");
            }

            if (!is_property_present.value())
            {
                PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
                return -1;
            }

            auto param0 = py::convert_to<winrt::Microsoft::Windows::AI::ContentSafety::ContentFilterOptions>(arg);

            {
                auto _gil = release_gil();
                self->obj.ContentFilterOptions(param0);
            }

            return 0;
        }
        catch (...)
        {
            py::to_PyErr();
            return -1;
        }
    }

    static PyObject* _assign_array_LanguageModelOptions(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        auto array = std::make_unique<py::ComArray<winrt::Microsoft::Windows::AI::Text::LanguageModelOptions>>();
        if (!py::cpp::_winrt::Array_Assign(arg, std::move(array)))
        {
            return nullptr;
        }
        Py_RETURN_NONE;
    }

    static PyObject* _from_LanguageModelOptions(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        try
        {
            auto return_value = py::convert_to<winrt::Windows::Foundation::IInspectable>(arg);
            return py::convert(return_value.as<winrt::Microsoft::Windows::AI::Text::LanguageModelOptions>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef _methods_LanguageModelOptions[] = {
        { "_assign_array_", _assign_array_LanguageModelOptions, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_LanguageModelOptions), METH_O | METH_STATIC, nullptr },
        { }};

    static PyGetSetDef _getset_LanguageModelOptions[] = {
        { "top_p", reinterpret_cast<getter>(LanguageModelOptions_get_TopP), reinterpret_cast<setter>(LanguageModelOptions_put_TopP), nullptr, nullptr },
        { "top_k", reinterpret_cast<getter>(LanguageModelOptions_get_TopK), reinterpret_cast<setter>(LanguageModelOptions_put_TopK), nullptr, nullptr },
        { "temperature", reinterpret_cast<getter>(LanguageModelOptions_get_Temperature), reinterpret_cast<setter>(LanguageModelOptions_put_Temperature), nullptr, nullptr },
        { "content_filter_options", reinterpret_cast<getter>(LanguageModelOptions_get_ContentFilterOptions), reinterpret_cast<setter>(LanguageModelOptions_put_ContentFilterOptions), nullptr, nullptr },
        { }};

    static PyType_Slot _type_slots_LanguageModelOptions[] = {
        { Py_tp_new, reinterpret_cast<void*>(_new_LanguageModelOptions) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_LanguageModelOptions) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_LanguageModelOptions) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_LanguageModelOptions) },
        { }};

    static PyType_Spec type_spec_LanguageModelOptions = {
        "winui3._winui3_microsoft_windows_ai_text.LanguageModelOptions",
        sizeof(py::wrapper::Microsoft::Windows::AI::Text::LanguageModelOptions),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_LanguageModelOptions};

    // ----- LanguageModelResponseResult class --------------------

    static PyObject* _new_LanguageModelResponseResult(PyTypeObject* /*unused*/, PyObject* /*unused*/, PyObject* /*unused*/) noexcept
    {
        static_assert(py::py_type<winrt::Microsoft::Windows::AI::Text::LanguageModelResponseResult>::type_name);
        py::set_invalid_activation_error(py::py_type<winrt::Microsoft::Windows::AI::Text::LanguageModelResponseResult>::type_name);
        return nullptr;
    }

    static void _dealloc_LanguageModelResponseResult(py::wrapper::Microsoft::Windows::AI::Text::LanguageModelResponseResult* self) noexcept
    {
        auto tp = Py_TYPE(self);
        std::destroy_at(&self->obj);
        tp->tp_free(self);
        Py_DECREF(tp);
    }

    static PyObject* LanguageModelResponseResult_get_ExtendedError(py::wrapper::Microsoft::Windows::AI::Text::LanguageModelResponseResult* self, void* /*unused*/) noexcept
    {
        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Microsoft.Windows.AI.Text.LanguageModelResponseResult", L"ExtendedError");
            }

            if (!is_property_present.value())
            {
                PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
                return nullptr;
            }

            return py::convert([&]()
            {
                auto _gil = release_gil();
                return self->obj.ExtendedError();
            }());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* LanguageModelResponseResult_get_Status(py::wrapper::Microsoft::Windows::AI::Text::LanguageModelResponseResult* self, void* /*unused*/) noexcept
    {
        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Microsoft.Windows.AI.Text.LanguageModelResponseResult", L"Status");
            }

            if (!is_property_present.value())
            {
                PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
                return nullptr;
            }

            return py::convert([&]()
            {
                auto _gil = release_gil();
                return self->obj.Status();
            }());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* LanguageModelResponseResult_get_Text(py::wrapper::Microsoft::Windows::AI::Text::LanguageModelResponseResult* self, void* /*unused*/) noexcept
    {
        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Microsoft.Windows.AI.Text.LanguageModelResponseResult", L"Text");
            }

            if (!is_property_present.value())
            {
                PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
                return nullptr;
            }

            return py::convert([&]()
            {
                auto _gil = release_gil();
                return self->obj.Text();
            }());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* _assign_array_LanguageModelResponseResult(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        auto array = std::make_unique<py::ComArray<winrt::Microsoft::Windows::AI::Text::LanguageModelResponseResult>>();
        if (!py::cpp::_winrt::Array_Assign(arg, std::move(array)))
        {
            return nullptr;
        }
        Py_RETURN_NONE;
    }

    static PyObject* _from_LanguageModelResponseResult(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        try
        {
            auto return_value = py::convert_to<winrt::Windows::Foundation::IInspectable>(arg);
            return py::convert(return_value.as<winrt::Microsoft::Windows::AI::Text::LanguageModelResponseResult>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef _methods_LanguageModelResponseResult[] = {
        { "_assign_array_", _assign_array_LanguageModelResponseResult, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_LanguageModelResponseResult), METH_O | METH_STATIC, nullptr },
        { }};

    static PyGetSetDef _getset_LanguageModelResponseResult[] = {
        { "extended_error", reinterpret_cast<getter>(LanguageModelResponseResult_get_ExtendedError), nullptr, nullptr, nullptr },
        { "status", reinterpret_cast<getter>(LanguageModelResponseResult_get_Status), nullptr, nullptr, nullptr },
        { "text", reinterpret_cast<getter>(LanguageModelResponseResult_get_Text), nullptr, nullptr, nullptr },
        { }};

    static PyType_Slot _type_slots_LanguageModelResponseResult[] = {
        { Py_tp_new, reinterpret_cast<void*>(_new_LanguageModelResponseResult) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_LanguageModelResponseResult) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_LanguageModelResponseResult) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_LanguageModelResponseResult) },
        { }};

    static PyType_Spec type_spec_LanguageModelResponseResult = {
        "winui3._winui3_microsoft_windows_ai_text.LanguageModelResponseResult",
        sizeof(py::wrapper::Microsoft::Windows::AI::Text::LanguageModelResponseResult),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_LanguageModelResponseResult};

    // ----- TextRewriter class --------------------

    static PyObject* _new_TextRewriter(PyTypeObject* type, PyObject* args, PyObject* kwds) noexcept
    {
        if (kwds)
        {
            py::set_invalid_kwd_args_error();
            return nullptr;
        }

        auto arg_count = PyTuple_GET_SIZE(args);
        if (arg_count == 1)
        {
            try
            {
                auto param0 = py::convert_to<winrt::Microsoft::Windows::AI::Text::LanguageModel>(args, 0);

                winrt::Microsoft::Windows::AI::Text::TextRewriter instance{param0};
                return py::wrap(instance, type);
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static void _dealloc_TextRewriter(py::wrapper::Microsoft::Windows::AI::Text::TextRewriter* self) noexcept
    {
        auto tp = Py_TYPE(self);
        std::destroy_at(&self->obj);
        tp->tp_free(self);
        Py_DECREF(tp);
    }

    static PyObject* TextRewriter_RewriteAsync(py::wrapper::Microsoft::Windows::AI::Text::TextRewriter* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_GET_SIZE(args);

        if (arg_count == 1)
        {
            try
            {
                static std::optional<bool> is_overload_present{};

                if (!is_overload_present.has_value())
                {
                    is_overload_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Microsoft.Windows.AI.Text.TextRewriter", L"RewriteAsync", 1);
                }

                if (!is_overload_present.value())
                {
                    py::set_arg_count_version_error(1);
                    return nullptr;
                }

                auto param0 = py::convert_to<winrt::hstring>(args, 0);

                return py::convert([&]()
                {
                    auto _gil = release_gil();
                    return self->obj.RewriteAsync(param0);
                }());
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* _assign_array_TextRewriter(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        auto array = std::make_unique<py::ComArray<winrt::Microsoft::Windows::AI::Text::TextRewriter>>();
        if (!py::cpp::_winrt::Array_Assign(arg, std::move(array)))
        {
            return nullptr;
        }
        Py_RETURN_NONE;
    }

    static PyObject* _from_TextRewriter(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        try
        {
            auto return_value = py::convert_to<winrt::Windows::Foundation::IInspectable>(arg);
            return py::convert(return_value.as<winrt::Microsoft::Windows::AI::Text::TextRewriter>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef _methods_TextRewriter[] = {
        { "rewrite_async", reinterpret_cast<PyCFunction>(TextRewriter_RewriteAsync), METH_VARARGS, nullptr },
        { "_assign_array_", _assign_array_TextRewriter, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_TextRewriter), METH_O | METH_STATIC, nullptr },
        { }};

    static PyGetSetDef _getset_TextRewriter[] = {
        { }};

    static PyType_Slot _type_slots_TextRewriter[] = {
        { Py_tp_new, reinterpret_cast<void*>(_new_TextRewriter) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_TextRewriter) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_TextRewriter) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_TextRewriter) },
        { }};

    static PyType_Spec type_spec_TextRewriter = {
        "winui3._winui3_microsoft_windows_ai_text.TextRewriter",
        sizeof(py::wrapper::Microsoft::Windows::AI::Text::TextRewriter),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_TextRewriter};

    // ----- TextSummarizer class --------------------

    static PyObject* _new_TextSummarizer(PyTypeObject* type, PyObject* args, PyObject* kwds) noexcept
    {
        if (kwds)
        {
            py::set_invalid_kwd_args_error();
            return nullptr;
        }

        auto arg_count = PyTuple_GET_SIZE(args);
        if (arg_count == 1)
        {
            try
            {
                auto param0 = py::convert_to<winrt::Microsoft::Windows::AI::Text::LanguageModel>(args, 0);

                winrt::Microsoft::Windows::AI::Text::TextSummarizer instance{param0};
                return py::wrap(instance, type);
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static void _dealloc_TextSummarizer(py::wrapper::Microsoft::Windows::AI::Text::TextSummarizer* self) noexcept
    {
        auto tp = Py_TYPE(self);
        std::destroy_at(&self->obj);
        tp->tp_free(self);
        Py_DECREF(tp);
    }

    static PyObject* TextSummarizer_SummarizeAsync(py::wrapper::Microsoft::Windows::AI::Text::TextSummarizer* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_GET_SIZE(args);

        if (arg_count == 1)
        {
            try
            {
                static std::optional<bool> is_overload_present{};

                if (!is_overload_present.has_value())
                {
                    is_overload_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Microsoft.Windows.AI.Text.TextSummarizer", L"SummarizeAsync", 1);
                }

                if (!is_overload_present.value())
                {
                    py::set_arg_count_version_error(1);
                    return nullptr;
                }

                auto param0 = py::convert_to<winrt::hstring>(args, 0);

                return py::convert([&]()
                {
                    auto _gil = release_gil();
                    return self->obj.SummarizeAsync(param0);
                }());
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* TextSummarizer_SummarizeParagraphAsync(py::wrapper::Microsoft::Windows::AI::Text::TextSummarizer* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_GET_SIZE(args);

        if (arg_count == 1)
        {
            try
            {
                static std::optional<bool> is_overload_present{};

                if (!is_overload_present.has_value())
                {
                    is_overload_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Microsoft.Windows.AI.Text.TextSummarizer", L"SummarizeParagraphAsync", 1);
                }

                if (!is_overload_present.value())
                {
                    py::set_arg_count_version_error(1);
                    return nullptr;
                }

                auto param0 = py::convert_to<winrt::hstring>(args, 0);

                return py::convert([&]()
                {
                    auto _gil = release_gil();
                    return self->obj.SummarizeParagraphAsync(param0);
                }());
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* _assign_array_TextSummarizer(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        auto array = std::make_unique<py::ComArray<winrt::Microsoft::Windows::AI::Text::TextSummarizer>>();
        if (!py::cpp::_winrt::Array_Assign(arg, std::move(array)))
        {
            return nullptr;
        }
        Py_RETURN_NONE;
    }

    static PyObject* _from_TextSummarizer(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        try
        {
            auto return_value = py::convert_to<winrt::Windows::Foundation::IInspectable>(arg);
            return py::convert(return_value.as<winrt::Microsoft::Windows::AI::Text::TextSummarizer>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef _methods_TextSummarizer[] = {
        { "summarize_async", reinterpret_cast<PyCFunction>(TextSummarizer_SummarizeAsync), METH_VARARGS, nullptr },
        { "summarize_paragraph_async", reinterpret_cast<PyCFunction>(TextSummarizer_SummarizeParagraphAsync), METH_VARARGS, nullptr },
        { "_assign_array_", _assign_array_TextSummarizer, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_TextSummarizer), METH_O | METH_STATIC, nullptr },
        { }};

    static PyGetSetDef _getset_TextSummarizer[] = {
        { }};

    static PyType_Slot _type_slots_TextSummarizer[] = {
        { Py_tp_new, reinterpret_cast<void*>(_new_TextSummarizer) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_TextSummarizer) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_TextSummarizer) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_TextSummarizer) },
        { }};

    static PyType_Spec type_spec_TextSummarizer = {
        "winui3._winui3_microsoft_windows_ai_text.TextSummarizer",
        sizeof(py::wrapper::Microsoft::Windows::AI::Text::TextSummarizer),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_TextSummarizer};

    // ----- TextToTableConverter class --------------------

    static PyObject* _new_TextToTableConverter(PyTypeObject* type, PyObject* args, PyObject* kwds) noexcept
    {
        if (kwds)
        {
            py::set_invalid_kwd_args_error();
            return nullptr;
        }

        auto arg_count = PyTuple_GET_SIZE(args);
        if (arg_count == 1)
        {
            try
            {
                auto param0 = py::convert_to<winrt::Microsoft::Windows::AI::Text::LanguageModel>(args, 0);

                winrt::Microsoft::Windows::AI::Text::TextToTableConverter instance{param0};
                return py::wrap(instance, type);
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static void _dealloc_TextToTableConverter(py::wrapper::Microsoft::Windows::AI::Text::TextToTableConverter* self) noexcept
    {
        auto tp = Py_TYPE(self);
        std::destroy_at(&self->obj);
        tp->tp_free(self);
        Py_DECREF(tp);
    }

    static PyObject* TextToTableConverter_ConvertAsync(py::wrapper::Microsoft::Windows::AI::Text::TextToTableConverter* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_GET_SIZE(args);

        if (arg_count == 1)
        {
            try
            {
                static std::optional<bool> is_overload_present{};

                if (!is_overload_present.has_value())
                {
                    is_overload_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Microsoft.Windows.AI.Text.TextToTableConverter", L"ConvertAsync", 1);
                }

                if (!is_overload_present.value())
                {
                    py::set_arg_count_version_error(1);
                    return nullptr;
                }

                auto param0 = py::convert_to<winrt::hstring>(args, 0);

                return py::convert([&]()
                {
                    auto _gil = release_gil();
                    return self->obj.ConvertAsync(param0);
                }());
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* _assign_array_TextToTableConverter(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        auto array = std::make_unique<py::ComArray<winrt::Microsoft::Windows::AI::Text::TextToTableConverter>>();
        if (!py::cpp::_winrt::Array_Assign(arg, std::move(array)))
        {
            return nullptr;
        }
        Py_RETURN_NONE;
    }

    static PyObject* _from_TextToTableConverter(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        try
        {
            auto return_value = py::convert_to<winrt::Windows::Foundation::IInspectable>(arg);
            return py::convert(return_value.as<winrt::Microsoft::Windows::AI::Text::TextToTableConverter>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef _methods_TextToTableConverter[] = {
        { "convert_async", reinterpret_cast<PyCFunction>(TextToTableConverter_ConvertAsync), METH_VARARGS, nullptr },
        { "_assign_array_", _assign_array_TextToTableConverter, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_TextToTableConverter), METH_O | METH_STATIC, nullptr },
        { }};

    static PyGetSetDef _getset_TextToTableConverter[] = {
        { }};

    static PyType_Slot _type_slots_TextToTableConverter[] = {
        { Py_tp_new, reinterpret_cast<void*>(_new_TextToTableConverter) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_TextToTableConverter) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_TextToTableConverter) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_TextToTableConverter) },
        { }};

    static PyType_Spec type_spec_TextToTableConverter = {
        "winui3._winui3_microsoft_windows_ai_text.TextToTableConverter",
        sizeof(py::wrapper::Microsoft::Windows::AI::Text::TextToTableConverter),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_TextToTableConverter};

    // ----- TextToTableResponseResult class --------------------

    static PyObject* _new_TextToTableResponseResult(PyTypeObject* /*unused*/, PyObject* /*unused*/, PyObject* /*unused*/) noexcept
    {
        static_assert(py::py_type<winrt::Microsoft::Windows::AI::Text::TextToTableResponseResult>::type_name);
        py::set_invalid_activation_error(py::py_type<winrt::Microsoft::Windows::AI::Text::TextToTableResponseResult>::type_name);
        return nullptr;
    }

    static void _dealloc_TextToTableResponseResult(py::wrapper::Microsoft::Windows::AI::Text::TextToTableResponseResult* self) noexcept
    {
        auto tp = Py_TYPE(self);
        std::destroy_at(&self->obj);
        tp->tp_free(self);
        Py_DECREF(tp);
    }

    static PyObject* TextToTableResponseResult_GetRows(py::wrapper::Microsoft::Windows::AI::Text::TextToTableResponseResult* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_GET_SIZE(args);

        if (arg_count == 0)
        {
            try
            {
                static std::optional<bool> is_overload_present{};

                if (!is_overload_present.has_value())
                {
                    is_overload_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Microsoft.Windows.AI.Text.TextToTableResponseResult", L"GetRows", 0);
                }

                if (!is_overload_present.value())
                {
                    py::set_arg_count_version_error(0);
                    return nullptr;
                }

                return py::convert([&]()
                {
                    auto _gil = release_gil();
                    return self->obj.GetRows();
                }());
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* TextToTableResponseResult_get_ExtendedError(py::wrapper::Microsoft::Windows::AI::Text::TextToTableResponseResult* self, void* /*unused*/) noexcept
    {
        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Microsoft.Windows.AI.Text.TextToTableResponseResult", L"ExtendedError");
            }

            if (!is_property_present.value())
            {
                PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
                return nullptr;
            }

            return py::convert([&]()
            {
                auto _gil = release_gil();
                return self->obj.ExtendedError();
            }());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* TextToTableResponseResult_get_Status(py::wrapper::Microsoft::Windows::AI::Text::TextToTableResponseResult* self, void* /*unused*/) noexcept
    {
        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Microsoft.Windows.AI.Text.TextToTableResponseResult", L"Status");
            }

            if (!is_property_present.value())
            {
                PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
                return nullptr;
            }

            return py::convert([&]()
            {
                auto _gil = release_gil();
                return self->obj.Status();
            }());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* _assign_array_TextToTableResponseResult(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        auto array = std::make_unique<py::ComArray<winrt::Microsoft::Windows::AI::Text::TextToTableResponseResult>>();
        if (!py::cpp::_winrt::Array_Assign(arg, std::move(array)))
        {
            return nullptr;
        }
        Py_RETURN_NONE;
    }

    static PyObject* _from_TextToTableResponseResult(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        try
        {
            auto return_value = py::convert_to<winrt::Windows::Foundation::IInspectable>(arg);
            return py::convert(return_value.as<winrt::Microsoft::Windows::AI::Text::TextToTableResponseResult>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef _methods_TextToTableResponseResult[] = {
        { "get_rows", reinterpret_cast<PyCFunction>(TextToTableResponseResult_GetRows), METH_VARARGS, nullptr },
        { "_assign_array_", _assign_array_TextToTableResponseResult, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_TextToTableResponseResult), METH_O | METH_STATIC, nullptr },
        { }};

    static PyGetSetDef _getset_TextToTableResponseResult[] = {
        { "extended_error", reinterpret_cast<getter>(TextToTableResponseResult_get_ExtendedError), nullptr, nullptr, nullptr },
        { "status", reinterpret_cast<getter>(TextToTableResponseResult_get_Status), nullptr, nullptr, nullptr },
        { }};

    static PyType_Slot _type_slots_TextToTableResponseResult[] = {
        { Py_tp_new, reinterpret_cast<void*>(_new_TextToTableResponseResult) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_TextToTableResponseResult) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_TextToTableResponseResult) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_TextToTableResponseResult) },
        { }};

    static PyType_Spec type_spec_TextToTableResponseResult = {
        "winui3._winui3_microsoft_windows_ai_text.TextToTableResponseResult",
        sizeof(py::wrapper::Microsoft::Windows::AI::Text::TextToTableResponseResult),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_TextToTableResponseResult};

    // ----- TextToTableRow class --------------------

    static PyObject* _new_TextToTableRow(PyTypeObject* /*unused*/, PyObject* /*unused*/, PyObject* /*unused*/) noexcept
    {
        static_assert(py::py_type<winrt::Microsoft::Windows::AI::Text::TextToTableRow>::type_name);
        py::set_invalid_activation_error(py::py_type<winrt::Microsoft::Windows::AI::Text::TextToTableRow>::type_name);
        return nullptr;
    }

    static void _dealloc_TextToTableRow(py::wrapper::Microsoft::Windows::AI::Text::TextToTableRow* self) noexcept
    {
        auto tp = Py_TYPE(self);
        std::destroy_at(&self->obj);
        tp->tp_free(self);
        Py_DECREF(tp);
    }

    static PyObject* TextToTableRow_GetColumns(py::wrapper::Microsoft::Windows::AI::Text::TextToTableRow* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_GET_SIZE(args);

        if (arg_count == 0)
        {
            try
            {
                static std::optional<bool> is_overload_present{};

                if (!is_overload_present.has_value())
                {
                    is_overload_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Microsoft.Windows.AI.Text.TextToTableRow", L"GetColumns", 0);
                }

                if (!is_overload_present.value())
                {
                    py::set_arg_count_version_error(0);
                    return nullptr;
                }

                return py::convert([&]()
                {
                    auto _gil = release_gil();
                    return self->obj.GetColumns();
                }());
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* _assign_array_TextToTableRow(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        auto array = std::make_unique<py::ComArray<winrt::Microsoft::Windows::AI::Text::TextToTableRow>>();
        if (!py::cpp::_winrt::Array_Assign(arg, std::move(array)))
        {
            return nullptr;
        }
        Py_RETURN_NONE;
    }

    static PyObject* _from_TextToTableRow(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        try
        {
            auto return_value = py::convert_to<winrt::Windows::Foundation::IInspectable>(arg);
            return py::convert(return_value.as<winrt::Microsoft::Windows::AI::Text::TextToTableRow>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef _methods_TextToTableRow[] = {
        { "get_columns", reinterpret_cast<PyCFunction>(TextToTableRow_GetColumns), METH_VARARGS, nullptr },
        { "_assign_array_", _assign_array_TextToTableRow, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_TextToTableRow), METH_O | METH_STATIC, nullptr },
        { }};

    static PyGetSetDef _getset_TextToTableRow[] = {
        { }};

    static PyType_Slot _type_slots_TextToTableRow[] = {
        { Py_tp_new, reinterpret_cast<void*>(_new_TextToTableRow) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_TextToTableRow) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_TextToTableRow) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_TextToTableRow) },
        { }};

    static PyType_Spec type_spec_TextToTableRow = {
        "winui3._winui3_microsoft_windows_ai_text.TextToTableRow",
        sizeof(py::wrapper::Microsoft::Windows::AI::Text::TextToTableRow),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_TextToTableRow};

    // ----- Microsoft.Windows.AI.Text Initialization --------------------

    PyDoc_STRVAR(module_doc, "Microsoft.Windows.AI.Text");

    static PyModuleDef module_def = {
        PyModuleDef_HEAD_INIT,
        "_winui3_microsoft_windows_ai_text",
        module_doc,
        0,
        nullptr,
        nullptr,
        nullptr,
        nullptr,
        nullptr};
} // py::cpp::Microsoft::Windows::AI::Text

PyMODINIT_FUNC PyInit__winui3_microsoft_windows_ai_text(void) noexcept
{
    using namespace py::cpp::Microsoft::Windows::AI::Text;

    if (py::import_winrt_runtime() == -1)
    {
        return nullptr;
    }

    py::pyobj_handle module{PyModule_Create(&module_def)};

    if (!module)
    {
        return nullptr;
    }

    auto inspectable_meta_type = py::get_inspectable_meta_type();
    if (!inspectable_meta_type)
    {
        return nullptr;
    }

    auto object_type = py::get_object_type();
    if (!object_type)
    {
        return nullptr;
    }

    py::pyobj_handle object_bases{PyTuple_Pack(1, object_type)};

    if (!object_bases)
    {
        return nullptr;
    }

    py::pyobj_handle LanguageModel_Static_bases{PyTuple_Pack(1, reinterpret_cast<PyObject*>(inspectable_meta_type))};
    if (!LanguageModel_Static_bases)
    {
        return nullptr;
    }

    py::pyobj_handle type_LanguageModel_Static{PyType_FromSpecWithBases(&type_spec_LanguageModel_Static, LanguageModel_Static_bases.get())};
    if (!type_LanguageModel_Static)
    {
        return nullptr;
    }

    py::pytype_handle LanguageModel_type{py::register_python_type(module.get(), &type_spec_LanguageModel, object_bases.get(), reinterpret_cast<PyTypeObject*>(type_LanguageModel_Static.get()))};
    if (!LanguageModel_type)
    {
        return nullptr;
    }

    py::pytype_handle LanguageModelContext_type{py::register_python_type(module.get(), &type_spec_LanguageModelContext, object_bases.get(), inspectable_meta_type)};
    if (!LanguageModelContext_type)
    {
        return nullptr;
    }

    py::pytype_handle LanguageModelOptions_type{py::register_python_type(module.get(), &type_spec_LanguageModelOptions, object_bases.get(), inspectable_meta_type)};
    if (!LanguageModelOptions_type)
    {
        return nullptr;
    }

    py::pytype_handle LanguageModelResponseResult_type{py::register_python_type(module.get(), &type_spec_LanguageModelResponseResult, object_bases.get(), inspectable_meta_type)};
    if (!LanguageModelResponseResult_type)
    {
        return nullptr;
    }

    py::pytype_handle TextRewriter_type{py::register_python_type(module.get(), &type_spec_TextRewriter, object_bases.get(), inspectable_meta_type)};
    if (!TextRewriter_type)
    {
        return nullptr;
    }

    py::pytype_handle TextSummarizer_type{py::register_python_type(module.get(), &type_spec_TextSummarizer, object_bases.get(), inspectable_meta_type)};
    if (!TextSummarizer_type)
    {
        return nullptr;
    }

    py::pytype_handle TextToTableConverter_type{py::register_python_type(module.get(), &type_spec_TextToTableConverter, object_bases.get(), inspectable_meta_type)};
    if (!TextToTableConverter_type)
    {
        return nullptr;
    }

    py::pytype_handle TextToTableResponseResult_type{py::register_python_type(module.get(), &type_spec_TextToTableResponseResult, object_bases.get(), inspectable_meta_type)};
    if (!TextToTableResponseResult_type)
    {
        return nullptr;
    }

    py::pytype_handle TextToTableRow_type{py::register_python_type(module.get(), &type_spec_TextToTableRow, object_bases.get(), inspectable_meta_type)};
    if (!TextToTableRow_type)
    {
        return nullptr;
    }


    return module.detach();
}
