mirror of
https://github.com/kidfromjupiter/nearby.git
synced 2026-09-15 15:16:12 -04:00
2837 lines
132 KiB
C++
2837 lines
132 KiB
C++
// WARNING: Please don't edit this file. It was generated by C++/WinRT
|
|
// v2.0.250303.1
|
|
|
|
#pragma once
|
|
#ifndef WINRT_Microsoft_Windows_AI_GenerativeInternal_H
|
|
#define WINRT_Microsoft_Windows_AI_GenerativeInternal_H
|
|
#include "winrt/base.h"
|
|
static_assert(winrt::check_version(CPPWINRT_VERSION, "2.0.250303.1"),
|
|
"Mismatched C++/WinRT headers.");
|
|
#define CPPWINRT_VERSION "2.0.250303.1"
|
|
#include "winrt/Microsoft.Windows.AI.h"
|
|
#include "winrt/impl/Microsoft.Windows.AI.FoundationInternal.2.h"
|
|
#include "winrt/impl/Microsoft.Windows.AI.GenerativeInternal.2.h"
|
|
#include "winrt/impl/Microsoft.Windows.PrivateCommon.2.h"
|
|
#include "winrt/impl/Microsoft.Windows.SemanticSearch.2.h"
|
|
#include "winrt/impl/Windows.Foundation.2.h"
|
|
#include "winrt/impl/Windows.Foundation.Collections.2.h"
|
|
namespace winrt::impl {
|
|
template <typename D>
|
|
auto consume_Microsoft_Windows_AI_GenerativeInternal_IImageDescriptionSession<
|
|
D>::DescribeAsync(winrt::Microsoft::Windows::PrivateCommon::
|
|
ImageBufferResource const& imageBufferResource,
|
|
winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ImageDescriptionKindInternal const& kind,
|
|
winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ContentFilterOptionsInternal const&
|
|
contentFilterOptions) const {
|
|
void* result{};
|
|
if constexpr (!std::is_same_v<
|
|
D, winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
IImageDescriptionSession>) {
|
|
winrt::hresult _winrt_cast_result_code;
|
|
auto const _winrt_casted_result = impl::try_as_with_reason<
|
|
winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
IImageDescriptionSession,
|
|
D const*>(static_cast<D const*>(this), _winrt_cast_result_code);
|
|
check_hresult(_winrt_cast_result_code);
|
|
auto const _winrt_abi_type =
|
|
*(abi_t<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
IImageDescriptionSession>**)&_winrt_casted_result;
|
|
check_hresult(_winrt_abi_type->DescribeAsync(
|
|
*(void**)(&imageBufferResource), static_cast<int32_t>(kind),
|
|
impl::bind_in(contentFilterOptions), &result));
|
|
} else {
|
|
auto const _winrt_abi_type =
|
|
*(abi_t<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
IImageDescriptionSession>**)this;
|
|
check_hresult(_winrt_abi_type->DescribeAsync(
|
|
*(void**)(&imageBufferResource), static_cast<int32_t>(kind),
|
|
impl::bind_in(contentFilterOptions), &result));
|
|
}
|
|
return winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
IImageDescriptionSessionResult{result, take_ownership_from_abi};
|
|
}
|
|
template <typename D>
|
|
auto consume_Microsoft_Windows_AI_GenerativeInternal_IImageDescriptionSession<
|
|
D>::GetPartialResult() const {
|
|
void* result{};
|
|
if constexpr (!std::is_same_v<
|
|
D, winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
IImageDescriptionSession>) {
|
|
winrt::hresult _winrt_cast_result_code;
|
|
auto const _winrt_casted_result = impl::try_as_with_reason<
|
|
winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
IImageDescriptionSession,
|
|
D const*>(static_cast<D const*>(this), _winrt_cast_result_code);
|
|
check_hresult(_winrt_cast_result_code);
|
|
auto const _winrt_abi_type =
|
|
*(abi_t<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
IImageDescriptionSession>**)&_winrt_casted_result;
|
|
check_hresult(_winrt_abi_type->GetPartialResult(&result));
|
|
} else {
|
|
auto const _winrt_abi_type =
|
|
*(abi_t<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
IImageDescriptionSession>**)this;
|
|
check_hresult(_winrt_abi_type->GetPartialResult(&result));
|
|
}
|
|
return winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
IImageDescriptionSessionResult{result, take_ownership_from_abi};
|
|
}
|
|
template <typename D>
|
|
auto consume_Microsoft_Windows_AI_GenerativeInternal_IImageDescriptionSessionResult<
|
|
D>::Description() const {
|
|
void* value{};
|
|
if constexpr (!std::is_same_v<
|
|
D, winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
IImageDescriptionSessionResult>) {
|
|
winrt::hresult _winrt_cast_result_code;
|
|
auto const _winrt_casted_result = impl::try_as_with_reason<
|
|
winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
IImageDescriptionSessionResult,
|
|
D const*>(static_cast<D const*>(this), _winrt_cast_result_code);
|
|
check_hresult(_winrt_cast_result_code);
|
|
auto const _winrt_abi_type =
|
|
*(abi_t<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
IImageDescriptionSessionResult>**)&_winrt_casted_result;
|
|
check_hresult(_winrt_abi_type->get_Description(&value));
|
|
} else {
|
|
auto const _winrt_abi_type =
|
|
*(abi_t<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
IImageDescriptionSessionResult>**)this;
|
|
check_hresult(_winrt_abi_type->get_Description(&value));
|
|
}
|
|
return hstring{value, take_ownership_from_abi};
|
|
}
|
|
template <typename D>
|
|
auto consume_Microsoft_Windows_AI_GenerativeInternal_IImageDescriptionSessionResult<
|
|
D>::Status() const {
|
|
winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ImageDescriptionResultStatusInternal value{};
|
|
if constexpr (!std::is_same_v<
|
|
D, winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
IImageDescriptionSessionResult>) {
|
|
winrt::hresult _winrt_cast_result_code;
|
|
auto const _winrt_casted_result = impl::try_as_with_reason<
|
|
winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
IImageDescriptionSessionResult,
|
|
D const*>(static_cast<D const*>(this), _winrt_cast_result_code);
|
|
check_hresult(_winrt_cast_result_code);
|
|
auto const _winrt_abi_type =
|
|
*(abi_t<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
IImageDescriptionSessionResult>**)&_winrt_casted_result;
|
|
check_hresult(
|
|
_winrt_abi_type->get_Status(reinterpret_cast<int32_t*>(&value)));
|
|
} else {
|
|
auto const _winrt_abi_type =
|
|
*(abi_t<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
IImageDescriptionSessionResult>**)this;
|
|
check_hresult(
|
|
_winrt_abi_type->get_Status(reinterpret_cast<int32_t*>(&value)));
|
|
}
|
|
return value;
|
|
}
|
|
template <typename D>
|
|
auto consume_Microsoft_Windows_AI_GenerativeInternal_IImageLLMAdapterSession<
|
|
D>::GetImageLLMEmbeddings(array_view<float const> data,
|
|
uint32_t priority) const {
|
|
void* result{};
|
|
if constexpr (!std::is_same_v<
|
|
D, winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
IImageLLMAdapterSession>) {
|
|
winrt::hresult _winrt_cast_result_code;
|
|
auto const _winrt_casted_result = impl::try_as_with_reason<
|
|
winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
IImageLLMAdapterSession,
|
|
D const*>(static_cast<D const*>(this), _winrt_cast_result_code);
|
|
check_hresult(_winrt_cast_result_code);
|
|
auto const _winrt_abi_type =
|
|
*(abi_t<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
IImageLLMAdapterSession>**)&_winrt_casted_result;
|
|
check_hresult(_winrt_abi_type->GetImageLLMEmbeddings(
|
|
data.size(), get_abi(data), priority, &result));
|
|
} else {
|
|
auto const _winrt_abi_type =
|
|
*(abi_t<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
IImageLLMAdapterSession>**)this;
|
|
check_hresult(_winrt_abi_type->GetImageLLMEmbeddings(
|
|
data.size(), get_abi(data), priority, &result));
|
|
}
|
|
return winrt::Windows::Foundation::Collections::IVectorView<float>{
|
|
result, take_ownership_from_abi};
|
|
}
|
|
template <typename D>
|
|
auto consume_Microsoft_Windows_AI_GenerativeInternal_IImageLLMAdapterSession<
|
|
D>::GetModelInputSize(uint32_t priority) const {
|
|
uint32_t result{};
|
|
if constexpr (!std::is_same_v<
|
|
D, winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
IImageLLMAdapterSession>) {
|
|
winrt::hresult _winrt_cast_result_code;
|
|
auto const _winrt_casted_result = impl::try_as_with_reason<
|
|
winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
IImageLLMAdapterSession,
|
|
D const*>(static_cast<D const*>(this), _winrt_cast_result_code);
|
|
check_hresult(_winrt_cast_result_code);
|
|
auto const _winrt_abi_type =
|
|
*(abi_t<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
IImageLLMAdapterSession>**)&_winrt_casted_result;
|
|
check_hresult(_winrt_abi_type->GetModelInputSize(priority, &result));
|
|
} else {
|
|
auto const _winrt_abi_type =
|
|
*(abi_t<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
IImageLLMAdapterSession>**)this;
|
|
check_hresult(_winrt_abi_type->GetModelInputSize(priority, &result));
|
|
}
|
|
return result;
|
|
}
|
|
template <typename D>
|
|
auto consume_Microsoft_Windows_AI_GenerativeInternal_IImageLLMAdapterSession<
|
|
D>::GetModelOutputSize(uint32_t priority) const {
|
|
uint32_t result{};
|
|
if constexpr (!std::is_same_v<
|
|
D, winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
IImageLLMAdapterSession>) {
|
|
winrt::hresult _winrt_cast_result_code;
|
|
auto const _winrt_casted_result = impl::try_as_with_reason<
|
|
winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
IImageLLMAdapterSession,
|
|
D const*>(static_cast<D const*>(this), _winrt_cast_result_code);
|
|
check_hresult(_winrt_cast_result_code);
|
|
auto const _winrt_abi_type =
|
|
*(abi_t<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
IImageLLMAdapterSession>**)&_winrt_casted_result;
|
|
check_hresult(_winrt_abi_type->GetModelOutputSize(priority, &result));
|
|
} else {
|
|
auto const _winrt_abi_type =
|
|
*(abi_t<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
IImageLLMAdapterSession>**)this;
|
|
check_hresult(_winrt_abi_type->GetModelOutputSize(priority, &result));
|
|
}
|
|
return result;
|
|
}
|
|
template <typename D>
|
|
auto consume_Microsoft_Windows_AI_GenerativeInternal_ILanguageModelSession<
|
|
D>::GenerateResponseAsync(param::hstring const& prompt) const {
|
|
void* operation{};
|
|
if constexpr (!std::is_same_v<
|
|
D, winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSession>) {
|
|
winrt::hresult _winrt_cast_result_code;
|
|
auto const _winrt_casted_result =
|
|
impl::try_as_with_reason<winrt::Microsoft::Windows::AI::
|
|
GenerativeInternal::ILanguageModelSession,
|
|
D const*>(static_cast<D const*>(this),
|
|
_winrt_cast_result_code);
|
|
check_hresult(_winrt_cast_result_code);
|
|
auto const _winrt_abi_type =
|
|
*(abi_t<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSession>**)&_winrt_casted_result;
|
|
check_hresult(
|
|
_winrt_abi_type->GenerateResponseAsync(*(void**)(&prompt), &operation));
|
|
} else {
|
|
auto const _winrt_abi_type =
|
|
*(abi_t<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSession>**)this;
|
|
check_hresult(
|
|
_winrt_abi_type->GenerateResponseAsync(*(void**)(&prompt), &operation));
|
|
}
|
|
return winrt::Windows::Foundation::IAsyncOperation<hstring>{
|
|
operation, take_ownership_from_abi};
|
|
}
|
|
template <typename D>
|
|
auto consume_Microsoft_Windows_AI_GenerativeInternal_ILanguageModelSession<
|
|
D>::GetContextLength() const {
|
|
uint32_t result{};
|
|
if constexpr (!std::is_same_v<
|
|
D, winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSession>) {
|
|
winrt::hresult _winrt_cast_result_code;
|
|
auto const _winrt_casted_result =
|
|
impl::try_as_with_reason<winrt::Microsoft::Windows::AI::
|
|
GenerativeInternal::ILanguageModelSession,
|
|
D const*>(static_cast<D const*>(this),
|
|
_winrt_cast_result_code);
|
|
check_hresult(_winrt_cast_result_code);
|
|
auto const _winrt_abi_type =
|
|
*(abi_t<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSession>**)&_winrt_casted_result;
|
|
check_hresult(_winrt_abi_type->GetContextLength(&result));
|
|
} else {
|
|
auto const _winrt_abi_type =
|
|
*(abi_t<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSession>**)this;
|
|
check_hresult(_winrt_abi_type->GetContextLength(&result));
|
|
}
|
|
return result;
|
|
}
|
|
template <typename D>
|
|
auto consume_Microsoft_Windows_AI_GenerativeInternal_ILanguageModelSession<
|
|
D>::GenerateEmbeddings(param::hstring const& prompt) const {
|
|
void* operation{};
|
|
if constexpr (!std::is_same_v<
|
|
D, winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSession>) {
|
|
winrt::hresult _winrt_cast_result_code;
|
|
auto const _winrt_casted_result =
|
|
impl::try_as_with_reason<winrt::Microsoft::Windows::AI::
|
|
GenerativeInternal::ILanguageModelSession,
|
|
D const*>(static_cast<D const*>(this),
|
|
_winrt_cast_result_code);
|
|
check_hresult(_winrt_cast_result_code);
|
|
auto const _winrt_abi_type =
|
|
*(abi_t<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSession>**)&_winrt_casted_result;
|
|
check_hresult(
|
|
_winrt_abi_type->GenerateEmbeddings(*(void**)(&prompt), &operation));
|
|
} else {
|
|
auto const _winrt_abi_type =
|
|
*(abi_t<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSession>**)this;
|
|
check_hresult(
|
|
_winrt_abi_type->GenerateEmbeddings(*(void**)(&prompt), &operation));
|
|
}
|
|
return winrt::Windows::Foundation::IAsyncOperation<
|
|
winrt::Windows::Foundation::Collections::IVectorView<
|
|
winrt::Microsoft::Windows::SemanticSearch::EmbeddingVector>>{
|
|
operation, take_ownership_from_abi};
|
|
}
|
|
template <typename D>
|
|
auto consume_Microsoft_Windows_AI_GenerativeInternal_ILanguageModelSession<
|
|
D>::GetTokensAsync(param::hstring const& prompt) const {
|
|
void* operation{};
|
|
if constexpr (!std::is_same_v<
|
|
D, winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSession>) {
|
|
winrt::hresult _winrt_cast_result_code;
|
|
auto const _winrt_casted_result =
|
|
impl::try_as_with_reason<winrt::Microsoft::Windows::AI::
|
|
GenerativeInternal::ILanguageModelSession,
|
|
D const*>(static_cast<D const*>(this),
|
|
_winrt_cast_result_code);
|
|
check_hresult(_winrt_cast_result_code);
|
|
auto const _winrt_abi_type =
|
|
*(abi_t<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSession>**)&_winrt_casted_result;
|
|
check_hresult(
|
|
_winrt_abi_type->GetTokensAsync(*(void**)(&prompt), &operation));
|
|
} else {
|
|
auto const _winrt_abi_type =
|
|
*(abi_t<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSession>**)this;
|
|
check_hresult(
|
|
_winrt_abi_type->GetTokensAsync(*(void**)(&prompt), &operation));
|
|
}
|
|
return winrt::Windows::Foundation::IAsyncOperation<
|
|
winrt::Windows::Foundation::Collections::IVectorView<int64_t>>{
|
|
operation, take_ownership_from_abi};
|
|
}
|
|
template <typename D>
|
|
auto consume_Microsoft_Windows_AI_GenerativeInternal_ILanguageModelSession<
|
|
D>::ModelVersion() const {
|
|
void* value{};
|
|
if constexpr (!std::is_same_v<
|
|
D, winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSession>) {
|
|
winrt::hresult _winrt_cast_result_code;
|
|
auto const _winrt_casted_result =
|
|
impl::try_as_with_reason<winrt::Microsoft::Windows::AI::
|
|
GenerativeInternal::ILanguageModelSession,
|
|
D const*>(static_cast<D const*>(this),
|
|
_winrt_cast_result_code);
|
|
check_hresult(_winrt_cast_result_code);
|
|
auto const _winrt_abi_type =
|
|
*(abi_t<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSession>**)&_winrt_casted_result;
|
|
check_hresult(_winrt_abi_type->get_ModelVersion(&value));
|
|
} else {
|
|
auto const _winrt_abi_type =
|
|
*(abi_t<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSession>**)this;
|
|
check_hresult(_winrt_abi_type->get_ModelVersion(&value));
|
|
}
|
|
return hstring{value, take_ownership_from_abi};
|
|
}
|
|
template <typename D>
|
|
auto consume_Microsoft_Windows_AI_GenerativeInternal_ILanguageModelSession<
|
|
D>::VectorSpaceId() const {
|
|
winrt::guid value{};
|
|
if constexpr (!std::is_same_v<
|
|
D, winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSession>) {
|
|
winrt::hresult _winrt_cast_result_code;
|
|
auto const _winrt_casted_result =
|
|
impl::try_as_with_reason<winrt::Microsoft::Windows::AI::
|
|
GenerativeInternal::ILanguageModelSession,
|
|
D const*>(static_cast<D const*>(this),
|
|
_winrt_cast_result_code);
|
|
check_hresult(_winrt_cast_result_code);
|
|
auto const _winrt_abi_type =
|
|
*(abi_t<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSession>**)&_winrt_casted_result;
|
|
check_hresult(_winrt_abi_type->get_VectorSpaceId(put_abi(value)));
|
|
} else {
|
|
auto const _winrt_abi_type =
|
|
*(abi_t<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSession>**)this;
|
|
check_hresult(_winrt_abi_type->get_VectorSpaceId(put_abi(value)));
|
|
}
|
|
return value;
|
|
}
|
|
template <typename D>
|
|
auto consume_Microsoft_Windows_AI_GenerativeInternal_ILanguageModelSession2<
|
|
D>::IsPromptLargerThanContext(param::hstring const& prompt) const {
|
|
bool result{};
|
|
if constexpr (!std::is_same_v<
|
|
D, winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSession2>) {
|
|
winrt::hresult _winrt_cast_result_code;
|
|
auto const _winrt_casted_result =
|
|
impl::try_as_with_reason<winrt::Microsoft::Windows::AI::
|
|
GenerativeInternal::ILanguageModelSession2,
|
|
D const*>(static_cast<D const*>(this),
|
|
_winrt_cast_result_code);
|
|
check_hresult(_winrt_cast_result_code);
|
|
auto const _winrt_abi_type =
|
|
*(abi_t<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSession2>**)&_winrt_casted_result;
|
|
check_hresult(_winrt_abi_type->IsPromptLargerThanContext(*(void**)(&prompt),
|
|
&result));
|
|
} else {
|
|
auto const _winrt_abi_type =
|
|
*(abi_t<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSession2>**)this;
|
|
check_hresult(_winrt_abi_type->IsPromptLargerThanContext(*(void**)(&prompt),
|
|
&result));
|
|
}
|
|
return result;
|
|
}
|
|
template <typename D>
|
|
auto consume_Microsoft_Windows_AI_GenerativeInternal_ILanguageModelSession2<
|
|
D>::GenerateResponseWithProgressEvent(param::hstring const& prompt,
|
|
winrt::guid const& eventToken) const {
|
|
void* result{};
|
|
if constexpr (!std::is_same_v<
|
|
D, winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSession2>) {
|
|
winrt::hresult _winrt_cast_result_code;
|
|
auto const _winrt_casted_result =
|
|
impl::try_as_with_reason<winrt::Microsoft::Windows::AI::
|
|
GenerativeInternal::ILanguageModelSession2,
|
|
D const*>(static_cast<D const*>(this),
|
|
_winrt_cast_result_code);
|
|
check_hresult(_winrt_cast_result_code);
|
|
auto const _winrt_abi_type =
|
|
*(abi_t<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSession2>**)&_winrt_casted_result;
|
|
check_hresult(_winrt_abi_type->GenerateResponseWithProgressEvent(
|
|
*(void**)(&prompt), impl::bind_in(eventToken), &result));
|
|
} else {
|
|
auto const _winrt_abi_type =
|
|
*(abi_t<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSession2>**)this;
|
|
check_hresult(_winrt_abi_type->GenerateResponseWithProgressEvent(
|
|
*(void**)(&prompt), impl::bind_in(eventToken), &result));
|
|
}
|
|
return hstring{result, take_ownership_from_abi};
|
|
}
|
|
template <typename D>
|
|
auto consume_Microsoft_Windows_AI_GenerativeInternal_ILanguageModelSession2<
|
|
D>::GenerateResponseWithProgressEvent(param::vector_view<int64_t> const&
|
|
promptTokens,
|
|
winrt::guid const& eventToken) const {
|
|
void* result{};
|
|
if constexpr (!std::is_same_v<
|
|
D, winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSession2>) {
|
|
winrt::hresult _winrt_cast_result_code;
|
|
auto const _winrt_casted_result =
|
|
impl::try_as_with_reason<winrt::Microsoft::Windows::AI::
|
|
GenerativeInternal::ILanguageModelSession2,
|
|
D const*>(static_cast<D const*>(this),
|
|
_winrt_cast_result_code);
|
|
check_hresult(_winrt_cast_result_code);
|
|
auto const _winrt_abi_type =
|
|
*(abi_t<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSession2>**)&_winrt_casted_result;
|
|
check_hresult(_winrt_abi_type->GenerateResponseWithProgressEvent2(
|
|
*(void**)(&promptTokens), impl::bind_in(eventToken), &result));
|
|
} else {
|
|
auto const _winrt_abi_type =
|
|
*(abi_t<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSession2>**)this;
|
|
check_hresult(_winrt_abi_type->GenerateResponseWithProgressEvent2(
|
|
*(void**)(&promptTokens), impl::bind_in(eventToken), &result));
|
|
}
|
|
return hstring{result, take_ownership_from_abi};
|
|
}
|
|
template <typename D>
|
|
auto consume_Microsoft_Windows_AI_GenerativeInternal_ILanguageModelSession2<D>::
|
|
GenerateResponseWithProgressEvent(
|
|
param::vector_view<
|
|
winrt::Microsoft::Windows::SemanticSearch::EmbeddingVector> const&
|
|
promptEmbedding,
|
|
winrt::guid const& eventToken) const {
|
|
void* result{};
|
|
if constexpr (!std::is_same_v<
|
|
D, winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSession2>) {
|
|
winrt::hresult _winrt_cast_result_code;
|
|
auto const _winrt_casted_result =
|
|
impl::try_as_with_reason<winrt::Microsoft::Windows::AI::
|
|
GenerativeInternal::ILanguageModelSession2,
|
|
D const*>(static_cast<D const*>(this),
|
|
_winrt_cast_result_code);
|
|
check_hresult(_winrt_cast_result_code);
|
|
auto const _winrt_abi_type =
|
|
*(abi_t<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSession2>**)&_winrt_casted_result;
|
|
check_hresult(_winrt_abi_type->GenerateResponseWithProgressEvent3(
|
|
*(void**)(&promptEmbedding), impl::bind_in(eventToken), &result));
|
|
} else {
|
|
auto const _winrt_abi_type =
|
|
*(abi_t<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSession2>**)this;
|
|
check_hresult(_winrt_abi_type->GenerateResponseWithProgressEvent3(
|
|
*(void**)(&promptEmbedding), impl::bind_in(eventToken), &result));
|
|
}
|
|
return hstring{result, take_ownership_from_abi};
|
|
}
|
|
template <typename D>
|
|
auto consume_Microsoft_Windows_AI_GenerativeInternal_ILanguageModelSession2<
|
|
D>::GetPartialResult() const {
|
|
void* result{};
|
|
if constexpr (!std::is_same_v<
|
|
D, winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSession2>) {
|
|
winrt::hresult _winrt_cast_result_code;
|
|
auto const _winrt_casted_result =
|
|
impl::try_as_with_reason<winrt::Microsoft::Windows::AI::
|
|
GenerativeInternal::ILanguageModelSession2,
|
|
D const*>(static_cast<D const*>(this),
|
|
_winrt_cast_result_code);
|
|
check_hresult(_winrt_cast_result_code);
|
|
auto const _winrt_abi_type =
|
|
*(abi_t<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSession2>**)&_winrt_casted_result;
|
|
check_hresult(_winrt_abi_type->GetPartialResult(&result));
|
|
} else {
|
|
auto const _winrt_abi_type =
|
|
*(abi_t<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSession2>**)this;
|
|
check_hresult(_winrt_abi_type->GetPartialResult(&result));
|
|
}
|
|
return hstring{result, take_ownership_from_abi};
|
|
}
|
|
template <typename D>
|
|
auto consume_Microsoft_Windows_AI_GenerativeInternal_ILanguageModelSession3<
|
|
D>::GetTokens(param::hstring const& prompt) const {
|
|
void* result{};
|
|
if constexpr (!std::is_same_v<
|
|
D, winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSession3>) {
|
|
winrt::hresult _winrt_cast_result_code;
|
|
auto const _winrt_casted_result =
|
|
impl::try_as_with_reason<winrt::Microsoft::Windows::AI::
|
|
GenerativeInternal::ILanguageModelSession3,
|
|
D const*>(static_cast<D const*>(this),
|
|
_winrt_cast_result_code);
|
|
check_hresult(_winrt_cast_result_code);
|
|
auto const _winrt_abi_type =
|
|
*(abi_t<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSession3>**)&_winrt_casted_result;
|
|
check_hresult(_winrt_abi_type->GetTokens(*(void**)(&prompt), &result));
|
|
} else {
|
|
auto const _winrt_abi_type =
|
|
*(abi_t<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSession3>**)this;
|
|
check_hresult(_winrt_abi_type->GetTokens(*(void**)(&prompt), &result));
|
|
}
|
|
return winrt::Windows::Foundation::Collections::IVectorView<int64_t>{
|
|
result, take_ownership_from_abi};
|
|
}
|
|
template <typename D>
|
|
auto consume_Microsoft_Windows_AI_GenerativeInternal_ILanguageModelSession3<
|
|
D>::GetEmbeddings(param::hstring const& prompt) const {
|
|
void* result{};
|
|
if constexpr (!std::is_same_v<
|
|
D, winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSession3>) {
|
|
winrt::hresult _winrt_cast_result_code;
|
|
auto const _winrt_casted_result =
|
|
impl::try_as_with_reason<winrt::Microsoft::Windows::AI::
|
|
GenerativeInternal::ILanguageModelSession3,
|
|
D const*>(static_cast<D const*>(this),
|
|
_winrt_cast_result_code);
|
|
check_hresult(_winrt_cast_result_code);
|
|
auto const _winrt_abi_type =
|
|
*(abi_t<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSession3>**)&_winrt_casted_result;
|
|
check_hresult(_winrt_abi_type->GetEmbeddings(*(void**)(&prompt), &result));
|
|
} else {
|
|
auto const _winrt_abi_type =
|
|
*(abi_t<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSession3>**)this;
|
|
check_hresult(_winrt_abi_type->GetEmbeddings(*(void**)(&prompt), &result));
|
|
}
|
|
return winrt::Windows::Foundation::Collections::IVectorView<
|
|
winrt::Microsoft::Windows::SemanticSearch::EmbeddingVector>{
|
|
result, take_ownership_from_abi};
|
|
}
|
|
template <typename D>
|
|
auto consume_Microsoft_Windows_AI_GenerativeInternal_ILanguageModelSession3<
|
|
D>::GenerateResponse(winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
LanguageModelOptionsInternal const& options,
|
|
param::hstring const& prompt, uint32_t priority,
|
|
uint32_t frequency) const {
|
|
void* result{};
|
|
if constexpr (!std::is_same_v<
|
|
D, winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSession3>) {
|
|
winrt::hresult _winrt_cast_result_code;
|
|
auto const _winrt_casted_result =
|
|
impl::try_as_with_reason<winrt::Microsoft::Windows::AI::
|
|
GenerativeInternal::ILanguageModelSession3,
|
|
D const*>(static_cast<D const*>(this),
|
|
_winrt_cast_result_code);
|
|
check_hresult(_winrt_cast_result_code);
|
|
auto const _winrt_abi_type =
|
|
*(abi_t<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSession3>**)&_winrt_casted_result;
|
|
check_hresult(_winrt_abi_type->GenerateResponse(
|
|
impl::bind_in(options), *(void**)(&prompt), priority, frequency,
|
|
&result));
|
|
} else {
|
|
auto const _winrt_abi_type =
|
|
*(abi_t<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSession3>**)this;
|
|
check_hresult(_winrt_abi_type->GenerateResponse(
|
|
impl::bind_in(options), *(void**)(&prompt), priority, frequency,
|
|
&result));
|
|
}
|
|
return hstring{result, take_ownership_from_abi};
|
|
}
|
|
template <typename D>
|
|
auto consume_Microsoft_Windows_AI_GenerativeInternal_ILanguageModelSession3<D>::
|
|
GenerateResponseWithProgressEvent(
|
|
winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
LanguageModelOptionsInternal const& options,
|
|
param::hstring const& prompt, winrt::guid const& eventToken,
|
|
uint32_t priority, uint32_t frequency) const {
|
|
void* result{};
|
|
if constexpr (!std::is_same_v<
|
|
D, winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSession3>) {
|
|
winrt::hresult _winrt_cast_result_code;
|
|
auto const _winrt_casted_result =
|
|
impl::try_as_with_reason<winrt::Microsoft::Windows::AI::
|
|
GenerativeInternal::ILanguageModelSession3,
|
|
D const*>(static_cast<D const*>(this),
|
|
_winrt_cast_result_code);
|
|
check_hresult(_winrt_cast_result_code);
|
|
auto const _winrt_abi_type =
|
|
*(abi_t<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSession3>**)&_winrt_casted_result;
|
|
check_hresult(_winrt_abi_type->GenerateResponseWithProgressEvent(
|
|
impl::bind_in(options), *(void**)(&prompt), impl::bind_in(eventToken),
|
|
priority, frequency, &result));
|
|
} else {
|
|
auto const _winrt_abi_type =
|
|
*(abi_t<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSession3>**)this;
|
|
check_hresult(_winrt_abi_type->GenerateResponseWithProgressEvent(
|
|
impl::bind_in(options), *(void**)(&prompt), impl::bind_in(eventToken),
|
|
priority, frequency, &result));
|
|
}
|
|
return hstring{result, take_ownership_from_abi};
|
|
}
|
|
template <typename D>
|
|
auto consume_Microsoft_Windows_AI_GenerativeInternal_ILanguageModelSession3<D>::
|
|
GenerateResponseWithProgressEvent(
|
|
winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
LanguageModelOptionsInternal const& options,
|
|
param::vector_view<
|
|
winrt::Microsoft::Windows::SemanticSearch::EmbeddingVector> const&
|
|
promptEmbedding,
|
|
winrt::guid const& eventToken, uint32_t priority,
|
|
uint32_t frequency) const {
|
|
void* result{};
|
|
if constexpr (!std::is_same_v<
|
|
D, winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSession3>) {
|
|
winrt::hresult _winrt_cast_result_code;
|
|
auto const _winrt_casted_result =
|
|
impl::try_as_with_reason<winrt::Microsoft::Windows::AI::
|
|
GenerativeInternal::ILanguageModelSession3,
|
|
D const*>(static_cast<D const*>(this),
|
|
_winrt_cast_result_code);
|
|
check_hresult(_winrt_cast_result_code);
|
|
auto const _winrt_abi_type =
|
|
*(abi_t<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSession3>**)&_winrt_casted_result;
|
|
check_hresult(_winrt_abi_type->GenerateResponseWithProgressEvent2(
|
|
impl::bind_in(options), *(void**)(&promptEmbedding),
|
|
impl::bind_in(eventToken), priority, frequency, &result));
|
|
} else {
|
|
auto const _winrt_abi_type =
|
|
*(abi_t<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSession3>**)this;
|
|
check_hresult(_winrt_abi_type->GenerateResponseWithProgressEvent2(
|
|
impl::bind_in(options), *(void**)(&promptEmbedding),
|
|
impl::bind_in(eventToken), priority, frequency, &result));
|
|
}
|
|
return hstring{result, take_ownership_from_abi};
|
|
}
|
|
template <typename D>
|
|
auto consume_Microsoft_Windows_AI_GenerativeInternal_ILanguageModelSession3<D>::
|
|
GenerateResponseWithProgressEvent(
|
|
winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
LanguageModelOptionsInternal const& options,
|
|
param::vector_view<int64_t> const& promptTokens,
|
|
winrt::guid const& eventToken, uint32_t priority,
|
|
uint32_t frequency) const {
|
|
void* result{};
|
|
if constexpr (!std::is_same_v<
|
|
D, winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSession3>) {
|
|
winrt::hresult _winrt_cast_result_code;
|
|
auto const _winrt_casted_result =
|
|
impl::try_as_with_reason<winrt::Microsoft::Windows::AI::
|
|
GenerativeInternal::ILanguageModelSession3,
|
|
D const*>(static_cast<D const*>(this),
|
|
_winrt_cast_result_code);
|
|
check_hresult(_winrt_cast_result_code);
|
|
auto const _winrt_abi_type =
|
|
*(abi_t<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSession3>**)&_winrt_casted_result;
|
|
check_hresult(_winrt_abi_type->GenerateResponseWithProgressEvent3(
|
|
impl::bind_in(options), *(void**)(&promptTokens),
|
|
impl::bind_in(eventToken), priority, frequency, &result));
|
|
} else {
|
|
auto const _winrt_abi_type =
|
|
*(abi_t<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSession3>**)this;
|
|
check_hresult(_winrt_abi_type->GenerateResponseWithProgressEvent3(
|
|
impl::bind_in(options), *(void**)(&promptTokens),
|
|
impl::bind_in(eventToken), priority, frequency, &result));
|
|
}
|
|
return hstring{result, take_ownership_from_abi};
|
|
}
|
|
template <typename D>
|
|
auto consume_Microsoft_Windows_AI_GenerativeInternal_ILanguageModelSession4<
|
|
D>::GetEmbeddingSize() const {
|
|
uint32_t result{};
|
|
if constexpr (!std::is_same_v<
|
|
D, winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSession4>) {
|
|
winrt::hresult _winrt_cast_result_code;
|
|
auto const _winrt_casted_result =
|
|
impl::try_as_with_reason<winrt::Microsoft::Windows::AI::
|
|
GenerativeInternal::ILanguageModelSession4,
|
|
D const*>(static_cast<D const*>(this),
|
|
_winrt_cast_result_code);
|
|
check_hresult(_winrt_cast_result_code);
|
|
auto const _winrt_abi_type =
|
|
*(abi_t<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSession4>**)&_winrt_casted_result;
|
|
check_hresult(_winrt_abi_type->GetEmbeddingSize(&result));
|
|
} else {
|
|
auto const _winrt_abi_type =
|
|
*(abi_t<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSession4>**)this;
|
|
check_hresult(_winrt_abi_type->GetEmbeddingSize(&result));
|
|
}
|
|
return result;
|
|
}
|
|
template <typename D>
|
|
auto consume_Microsoft_Windows_AI_GenerativeInternal_ILanguageModelSession4<D>::
|
|
GenerateResponseWithProgressEvent(
|
|
winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
LanguageModelOptionsInternal const& options,
|
|
winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
LanguageModelInitialContextParam const& contextParam,
|
|
array_view<float const> embedding, winrt::guid const& eventToken,
|
|
uint32_t priority, uint32_t frequency,
|
|
winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ContentFilterOptionsInternal const& contentFilterOptions) const {
|
|
void* result{};
|
|
if constexpr (!std::is_same_v<
|
|
D, winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSession4>) {
|
|
winrt::hresult _winrt_cast_result_code;
|
|
auto const _winrt_casted_result =
|
|
impl::try_as_with_reason<winrt::Microsoft::Windows::AI::
|
|
GenerativeInternal::ILanguageModelSession4,
|
|
D const*>(static_cast<D const*>(this),
|
|
_winrt_cast_result_code);
|
|
check_hresult(_winrt_cast_result_code);
|
|
auto const _winrt_abi_type =
|
|
*(abi_t<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSession4>**)&_winrt_casted_result;
|
|
check_hresult(_winrt_abi_type->GenerateResponseWithProgressEvent(
|
|
impl::bind_in(options), impl::bind_in(contextParam), embedding.size(),
|
|
get_abi(embedding), impl::bind_in(eventToken), priority, frequency,
|
|
impl::bind_in(contentFilterOptions), &result));
|
|
} else {
|
|
auto const _winrt_abi_type =
|
|
*(abi_t<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSession4>**)this;
|
|
check_hresult(_winrt_abi_type->GenerateResponseWithProgressEvent(
|
|
impl::bind_in(options), impl::bind_in(contextParam), embedding.size(),
|
|
get_abi(embedding), impl::bind_in(eventToken), priority, frequency,
|
|
impl::bind_in(contentFilterOptions), &result));
|
|
}
|
|
return hstring{result, take_ownership_from_abi};
|
|
}
|
|
template <typename D>
|
|
auto consume_Microsoft_Windows_AI_GenerativeInternal_ILanguageModelSession4<
|
|
D>::GetTokens(param::hstring const& prompt,
|
|
winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ContentFilterOptionsInternal const& contentFilterOptions)
|
|
const {
|
|
void* result{};
|
|
if constexpr (!std::is_same_v<
|
|
D, winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSession4>) {
|
|
winrt::hresult _winrt_cast_result_code;
|
|
auto const _winrt_casted_result =
|
|
impl::try_as_with_reason<winrt::Microsoft::Windows::AI::
|
|
GenerativeInternal::ILanguageModelSession4,
|
|
D const*>(static_cast<D const*>(this),
|
|
_winrt_cast_result_code);
|
|
check_hresult(_winrt_cast_result_code);
|
|
auto const _winrt_abi_type =
|
|
*(abi_t<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSession4>**)&_winrt_casted_result;
|
|
check_hresult(_winrt_abi_type->GetTokens(
|
|
*(void**)(&prompt), impl::bind_in(contentFilterOptions), &result));
|
|
} else {
|
|
auto const _winrt_abi_type =
|
|
*(abi_t<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSession4>**)this;
|
|
check_hresult(_winrt_abi_type->GetTokens(
|
|
*(void**)(&prompt), impl::bind_in(contentFilterOptions), &result));
|
|
}
|
|
return winrt::Windows::Foundation::Collections::IVectorView<int64_t>{
|
|
result, take_ownership_from_abi};
|
|
}
|
|
template <typename D>
|
|
auto consume_Microsoft_Windows_AI_GenerativeInternal_ILanguageModelSession4<
|
|
D>::GetEmbeddings(param::hstring const& prompt,
|
|
winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ContentFilterOptionsInternal const&
|
|
contentFilterOptions) const {
|
|
void* result{};
|
|
if constexpr (!std::is_same_v<
|
|
D, winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSession4>) {
|
|
winrt::hresult _winrt_cast_result_code;
|
|
auto const _winrt_casted_result =
|
|
impl::try_as_with_reason<winrt::Microsoft::Windows::AI::
|
|
GenerativeInternal::ILanguageModelSession4,
|
|
D const*>(static_cast<D const*>(this),
|
|
_winrt_cast_result_code);
|
|
check_hresult(_winrt_cast_result_code);
|
|
auto const _winrt_abi_type =
|
|
*(abi_t<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSession4>**)&_winrt_casted_result;
|
|
check_hresult(_winrt_abi_type->GetEmbeddings(
|
|
*(void**)(&prompt), impl::bind_in(contentFilterOptions), &result));
|
|
} else {
|
|
auto const _winrt_abi_type =
|
|
*(abi_t<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSession4>**)this;
|
|
check_hresult(_winrt_abi_type->GetEmbeddings(
|
|
*(void**)(&prompt), impl::bind_in(contentFilterOptions), &result));
|
|
}
|
|
return winrt::Windows::Foundation::Collections::IVectorView<
|
|
winrt::Microsoft::Windows::SemanticSearch::EmbeddingVector>{
|
|
result, take_ownership_from_abi};
|
|
}
|
|
template <typename D>
|
|
auto consume_Microsoft_Windows_AI_GenerativeInternal_ILanguageModelSession4<D>::
|
|
GenerateResponse(
|
|
winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
LanguageModelOptionsInternal const& options,
|
|
param::hstring const& prompt, uint32_t priority, uint32_t frequency,
|
|
winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ContentFilterOptionsInternal const& contentFilterOptions,
|
|
winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSessionContext const& context) const {
|
|
void* result{};
|
|
if constexpr (!std::is_same_v<
|
|
D, winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSession4>) {
|
|
winrt::hresult _winrt_cast_result_code;
|
|
auto const _winrt_casted_result =
|
|
impl::try_as_with_reason<winrt::Microsoft::Windows::AI::
|
|
GenerativeInternal::ILanguageModelSession4,
|
|
D const*>(static_cast<D const*>(this),
|
|
_winrt_cast_result_code);
|
|
check_hresult(_winrt_cast_result_code);
|
|
auto const _winrt_abi_type =
|
|
*(abi_t<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSession4>**)&_winrt_casted_result;
|
|
check_hresult(_winrt_abi_type->GenerateResponse(
|
|
impl::bind_in(options), *(void**)(&prompt), priority, frequency,
|
|
impl::bind_in(contentFilterOptions), *(void**)(&context), &result));
|
|
} else {
|
|
auto const _winrt_abi_type =
|
|
*(abi_t<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSession4>**)this;
|
|
check_hresult(_winrt_abi_type->GenerateResponse(
|
|
impl::bind_in(options), *(void**)(&prompt), priority, frequency,
|
|
impl::bind_in(contentFilterOptions), *(void**)(&context), &result));
|
|
}
|
|
return hstring{result, take_ownership_from_abi};
|
|
}
|
|
template <typename D>
|
|
auto consume_Microsoft_Windows_AI_GenerativeInternal_ILanguageModelSession4<D>::
|
|
GenerateResponseWithProgressEvent(
|
|
winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
LanguageModelOptionsInternal const& options,
|
|
param::hstring const& prompt, winrt::guid const& eventToken,
|
|
uint32_t priority, uint32_t frequency,
|
|
winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ContentFilterOptionsInternal const& contentFilterOptions,
|
|
winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSessionContext const& context) const {
|
|
void* result{};
|
|
if constexpr (!std::is_same_v<
|
|
D, winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSession4>) {
|
|
winrt::hresult _winrt_cast_result_code;
|
|
auto const _winrt_casted_result =
|
|
impl::try_as_with_reason<winrt::Microsoft::Windows::AI::
|
|
GenerativeInternal::ILanguageModelSession4,
|
|
D const*>(static_cast<D const*>(this),
|
|
_winrt_cast_result_code);
|
|
check_hresult(_winrt_cast_result_code);
|
|
auto const _winrt_abi_type =
|
|
*(abi_t<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSession4>**)&_winrt_casted_result;
|
|
check_hresult(_winrt_abi_type->GenerateResponseWithProgressEvent2(
|
|
impl::bind_in(options), *(void**)(&prompt), impl::bind_in(eventToken),
|
|
priority, frequency, impl::bind_in(contentFilterOptions),
|
|
*(void**)(&context), &result));
|
|
} else {
|
|
auto const _winrt_abi_type =
|
|
*(abi_t<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSession4>**)this;
|
|
check_hresult(_winrt_abi_type->GenerateResponseWithProgressEvent2(
|
|
impl::bind_in(options), *(void**)(&prompt), impl::bind_in(eventToken),
|
|
priority, frequency, impl::bind_in(contentFilterOptions),
|
|
*(void**)(&context), &result));
|
|
}
|
|
return hstring{result, take_ownership_from_abi};
|
|
}
|
|
template <typename D>
|
|
auto consume_Microsoft_Windows_AI_GenerativeInternal_ILanguageModelSession4<D>::
|
|
GenerateResponseWithProgressEvent(
|
|
winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
LanguageModelOptionsInternal const& options,
|
|
param::vector_view<
|
|
winrt::Microsoft::Windows::SemanticSearch::EmbeddingVector> const&
|
|
promptEmbedding,
|
|
winrt::guid const& eventToken, uint32_t priority, uint32_t frequency,
|
|
winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ContentFilterOptionsInternal const& contentFilterOptions,
|
|
winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSessionContext const& context) const {
|
|
void* result{};
|
|
if constexpr (!std::is_same_v<
|
|
D, winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSession4>) {
|
|
winrt::hresult _winrt_cast_result_code;
|
|
auto const _winrt_casted_result =
|
|
impl::try_as_with_reason<winrt::Microsoft::Windows::AI::
|
|
GenerativeInternal::ILanguageModelSession4,
|
|
D const*>(static_cast<D const*>(this),
|
|
_winrt_cast_result_code);
|
|
check_hresult(_winrt_cast_result_code);
|
|
auto const _winrt_abi_type =
|
|
*(abi_t<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSession4>**)&_winrt_casted_result;
|
|
check_hresult(_winrt_abi_type->GenerateResponseWithProgressEvent3(
|
|
impl::bind_in(options), *(void**)(&promptEmbedding),
|
|
impl::bind_in(eventToken), priority, frequency,
|
|
impl::bind_in(contentFilterOptions), *(void**)(&context), &result));
|
|
} else {
|
|
auto const _winrt_abi_type =
|
|
*(abi_t<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSession4>**)this;
|
|
check_hresult(_winrt_abi_type->GenerateResponseWithProgressEvent3(
|
|
impl::bind_in(options), *(void**)(&promptEmbedding),
|
|
impl::bind_in(eventToken), priority, frequency,
|
|
impl::bind_in(contentFilterOptions), *(void**)(&context), &result));
|
|
}
|
|
return hstring{result, take_ownership_from_abi};
|
|
}
|
|
template <typename D>
|
|
auto consume_Microsoft_Windows_AI_GenerativeInternal_ILanguageModelSession4<D>::
|
|
GenerateResponseWithProgressEvent(
|
|
winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
LanguageModelOptionsInternal const& options,
|
|
param::vector_view<int64_t> const& promptTokens,
|
|
winrt::guid const& eventToken, uint32_t priority, uint32_t frequency,
|
|
winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ContentFilterOptionsInternal const& contentFilterOptions,
|
|
winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSessionContext const& context) const {
|
|
void* result{};
|
|
if constexpr (!std::is_same_v<
|
|
D, winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSession4>) {
|
|
winrt::hresult _winrt_cast_result_code;
|
|
auto const _winrt_casted_result =
|
|
impl::try_as_with_reason<winrt::Microsoft::Windows::AI::
|
|
GenerativeInternal::ILanguageModelSession4,
|
|
D const*>(static_cast<D const*>(this),
|
|
_winrt_cast_result_code);
|
|
check_hresult(_winrt_cast_result_code);
|
|
auto const _winrt_abi_type =
|
|
*(abi_t<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSession4>**)&_winrt_casted_result;
|
|
check_hresult(_winrt_abi_type->GenerateResponseWithProgressEvent4(
|
|
impl::bind_in(options), *(void**)(&promptTokens),
|
|
impl::bind_in(eventToken), priority, frequency,
|
|
impl::bind_in(contentFilterOptions), *(void**)(&context), &result));
|
|
} else {
|
|
auto const _winrt_abi_type =
|
|
*(abi_t<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSession4>**)this;
|
|
check_hresult(_winrt_abi_type->GenerateResponseWithProgressEvent4(
|
|
impl::bind_in(options), *(void**)(&promptTokens),
|
|
impl::bind_in(eventToken), priority, frequency,
|
|
impl::bind_in(contentFilterOptions), *(void**)(&context), &result));
|
|
}
|
|
return hstring{result, take_ownership_from_abi};
|
|
}
|
|
template <typename D>
|
|
auto consume_Microsoft_Windows_AI_GenerativeInternal_ILanguageModelSession4<
|
|
D>::CreateContext(winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
LanguageModelInitialContextParam const& contextParam,
|
|
winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ContentFilterOptionsInternal const&
|
|
contentFilterOptions) const {
|
|
void* result{};
|
|
if constexpr (!std::is_same_v<
|
|
D, winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSession4>) {
|
|
winrt::hresult _winrt_cast_result_code;
|
|
auto const _winrt_casted_result =
|
|
impl::try_as_with_reason<winrt::Microsoft::Windows::AI::
|
|
GenerativeInternal::ILanguageModelSession4,
|
|
D const*>(static_cast<D const*>(this),
|
|
_winrt_cast_result_code);
|
|
check_hresult(_winrt_cast_result_code);
|
|
auto const _winrt_abi_type =
|
|
*(abi_t<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSession4>**)&_winrt_casted_result;
|
|
check_hresult(_winrt_abi_type->CreateContext(
|
|
impl::bind_in(contextParam), impl::bind_in(contentFilterOptions),
|
|
&result));
|
|
} else {
|
|
auto const _winrt_abi_type =
|
|
*(abi_t<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSession4>**)this;
|
|
check_hresult(_winrt_abi_type->CreateContext(
|
|
impl::bind_in(contextParam), impl::bind_in(contentFilterOptions),
|
|
&result));
|
|
}
|
|
return winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSessionContext{result, take_ownership_from_abi};
|
|
}
|
|
template <typename D>
|
|
auto consume_Microsoft_Windows_AI_GenerativeInternal_ILanguageModelSession4<D>::
|
|
IsPromptLargerThanContext(
|
|
winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSessionContext const& context,
|
|
param::hstring const& prompt) const {
|
|
bool result{};
|
|
if constexpr (!std::is_same_v<
|
|
D, winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSession4>) {
|
|
winrt::hresult _winrt_cast_result_code;
|
|
auto const _winrt_casted_result =
|
|
impl::try_as_with_reason<winrt::Microsoft::Windows::AI::
|
|
GenerativeInternal::ILanguageModelSession4,
|
|
D const*>(static_cast<D const*>(this),
|
|
_winrt_cast_result_code);
|
|
check_hresult(_winrt_cast_result_code);
|
|
auto const _winrt_abi_type =
|
|
*(abi_t<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSession4>**)&_winrt_casted_result;
|
|
check_hresult(_winrt_abi_type->IsPromptLargerThanContext(
|
|
*(void**)(&context), *(void**)(&prompt), &result));
|
|
} else {
|
|
auto const _winrt_abi_type =
|
|
*(abi_t<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSession4>**)this;
|
|
check_hresult(_winrt_abi_type->IsPromptLargerThanContext(
|
|
*(void**)(&context), *(void**)(&prompt), &result));
|
|
}
|
|
return result;
|
|
}
|
|
template <typename D>
|
|
auto consume_Microsoft_Windows_AI_GenerativeInternal_ILanguageModelSession5<
|
|
D>::GetContextPromptCutoffIndex(param::hstring const& prompt) const {
|
|
uint64_t result{};
|
|
if constexpr (!std::is_same_v<
|
|
D, winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSession5>) {
|
|
winrt::hresult _winrt_cast_result_code;
|
|
auto const _winrt_casted_result =
|
|
impl::try_as_with_reason<winrt::Microsoft::Windows::AI::
|
|
GenerativeInternal::ILanguageModelSession5,
|
|
D const*>(static_cast<D const*>(this),
|
|
_winrt_cast_result_code);
|
|
check_hresult(_winrt_cast_result_code);
|
|
auto const _winrt_abi_type =
|
|
*(abi_t<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSession5>**)&_winrt_casted_result;
|
|
check_hresult(_winrt_abi_type->GetContextPromptCutoffIndex(
|
|
*(void**)(&prompt), &result));
|
|
} else {
|
|
auto const _winrt_abi_type =
|
|
*(abi_t<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSession5>**)this;
|
|
check_hresult(_winrt_abi_type->GetContextPromptCutoffIndex(
|
|
*(void**)(&prompt), &result));
|
|
}
|
|
return result;
|
|
}
|
|
template <typename D>
|
|
auto consume_Microsoft_Windows_AI_GenerativeInternal_ILanguageModelSession5<D>::
|
|
GetContextPromptCutoffIndex(
|
|
winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSessionContext const& context,
|
|
param::hstring const& prompt) const {
|
|
uint64_t result{};
|
|
if constexpr (!std::is_same_v<
|
|
D, winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSession5>) {
|
|
winrt::hresult _winrt_cast_result_code;
|
|
auto const _winrt_casted_result =
|
|
impl::try_as_with_reason<winrt::Microsoft::Windows::AI::
|
|
GenerativeInternal::ILanguageModelSession5,
|
|
D const*>(static_cast<D const*>(this),
|
|
_winrt_cast_result_code);
|
|
check_hresult(_winrt_cast_result_code);
|
|
auto const _winrt_abi_type =
|
|
*(abi_t<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSession5>**)&_winrt_casted_result;
|
|
check_hresult(_winrt_abi_type->GetContextPromptCutoffIndex2(
|
|
*(void**)(&context), *(void**)(&prompt), &result));
|
|
} else {
|
|
auto const _winrt_abi_type =
|
|
*(abi_t<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSession5>**)this;
|
|
check_hresult(_winrt_abi_type->GetContextPromptCutoffIndex2(
|
|
*(void**)(&context), *(void**)(&prompt), &result));
|
|
}
|
|
return result;
|
|
}
|
|
template <typename D>
|
|
auto consume_Microsoft_Windows_AI_GenerativeInternal_ILanguageModelSession6<D>::
|
|
GenerateResponseWithProgressEvent(
|
|
winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
LanguageModelOptionsInternal const& options,
|
|
param::iterable<
|
|
winrt::Microsoft::Windows::SemanticSearch::EmbeddingVector> const&
|
|
promptEmbedding,
|
|
winrt::guid const& eventToken, uint32_t priority, uint32_t frequency,
|
|
winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ContentFilterOptionsInternal const& contentFilterOptions,
|
|
winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSessionContext const& context) const {
|
|
void* result{};
|
|
if constexpr (!std::is_same_v<
|
|
D, winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSession6>) {
|
|
winrt::hresult _winrt_cast_result_code;
|
|
auto const _winrt_casted_result =
|
|
impl::try_as_with_reason<winrt::Microsoft::Windows::AI::
|
|
GenerativeInternal::ILanguageModelSession6,
|
|
D const*>(static_cast<D const*>(this),
|
|
_winrt_cast_result_code);
|
|
check_hresult(_winrt_cast_result_code);
|
|
auto const _winrt_abi_type =
|
|
*(abi_t<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSession6>**)&_winrt_casted_result;
|
|
check_hresult(_winrt_abi_type->GenerateResponseWithProgressEvent(
|
|
impl::bind_in(options), *(void**)(&promptEmbedding),
|
|
impl::bind_in(eventToken), priority, frequency,
|
|
impl::bind_in(contentFilterOptions), *(void**)(&context), &result));
|
|
} else {
|
|
auto const _winrt_abi_type =
|
|
*(abi_t<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSession6>**)this;
|
|
check_hresult(_winrt_abi_type->GenerateResponseWithProgressEvent(
|
|
impl::bind_in(options), *(void**)(&promptEmbedding),
|
|
impl::bind_in(eventToken), priority, frequency,
|
|
impl::bind_in(contentFilterOptions), *(void**)(&context), &result));
|
|
}
|
|
return hstring{result, take_ownership_from_abi};
|
|
}
|
|
template <typename D>
|
|
auto consume_Microsoft_Windows_AI_GenerativeInternal_ILanguageModelSessionCore<
|
|
D>::GetContextLength() const {
|
|
uint32_t result{};
|
|
if constexpr (!std::is_same_v<
|
|
D, winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSessionCore>) {
|
|
winrt::hresult _winrt_cast_result_code;
|
|
auto const _winrt_casted_result = impl::try_as_with_reason<
|
|
winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSessionCore,
|
|
D const*>(static_cast<D const*>(this), _winrt_cast_result_code);
|
|
check_hresult(_winrt_cast_result_code);
|
|
auto const _winrt_abi_type =
|
|
*(abi_t<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSessionCore>**)&_winrt_casted_result;
|
|
check_hresult(_winrt_abi_type->GetContextLength(&result));
|
|
} else {
|
|
auto const _winrt_abi_type =
|
|
*(abi_t<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSessionCore>**)this;
|
|
check_hresult(_winrt_abi_type->GetContextLength(&result));
|
|
}
|
|
return result;
|
|
}
|
|
template <typename D>
|
|
auto consume_Microsoft_Windows_AI_GenerativeInternal_ILanguageModelSessionCore<
|
|
D>::GetEmbeddingSize() const {
|
|
uint32_t result{};
|
|
if constexpr (!std::is_same_v<
|
|
D, winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSessionCore>) {
|
|
winrt::hresult _winrt_cast_result_code;
|
|
auto const _winrt_casted_result = impl::try_as_with_reason<
|
|
winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSessionCore,
|
|
D const*>(static_cast<D const*>(this), _winrt_cast_result_code);
|
|
check_hresult(_winrt_cast_result_code);
|
|
auto const _winrt_abi_type =
|
|
*(abi_t<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSessionCore>**)&_winrt_casted_result;
|
|
check_hresult(_winrt_abi_type->GetEmbeddingSize(&result));
|
|
} else {
|
|
auto const _winrt_abi_type =
|
|
*(abi_t<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSessionCore>**)this;
|
|
check_hresult(_winrt_abi_type->GetEmbeddingSize(&result));
|
|
}
|
|
return result;
|
|
}
|
|
template <typename D>
|
|
auto consume_Microsoft_Windows_AI_GenerativeInternal_ILanguageModelSessionCore<
|
|
D>::ModelVersion() const {
|
|
void* value{};
|
|
if constexpr (!std::is_same_v<
|
|
D, winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSessionCore>) {
|
|
winrt::hresult _winrt_cast_result_code;
|
|
auto const _winrt_casted_result = impl::try_as_with_reason<
|
|
winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSessionCore,
|
|
D const*>(static_cast<D const*>(this), _winrt_cast_result_code);
|
|
check_hresult(_winrt_cast_result_code);
|
|
auto const _winrt_abi_type =
|
|
*(abi_t<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSessionCore>**)&_winrt_casted_result;
|
|
check_hresult(_winrt_abi_type->get_ModelVersion(&value));
|
|
} else {
|
|
auto const _winrt_abi_type =
|
|
*(abi_t<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSessionCore>**)this;
|
|
check_hresult(_winrt_abi_type->get_ModelVersion(&value));
|
|
}
|
|
return hstring{value, take_ownership_from_abi};
|
|
}
|
|
template <typename D>
|
|
auto consume_Microsoft_Windows_AI_GenerativeInternal_ILanguageModelSessionCore<
|
|
D>::VectorSpaceId() const {
|
|
winrt::guid value{};
|
|
if constexpr (!std::is_same_v<
|
|
D, winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSessionCore>) {
|
|
winrt::hresult _winrt_cast_result_code;
|
|
auto const _winrt_casted_result = impl::try_as_with_reason<
|
|
winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSessionCore,
|
|
D const*>(static_cast<D const*>(this), _winrt_cast_result_code);
|
|
check_hresult(_winrt_cast_result_code);
|
|
auto const _winrt_abi_type =
|
|
*(abi_t<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSessionCore>**)&_winrt_casted_result;
|
|
check_hresult(_winrt_abi_type->get_VectorSpaceId(put_abi(value)));
|
|
} else {
|
|
auto const _winrt_abi_type =
|
|
*(abi_t<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSessionCore>**)this;
|
|
check_hresult(_winrt_abi_type->get_VectorSpaceId(put_abi(value)));
|
|
}
|
|
return value;
|
|
}
|
|
template <typename D>
|
|
auto consume_Microsoft_Windows_AI_GenerativeInternal_ILanguageModelSessionCore<
|
|
D>::GetPartialResult() const {
|
|
void* result{};
|
|
if constexpr (!std::is_same_v<
|
|
D, winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSessionCore>) {
|
|
winrt::hresult _winrt_cast_result_code;
|
|
auto const _winrt_casted_result = impl::try_as_with_reason<
|
|
winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSessionCore,
|
|
D const*>(static_cast<D const*>(this), _winrt_cast_result_code);
|
|
check_hresult(_winrt_cast_result_code);
|
|
auto const _winrt_abi_type =
|
|
*(abi_t<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSessionCore>**)&_winrt_casted_result;
|
|
check_hresult(_winrt_abi_type->GetPartialResult(&result));
|
|
} else {
|
|
auto const _winrt_abi_type =
|
|
*(abi_t<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSessionCore>**)this;
|
|
check_hresult(_winrt_abi_type->GetPartialResult(&result));
|
|
}
|
|
return hstring{result, take_ownership_from_abi};
|
|
}
|
|
template <typename D>
|
|
auto consume_Microsoft_Windows_AI_GenerativeInternal_ILanguageModelSessionCore<
|
|
D>::GetTokens(param::hstring const& prompt,
|
|
winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ContentFilterOptionsInternal const& contentFilterOptions)
|
|
const {
|
|
void* result{};
|
|
if constexpr (!std::is_same_v<
|
|
D, winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSessionCore>) {
|
|
winrt::hresult _winrt_cast_result_code;
|
|
auto const _winrt_casted_result = impl::try_as_with_reason<
|
|
winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSessionCore,
|
|
D const*>(static_cast<D const*>(this), _winrt_cast_result_code);
|
|
check_hresult(_winrt_cast_result_code);
|
|
auto const _winrt_abi_type =
|
|
*(abi_t<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSessionCore>**)&_winrt_casted_result;
|
|
check_hresult(_winrt_abi_type->GetTokens(
|
|
*(void**)(&prompt), impl::bind_in(contentFilterOptions), &result));
|
|
} else {
|
|
auto const _winrt_abi_type =
|
|
*(abi_t<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSessionCore>**)this;
|
|
check_hresult(_winrt_abi_type->GetTokens(
|
|
*(void**)(&prompt), impl::bind_in(contentFilterOptions), &result));
|
|
}
|
|
return winrt::Windows::Foundation::Collections::IVectorView<int64_t>{
|
|
result, take_ownership_from_abi};
|
|
}
|
|
template <typename D>
|
|
auto consume_Microsoft_Windows_AI_GenerativeInternal_ILanguageModelSessionCore<
|
|
D>::GetEmbeddingsCore(param::hstring const& prompt,
|
|
winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ContentFilterOptionsInternal const&
|
|
contentFilterOptions) const {
|
|
void* result{};
|
|
if constexpr (!std::is_same_v<
|
|
D, winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSessionCore>) {
|
|
winrt::hresult _winrt_cast_result_code;
|
|
auto const _winrt_casted_result = impl::try_as_with_reason<
|
|
winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSessionCore,
|
|
D const*>(static_cast<D const*>(this), _winrt_cast_result_code);
|
|
check_hresult(_winrt_cast_result_code);
|
|
auto const _winrt_abi_type =
|
|
*(abi_t<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSessionCore>**)&_winrt_casted_result;
|
|
check_hresult(_winrt_abi_type->GetEmbeddingsCore(
|
|
*(void**)(&prompt), impl::bind_in(contentFilterOptions), &result));
|
|
} else {
|
|
auto const _winrt_abi_type =
|
|
*(abi_t<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSessionCore>**)this;
|
|
check_hresult(_winrt_abi_type->GetEmbeddingsCore(
|
|
*(void**)(&prompt), impl::bind_in(contentFilterOptions), &result));
|
|
}
|
|
return winrt::Windows::Foundation::Collections::IVectorView<
|
|
winrt::Microsoft::Windows::AI::FoundationInternal::EmbeddingVector>{
|
|
result, take_ownership_from_abi};
|
|
}
|
|
template <typename D>
|
|
auto consume_Microsoft_Windows_AI_GenerativeInternal_ILanguageModelSessionCore<
|
|
D>::
|
|
GenerateResponseWithProgressEvent(
|
|
winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
LanguageModelOptionsInternal const& options,
|
|
winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
LanguageModelInitialContextParam const& contextParam,
|
|
array_view<float const> embedding, winrt::guid const& eventToken,
|
|
uint32_t priority, uint32_t frequency,
|
|
winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ContentFilterOptionsInternal const& contentFilterOptions) const {
|
|
void* result{};
|
|
if constexpr (!std::is_same_v<
|
|
D, winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSessionCore>) {
|
|
winrt::hresult _winrt_cast_result_code;
|
|
auto const _winrt_casted_result = impl::try_as_with_reason<
|
|
winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSessionCore,
|
|
D const*>(static_cast<D const*>(this), _winrt_cast_result_code);
|
|
check_hresult(_winrt_cast_result_code);
|
|
auto const _winrt_abi_type =
|
|
*(abi_t<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSessionCore>**)&_winrt_casted_result;
|
|
check_hresult(_winrt_abi_type->GenerateResponseWithProgressEvent(
|
|
impl::bind_in(options), impl::bind_in(contextParam), embedding.size(),
|
|
get_abi(embedding), impl::bind_in(eventToken), priority, frequency,
|
|
impl::bind_in(contentFilterOptions), &result));
|
|
} else {
|
|
auto const _winrt_abi_type =
|
|
*(abi_t<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSessionCore>**)this;
|
|
check_hresult(_winrt_abi_type->GenerateResponseWithProgressEvent(
|
|
impl::bind_in(options), impl::bind_in(contextParam), embedding.size(),
|
|
get_abi(embedding), impl::bind_in(eventToken), priority, frequency,
|
|
impl::bind_in(contentFilterOptions), &result));
|
|
}
|
|
return hstring{result, take_ownership_from_abi};
|
|
}
|
|
template <typename D>
|
|
auto consume_Microsoft_Windows_AI_GenerativeInternal_ILanguageModelSessionCore<
|
|
D>::
|
|
GenerateResponseWithProgressEvent(
|
|
winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
LanguageModelOptionsInternal const& options,
|
|
param::vector_view<int64_t> const& promptTokens,
|
|
winrt::guid const& eventToken, uint32_t priority, uint32_t frequency,
|
|
winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ContentFilterOptionsInternal const& contentFilterOptions,
|
|
winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSessionContext const& context) const {
|
|
void* result{};
|
|
if constexpr (!std::is_same_v<
|
|
D, winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSessionCore>) {
|
|
winrt::hresult _winrt_cast_result_code;
|
|
auto const _winrt_casted_result = impl::try_as_with_reason<
|
|
winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSessionCore,
|
|
D const*>(static_cast<D const*>(this), _winrt_cast_result_code);
|
|
check_hresult(_winrt_cast_result_code);
|
|
auto const _winrt_abi_type =
|
|
*(abi_t<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSessionCore>**)&_winrt_casted_result;
|
|
check_hresult(_winrt_abi_type->GenerateResponseWithProgressEvent2(
|
|
impl::bind_in(options), *(void**)(&promptTokens),
|
|
impl::bind_in(eventToken), priority, frequency,
|
|
impl::bind_in(contentFilterOptions), *(void**)(&context), &result));
|
|
} else {
|
|
auto const _winrt_abi_type =
|
|
*(abi_t<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSessionCore>**)this;
|
|
check_hresult(_winrt_abi_type->GenerateResponseWithProgressEvent2(
|
|
impl::bind_in(options), *(void**)(&promptTokens),
|
|
impl::bind_in(eventToken), priority, frequency,
|
|
impl::bind_in(contentFilterOptions), *(void**)(&context), &result));
|
|
}
|
|
return hstring{result, take_ownership_from_abi};
|
|
}
|
|
template <typename D>
|
|
auto consume_Microsoft_Windows_AI_GenerativeInternal_ILanguageModelSessionCore<
|
|
D>::CreateContext(winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
LanguageModelInitialContextParam const& contextParam,
|
|
winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ContentFilterOptionsInternal const&
|
|
contentFilterOptions) const {
|
|
void* result{};
|
|
if constexpr (!std::is_same_v<
|
|
D, winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSessionCore>) {
|
|
winrt::hresult _winrt_cast_result_code;
|
|
auto const _winrt_casted_result = impl::try_as_with_reason<
|
|
winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSessionCore,
|
|
D const*>(static_cast<D const*>(this), _winrt_cast_result_code);
|
|
check_hresult(_winrt_cast_result_code);
|
|
auto const _winrt_abi_type =
|
|
*(abi_t<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSessionCore>**)&_winrt_casted_result;
|
|
check_hresult(_winrt_abi_type->CreateContext(
|
|
impl::bind_in(contextParam), impl::bind_in(contentFilterOptions),
|
|
&result));
|
|
} else {
|
|
auto const _winrt_abi_type =
|
|
*(abi_t<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSessionCore>**)this;
|
|
check_hresult(_winrt_abi_type->CreateContext(
|
|
impl::bind_in(contextParam), impl::bind_in(contentFilterOptions),
|
|
&result));
|
|
}
|
|
return winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSessionContext{result, take_ownership_from_abi};
|
|
}
|
|
template <typename D>
|
|
auto consume_Microsoft_Windows_AI_GenerativeInternal_ILanguageModelSessionCore<
|
|
D>::
|
|
IsPromptLargerThanContext(
|
|
winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSessionContext const& context,
|
|
param::hstring const& prompt) const {
|
|
bool result{};
|
|
if constexpr (!std::is_same_v<
|
|
D, winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSessionCore>) {
|
|
winrt::hresult _winrt_cast_result_code;
|
|
auto const _winrt_casted_result = impl::try_as_with_reason<
|
|
winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSessionCore,
|
|
D const*>(static_cast<D const*>(this), _winrt_cast_result_code);
|
|
check_hresult(_winrt_cast_result_code);
|
|
auto const _winrt_abi_type =
|
|
*(abi_t<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSessionCore>**)&_winrt_casted_result;
|
|
check_hresult(_winrt_abi_type->IsPromptLargerThanContext(
|
|
*(void**)(&context), *(void**)(&prompt), &result));
|
|
} else {
|
|
auto const _winrt_abi_type =
|
|
*(abi_t<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSessionCore>**)this;
|
|
check_hresult(_winrt_abi_type->IsPromptLargerThanContext(
|
|
*(void**)(&context), *(void**)(&prompt), &result));
|
|
}
|
|
return result;
|
|
}
|
|
template <typename D>
|
|
auto consume_Microsoft_Windows_AI_GenerativeInternal_ILanguageModelSessionCore<
|
|
D>::
|
|
GetContextPromptCutoffIndex(
|
|
winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSessionContext const& context,
|
|
param::hstring const& prompt) const {
|
|
uint64_t result{};
|
|
if constexpr (!std::is_same_v<
|
|
D, winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSessionCore>) {
|
|
winrt::hresult _winrt_cast_result_code;
|
|
auto const _winrt_casted_result = impl::try_as_with_reason<
|
|
winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSessionCore,
|
|
D const*>(static_cast<D const*>(this), _winrt_cast_result_code);
|
|
check_hresult(_winrt_cast_result_code);
|
|
auto const _winrt_abi_type =
|
|
*(abi_t<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSessionCore>**)&_winrt_casted_result;
|
|
check_hresult(_winrt_abi_type->GetContextPromptCutoffIndex(
|
|
*(void**)(&context), *(void**)(&prompt), &result));
|
|
} else {
|
|
auto const _winrt_abi_type =
|
|
*(abi_t<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSessionCore>**)this;
|
|
check_hresult(_winrt_abi_type->GetContextPromptCutoffIndex(
|
|
*(void**)(&context), *(void**)(&prompt), &result));
|
|
}
|
|
return result;
|
|
}
|
|
template <typename D>
|
|
auto consume_Microsoft_Windows_AI_GenerativeInternal_ILanguageModelSessionCore<
|
|
D>::
|
|
GenerateResponseWithProgressEvent(
|
|
winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
LanguageModelOptionsInternal const& options,
|
|
array_view<winrt::Microsoft::Windows::AI::FoundationInternal::
|
|
EmbeddingVector const>
|
|
promptEmbedding,
|
|
winrt::guid const& eventToken, uint32_t priority, uint32_t frequency,
|
|
winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ContentFilterOptionsInternal const& contentFilterOptions,
|
|
winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSessionContext const& context) const {
|
|
void* result{};
|
|
if constexpr (!std::is_same_v<
|
|
D, winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSessionCore>) {
|
|
winrt::hresult _winrt_cast_result_code;
|
|
auto const _winrt_casted_result = impl::try_as_with_reason<
|
|
winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSessionCore,
|
|
D const*>(static_cast<D const*>(this), _winrt_cast_result_code);
|
|
check_hresult(_winrt_cast_result_code);
|
|
auto const _winrt_abi_type =
|
|
*(abi_t<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSessionCore>**)&_winrt_casted_result;
|
|
check_hresult(_winrt_abi_type->GenerateResponseWithProgressEvent3(
|
|
impl::bind_in(options), promptEmbedding.size(),
|
|
get_abi(promptEmbedding), impl::bind_in(eventToken), priority,
|
|
frequency, impl::bind_in(contentFilterOptions), *(void**)(&context),
|
|
&result));
|
|
} else {
|
|
auto const _winrt_abi_type =
|
|
*(abi_t<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSessionCore>**)this;
|
|
check_hresult(_winrt_abi_type->GenerateResponseWithProgressEvent3(
|
|
impl::bind_in(options), promptEmbedding.size(),
|
|
get_abi(promptEmbedding), impl::bind_in(eventToken), priority,
|
|
frequency, impl::bind_in(contentFilterOptions), *(void**)(&context),
|
|
&result));
|
|
}
|
|
return hstring{result, take_ownership_from_abi};
|
|
}
|
|
template <typename D>
|
|
auto consume_Microsoft_Windows_AI_GenerativeInternal_ILanguageModelSessionCore<
|
|
D>::
|
|
GenerateResponseWithProgressEvent(
|
|
winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
LanguageModelOptionsInternal const& options,
|
|
param::hstring const& prompt, winrt::guid const& eventToken,
|
|
uint32_t priority, uint32_t frequency,
|
|
winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ContentFilterOptionsInternal const& contentFilterOptions,
|
|
winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSessionContext const& context,
|
|
param::hstring const& skillOptions) const {
|
|
void* result{};
|
|
if constexpr (!std::is_same_v<
|
|
D, winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSessionCore>) {
|
|
winrt::hresult _winrt_cast_result_code;
|
|
auto const _winrt_casted_result = impl::try_as_with_reason<
|
|
winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSessionCore,
|
|
D const*>(static_cast<D const*>(this), _winrt_cast_result_code);
|
|
check_hresult(_winrt_cast_result_code);
|
|
auto const _winrt_abi_type =
|
|
*(abi_t<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSessionCore>**)&_winrt_casted_result;
|
|
check_hresult(_winrt_abi_type->GenerateResponseWithProgressEvent4(
|
|
impl::bind_in(options), *(void**)(&prompt), impl::bind_in(eventToken),
|
|
priority, frequency, impl::bind_in(contentFilterOptions),
|
|
*(void**)(&context), *(void**)(&skillOptions), &result));
|
|
} else {
|
|
auto const _winrt_abi_type =
|
|
*(abi_t<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSessionCore>**)this;
|
|
check_hresult(_winrt_abi_type->GenerateResponseWithProgressEvent4(
|
|
impl::bind_in(options), *(void**)(&prompt), impl::bind_in(eventToken),
|
|
priority, frequency, impl::bind_in(contentFilterOptions),
|
|
*(void**)(&context), *(void**)(&skillOptions), &result));
|
|
}
|
|
return hstring{result, take_ownership_from_abi};
|
|
}
|
|
template <typename D>
|
|
auto consume_Microsoft_Windows_AI_GenerativeInternal_ILanguageModelSessionCore<
|
|
D>::GetSessionBoundEmbedding(array_view<float const> data,
|
|
winrt::guid const& vectorSpaceID) const {
|
|
void* result{};
|
|
if constexpr (!std::is_same_v<
|
|
D, winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSessionCore>) {
|
|
winrt::hresult _winrt_cast_result_code;
|
|
auto const _winrt_casted_result = impl::try_as_with_reason<
|
|
winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSessionCore,
|
|
D const*>(static_cast<D const*>(this), _winrt_cast_result_code);
|
|
check_hresult(_winrt_cast_result_code);
|
|
auto const _winrt_abi_type =
|
|
*(abi_t<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSessionCore>**)&_winrt_casted_result;
|
|
check_hresult(_winrt_abi_type->GetSessionBoundEmbedding(
|
|
data.size(), get_abi(data), impl::bind_in(vectorSpaceID), &result));
|
|
} else {
|
|
auto const _winrt_abi_type =
|
|
*(abi_t<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSessionCore>**)this;
|
|
check_hresult(_winrt_abi_type->GetSessionBoundEmbedding(
|
|
data.size(), get_abi(data), impl::bind_in(vectorSpaceID), &result));
|
|
}
|
|
return winrt::Microsoft::Windows::AI::FoundationInternal::EmbeddingVector{
|
|
result, take_ownership_from_abi};
|
|
}
|
|
template <typename D>
|
|
auto consume_Microsoft_Windows_AI_GenerativeInternal_ILanguageModelSessionCore2<
|
|
D>::
|
|
GenerateResponseWithProgressEvent(
|
|
winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
LanguageModelOptionsInternal const& options,
|
|
array_view<winrt::Microsoft::Windows::AI::FoundationInternal::
|
|
EmbeddingVector const>
|
|
promptEmbedding,
|
|
winrt::guid const& eventToken, uint32_t priority, uint32_t frequency,
|
|
winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ContentFilterOptionsInternal const& contentFilterOptions,
|
|
winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSessionContext const& context,
|
|
winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSessionAdapter const& adapter) const {
|
|
void* result{};
|
|
if constexpr (!std::is_same_v<
|
|
D, winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSessionCore2>) {
|
|
winrt::hresult _winrt_cast_result_code;
|
|
auto const _winrt_casted_result = impl::try_as_with_reason<
|
|
winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSessionCore2,
|
|
D const*>(static_cast<D const*>(this), _winrt_cast_result_code);
|
|
check_hresult(_winrt_cast_result_code);
|
|
auto const _winrt_abi_type =
|
|
*(abi_t<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSessionCore2>**)&_winrt_casted_result;
|
|
check_hresult(_winrt_abi_type->GenerateResponseWithProgressEvent(
|
|
impl::bind_in(options), promptEmbedding.size(),
|
|
get_abi(promptEmbedding), impl::bind_in(eventToken), priority,
|
|
frequency, impl::bind_in(contentFilterOptions), *(void**)(&context),
|
|
*(void**)(&adapter), &result));
|
|
} else {
|
|
auto const _winrt_abi_type =
|
|
*(abi_t<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSessionCore2>**)this;
|
|
check_hresult(_winrt_abi_type->GenerateResponseWithProgressEvent(
|
|
impl::bind_in(options), promptEmbedding.size(),
|
|
get_abi(promptEmbedding), impl::bind_in(eventToken), priority,
|
|
frequency, impl::bind_in(contentFilterOptions), *(void**)(&context),
|
|
*(void**)(&adapter), &result));
|
|
}
|
|
return hstring{result, take_ownership_from_abi};
|
|
}
|
|
template <typename D>
|
|
auto consume_Microsoft_Windows_AI_GenerativeInternal_ILanguageModelSessionCore2<
|
|
D>::
|
|
GenerateResponseWithProgressEvent(
|
|
winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
LanguageModelOptionsInternal const& options,
|
|
param::hstring const& prompt, winrt::guid const& eventToken,
|
|
uint32_t priority, uint32_t frequency,
|
|
winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ContentFilterOptionsInternal const& contentFilterOptions,
|
|
winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSessionContext const& context,
|
|
param::hstring const& skillOptions,
|
|
winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSessionAdapter const& adapter) const {
|
|
void* result{};
|
|
if constexpr (!std::is_same_v<
|
|
D, winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSessionCore2>) {
|
|
winrt::hresult _winrt_cast_result_code;
|
|
auto const _winrt_casted_result = impl::try_as_with_reason<
|
|
winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSessionCore2,
|
|
D const*>(static_cast<D const*>(this), _winrt_cast_result_code);
|
|
check_hresult(_winrt_cast_result_code);
|
|
auto const _winrt_abi_type =
|
|
*(abi_t<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSessionCore2>**)&_winrt_casted_result;
|
|
check_hresult(_winrt_abi_type->GenerateResponseWithProgressEvent2(
|
|
impl::bind_in(options), *(void**)(&prompt), impl::bind_in(eventToken),
|
|
priority, frequency, impl::bind_in(contentFilterOptions),
|
|
*(void**)(&context), *(void**)(&skillOptions), *(void**)(&adapter),
|
|
&result));
|
|
} else {
|
|
auto const _winrt_abi_type =
|
|
*(abi_t<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSessionCore2>**)this;
|
|
check_hresult(_winrt_abi_type->GenerateResponseWithProgressEvent2(
|
|
impl::bind_in(options), *(void**)(&prompt), impl::bind_in(eventToken),
|
|
priority, frequency, impl::bind_in(contentFilterOptions),
|
|
*(void**)(&context), *(void**)(&skillOptions), *(void**)(&adapter),
|
|
&result));
|
|
}
|
|
return hstring{result, take_ownership_from_abi};
|
|
}
|
|
template <typename D>
|
|
auto consume_Microsoft_Windows_AI_GenerativeInternal_ITextIntelligenceSession<
|
|
D>::
|
|
GetTIContextPromptCutoffIndex(
|
|
param::hstring const& prompt,
|
|
winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSessionContext const& context,
|
|
winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
LanguageModelSkill const& skill,
|
|
param::hstring const& skillOptions) const {
|
|
uint64_t result{};
|
|
if constexpr (!std::is_same_v<
|
|
D, winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ITextIntelligenceSession>) {
|
|
winrt::hresult _winrt_cast_result_code;
|
|
auto const _winrt_casted_result = impl::try_as_with_reason<
|
|
winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ITextIntelligenceSession,
|
|
D const*>(static_cast<D const*>(this), _winrt_cast_result_code);
|
|
check_hresult(_winrt_cast_result_code);
|
|
auto const _winrt_abi_type =
|
|
*(abi_t<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ITextIntelligenceSession>**)&_winrt_casted_result;
|
|
check_hresult(_winrt_abi_type->GetTIContextPromptCutoffIndex(
|
|
*(void**)(&prompt), *(void**)(&context), static_cast<int32_t>(skill),
|
|
*(void**)(&skillOptions), &result));
|
|
} else {
|
|
auto const _winrt_abi_type =
|
|
*(abi_t<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ITextIntelligenceSession>**)this;
|
|
check_hresult(_winrt_abi_type->GetTIContextPromptCutoffIndex(
|
|
*(void**)(&prompt), *(void**)(&context), static_cast<int32_t>(skill),
|
|
*(void**)(&skillOptions), &result));
|
|
}
|
|
return result;
|
|
}
|
|
template <typename D>
|
|
struct produce<
|
|
D,
|
|
winrt::Microsoft::Windows::AI::GenerativeInternal::IImageDescriptionSession>
|
|
: produce_base<D, winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
IImageDescriptionSession> {
|
|
int32_t __stdcall DescribeAsync(
|
|
void* imageBufferResource, int32_t kind,
|
|
struct
|
|
struct_Microsoft_Windows_AI_GenerativeInternal_ContentFilterOptionsInternal
|
|
contentFilterOptions,
|
|
void** result) noexcept final try {
|
|
clear_abi(result);
|
|
typename D::abi_guard guard(this->shim());
|
|
*result = detach_from<
|
|
winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
IImageDescriptionSessionResult>(this->shim().DescribeAsync(
|
|
*reinterpret_cast<winrt::Microsoft::Windows::PrivateCommon::
|
|
ImageBufferResource const*>(&imageBufferResource),
|
|
*reinterpret_cast<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ImageDescriptionKindInternal const*>(&kind),
|
|
*reinterpret_cast<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ContentFilterOptionsInternal const*>(
|
|
&contentFilterOptions)));
|
|
return 0;
|
|
} catch (...) {
|
|
return to_hresult();
|
|
}
|
|
int32_t __stdcall GetPartialResult(void** result) noexcept final try {
|
|
clear_abi(result);
|
|
typename D::abi_guard guard(this->shim());
|
|
*result = detach_from<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
IImageDescriptionSessionResult>(
|
|
this->shim().GetPartialResult());
|
|
return 0;
|
|
} catch (...) {
|
|
return to_hresult();
|
|
}
|
|
};
|
|
template <typename D>
|
|
struct produce<D, winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
IImageDescriptionSessionResult>
|
|
: produce_base<D, winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
IImageDescriptionSessionResult> {
|
|
int32_t __stdcall get_Description(void** value) noexcept final try {
|
|
clear_abi(value);
|
|
typename D::abi_guard guard(this->shim());
|
|
*value = detach_from<hstring>(this->shim().Description());
|
|
return 0;
|
|
} catch (...) {
|
|
return to_hresult();
|
|
}
|
|
int32_t __stdcall get_Status(int32_t* value) noexcept final try {
|
|
typename D::abi_guard guard(this->shim());
|
|
*value = detach_from<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ImageDescriptionResultStatusInternal>(
|
|
this->shim().Status());
|
|
return 0;
|
|
} catch (...) {
|
|
return to_hresult();
|
|
}
|
|
};
|
|
template <typename D>
|
|
struct produce<
|
|
D,
|
|
winrt::Microsoft::Windows::AI::GenerativeInternal::IImageLLMAdapterSession>
|
|
: produce_base<D, winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
IImageLLMAdapterSession> {
|
|
int32_t __stdcall GetImageLLMEmbeddings(uint32_t __dataSize, float* data,
|
|
uint32_t priority,
|
|
void** result) noexcept final try {
|
|
clear_abi(result);
|
|
typename D::abi_guard guard(this->shim());
|
|
*result = detach_from<
|
|
winrt::Windows::Foundation::Collections::IVectorView<float>>(
|
|
this->shim().GetImageLLMEmbeddings(
|
|
array_view<float const>(
|
|
reinterpret_cast<float const*>(data),
|
|
reinterpret_cast<float const*>(data) + __dataSize),
|
|
priority));
|
|
return 0;
|
|
} catch (...) {
|
|
return to_hresult();
|
|
}
|
|
int32_t __stdcall GetModelInputSize(uint32_t priority,
|
|
uint32_t* result) noexcept final try {
|
|
typename D::abi_guard guard(this->shim());
|
|
*result = detach_from<uint32_t>(this->shim().GetModelInputSize(priority));
|
|
return 0;
|
|
} catch (...) {
|
|
return to_hresult();
|
|
}
|
|
int32_t __stdcall GetModelOutputSize(uint32_t priority,
|
|
uint32_t* result) noexcept final try {
|
|
typename D::abi_guard guard(this->shim());
|
|
*result = detach_from<uint32_t>(this->shim().GetModelOutputSize(priority));
|
|
return 0;
|
|
} catch (...) {
|
|
return to_hresult();
|
|
}
|
|
};
|
|
template <typename D>
|
|
struct produce<
|
|
D, winrt::Microsoft::Windows::AI::GenerativeInternal::ILanguageModelSession>
|
|
: produce_base<D, winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSession> {
|
|
int32_t __stdcall GenerateResponseAsync(void* prompt,
|
|
void** operation) noexcept final try {
|
|
clear_abi(operation);
|
|
typename D::abi_guard guard(this->shim());
|
|
*operation =
|
|
detach_from<winrt::Windows::Foundation::IAsyncOperation<hstring>>(
|
|
this->shim().GenerateResponseAsync(
|
|
*reinterpret_cast<hstring const*>(&prompt)));
|
|
return 0;
|
|
} catch (...) {
|
|
return to_hresult();
|
|
}
|
|
int32_t __stdcall GetContextLength(uint32_t* result) noexcept final try {
|
|
typename D::abi_guard guard(this->shim());
|
|
*result = detach_from<uint32_t>(this->shim().GetContextLength());
|
|
return 0;
|
|
} catch (...) {
|
|
return to_hresult();
|
|
}
|
|
int32_t __stdcall GenerateEmbeddings(void* prompt,
|
|
void** operation) noexcept final try {
|
|
clear_abi(operation);
|
|
typename D::abi_guard guard(this->shim());
|
|
*operation = detach_from<winrt::Windows::Foundation::IAsyncOperation<
|
|
winrt::Windows::Foundation::Collections::IVectorView<
|
|
winrt::Microsoft::Windows::SemanticSearch::EmbeddingVector>>>(
|
|
this->shim().GenerateEmbeddings(
|
|
*reinterpret_cast<hstring const*>(&prompt)));
|
|
return 0;
|
|
} catch (...) {
|
|
return to_hresult();
|
|
}
|
|
int32_t __stdcall GetTokensAsync(void* prompt,
|
|
void** operation) noexcept final try {
|
|
clear_abi(operation);
|
|
typename D::abi_guard guard(this->shim());
|
|
*operation = detach_from<winrt::Windows::Foundation::IAsyncOperation<
|
|
winrt::Windows::Foundation::Collections::IVectorView<int64_t>>>(
|
|
this->shim().GetTokensAsync(
|
|
*reinterpret_cast<hstring const*>(&prompt)));
|
|
return 0;
|
|
} catch (...) {
|
|
return to_hresult();
|
|
}
|
|
int32_t __stdcall get_ModelVersion(void** value) noexcept final try {
|
|
clear_abi(value);
|
|
typename D::abi_guard guard(this->shim());
|
|
*value = detach_from<hstring>(this->shim().ModelVersion());
|
|
return 0;
|
|
} catch (...) {
|
|
return to_hresult();
|
|
}
|
|
int32_t __stdcall get_VectorSpaceId(winrt::guid* value) noexcept final try {
|
|
typename D::abi_guard guard(this->shim());
|
|
*value = detach_from<winrt::guid>(this->shim().VectorSpaceId());
|
|
return 0;
|
|
} catch (...) {
|
|
return to_hresult();
|
|
}
|
|
};
|
|
template <typename D>
|
|
struct produce<
|
|
D,
|
|
winrt::Microsoft::Windows::AI::GenerativeInternal::ILanguageModelSession2>
|
|
: produce_base<D, winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSession2> {
|
|
int32_t __stdcall IsPromptLargerThanContext(void* prompt,
|
|
bool* result) noexcept final try {
|
|
typename D::abi_guard guard(this->shim());
|
|
*result = detach_from<bool>(this->shim().IsPromptLargerThanContext(
|
|
*reinterpret_cast<hstring const*>(&prompt)));
|
|
return 0;
|
|
} catch (...) {
|
|
return to_hresult();
|
|
}
|
|
int32_t __stdcall GenerateResponseWithProgressEvent(
|
|
void* prompt, winrt::guid eventToken, void** result) noexcept final try {
|
|
clear_abi(result);
|
|
typename D::abi_guard guard(this->shim());
|
|
*result =
|
|
detach_from<hstring>(this->shim().GenerateResponseWithProgressEvent(
|
|
*reinterpret_cast<hstring const*>(&prompt),
|
|
*reinterpret_cast<winrt::guid const*>(&eventToken)));
|
|
return 0;
|
|
} catch (...) {
|
|
return to_hresult();
|
|
}
|
|
int32_t __stdcall GenerateResponseWithProgressEvent2(
|
|
void* promptTokens, winrt::guid eventToken, void** result) noexcept final
|
|
try {
|
|
clear_abi(result);
|
|
typename D::abi_guard guard(this->shim());
|
|
*result =
|
|
detach_from<hstring>(this->shim().GenerateResponseWithProgressEvent(
|
|
*reinterpret_cast<winrt::Windows::Foundation::Collections::
|
|
IVectorView<int64_t> const*>(&promptTokens),
|
|
*reinterpret_cast<winrt::guid const*>(&eventToken)));
|
|
return 0;
|
|
} catch (...) {
|
|
return to_hresult();
|
|
}
|
|
int32_t __stdcall GenerateResponseWithProgressEvent3(
|
|
void* promptEmbedding, winrt::guid eventToken,
|
|
void** result) noexcept final try {
|
|
clear_abi(result);
|
|
typename D::abi_guard guard(this->shim());
|
|
*result = detach_from<
|
|
hstring>(this->shim().GenerateResponseWithProgressEvent(
|
|
*reinterpret_cast<winrt::Windows::Foundation::Collections::IVectorView<
|
|
winrt::Microsoft::Windows::SemanticSearch::EmbeddingVector> const*>(
|
|
&promptEmbedding),
|
|
*reinterpret_cast<winrt::guid const*>(&eventToken)));
|
|
return 0;
|
|
} catch (...) {
|
|
return to_hresult();
|
|
}
|
|
int32_t __stdcall GetPartialResult(void** result) noexcept final try {
|
|
clear_abi(result);
|
|
typename D::abi_guard guard(this->shim());
|
|
*result = detach_from<hstring>(this->shim().GetPartialResult());
|
|
return 0;
|
|
} catch (...) {
|
|
return to_hresult();
|
|
}
|
|
};
|
|
template <typename D>
|
|
struct produce<
|
|
D,
|
|
winrt::Microsoft::Windows::AI::GenerativeInternal::ILanguageModelSession3>
|
|
: produce_base<D, winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSession3> {
|
|
int32_t __stdcall GetTokens(void* prompt, void** result) noexcept final try {
|
|
clear_abi(result);
|
|
typename D::abi_guard guard(this->shim());
|
|
*result = detach_from<
|
|
winrt::Windows::Foundation::Collections::IVectorView<int64_t>>(
|
|
this->shim().GetTokens(*reinterpret_cast<hstring const*>(&prompt)));
|
|
return 0;
|
|
} catch (...) {
|
|
return to_hresult();
|
|
}
|
|
int32_t __stdcall GetEmbeddings(void* prompt, void** result) noexcept final
|
|
try {
|
|
clear_abi(result);
|
|
typename D::abi_guard guard(this->shim());
|
|
*result = detach_from<winrt::Windows::Foundation::Collections::IVectorView<
|
|
winrt::Microsoft::Windows::SemanticSearch::EmbeddingVector>>(
|
|
this->shim().GetEmbeddings(*reinterpret_cast<hstring const*>(&prompt)));
|
|
return 0;
|
|
} catch (...) {
|
|
return to_hresult();
|
|
}
|
|
int32_t __stdcall GenerateResponse(
|
|
struct
|
|
struct_Microsoft_Windows_AI_GenerativeInternal_LanguageModelOptionsInternal
|
|
options,
|
|
void* prompt, uint32_t priority, uint32_t frequency,
|
|
void** result) noexcept final try {
|
|
clear_abi(result);
|
|
typename D::abi_guard guard(this->shim());
|
|
*result = detach_from<hstring>(this->shim().GenerateResponse(
|
|
*reinterpret_cast<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
LanguageModelOptionsInternal const*>(&options),
|
|
*reinterpret_cast<hstring const*>(&prompt), priority, frequency));
|
|
return 0;
|
|
} catch (...) {
|
|
return to_hresult();
|
|
}
|
|
int32_t __stdcall GenerateResponseWithProgressEvent(
|
|
struct
|
|
struct_Microsoft_Windows_AI_GenerativeInternal_LanguageModelOptionsInternal
|
|
options,
|
|
void* prompt, winrt::guid eventToken, uint32_t priority,
|
|
uint32_t frequency, void** result) noexcept final try {
|
|
clear_abi(result);
|
|
typename D::abi_guard guard(this->shim());
|
|
*result = detach_from<
|
|
hstring>(this->shim().GenerateResponseWithProgressEvent(
|
|
*reinterpret_cast<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
LanguageModelOptionsInternal const*>(&options),
|
|
*reinterpret_cast<hstring const*>(&prompt),
|
|
*reinterpret_cast<winrt::guid const*>(&eventToken), priority,
|
|
frequency));
|
|
return 0;
|
|
} catch (...) {
|
|
return to_hresult();
|
|
}
|
|
int32_t __stdcall GenerateResponseWithProgressEvent2(
|
|
struct
|
|
struct_Microsoft_Windows_AI_GenerativeInternal_LanguageModelOptionsInternal
|
|
options,
|
|
void* promptEmbedding, winrt::guid eventToken, uint32_t priority,
|
|
uint32_t frequency, void** result) noexcept final try {
|
|
clear_abi(result);
|
|
typename D::abi_guard guard(this->shim());
|
|
*result = detach_from<
|
|
hstring>(this->shim().GenerateResponseWithProgressEvent(
|
|
*reinterpret_cast<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
LanguageModelOptionsInternal const*>(&options),
|
|
*reinterpret_cast<winrt::Windows::Foundation::Collections::IVectorView<
|
|
winrt::Microsoft::Windows::SemanticSearch::EmbeddingVector> const*>(
|
|
&promptEmbedding),
|
|
*reinterpret_cast<winrt::guid const*>(&eventToken), priority,
|
|
frequency));
|
|
return 0;
|
|
} catch (...) {
|
|
return to_hresult();
|
|
}
|
|
int32_t __stdcall GenerateResponseWithProgressEvent3(
|
|
struct
|
|
struct_Microsoft_Windows_AI_GenerativeInternal_LanguageModelOptionsInternal
|
|
options,
|
|
void* promptTokens, winrt::guid eventToken, uint32_t priority,
|
|
uint32_t frequency, void** result) noexcept final try {
|
|
clear_abi(result);
|
|
typename D::abi_guard guard(this->shim());
|
|
*result = detach_from<
|
|
hstring>(this->shim().GenerateResponseWithProgressEvent(
|
|
*reinterpret_cast<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
LanguageModelOptionsInternal const*>(&options),
|
|
*reinterpret_cast<winrt::Windows::Foundation::Collections::IVectorView<
|
|
int64_t> const*>(&promptTokens),
|
|
*reinterpret_cast<winrt::guid const*>(&eventToken), priority,
|
|
frequency));
|
|
return 0;
|
|
} catch (...) {
|
|
return to_hresult();
|
|
}
|
|
};
|
|
template <typename D>
|
|
struct produce<
|
|
D,
|
|
winrt::Microsoft::Windows::AI::GenerativeInternal::ILanguageModelSession4>
|
|
: produce_base<D, winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSession4> {
|
|
int32_t __stdcall GetEmbeddingSize(uint32_t* result) noexcept final try {
|
|
typename D::abi_guard guard(this->shim());
|
|
*result = detach_from<uint32_t>(this->shim().GetEmbeddingSize());
|
|
return 0;
|
|
} catch (...) {
|
|
return to_hresult();
|
|
}
|
|
int32_t __stdcall GenerateResponseWithProgressEvent(
|
|
struct
|
|
struct_Microsoft_Windows_AI_GenerativeInternal_LanguageModelOptionsInternal
|
|
options,
|
|
struct
|
|
struct_Microsoft_Windows_AI_GenerativeInternal_LanguageModelInitialContextParam
|
|
contextParam,
|
|
uint32_t __embeddingSize, float* embedding, winrt::guid eventToken,
|
|
uint32_t priority, uint32_t frequency,
|
|
struct
|
|
struct_Microsoft_Windows_AI_GenerativeInternal_ContentFilterOptionsInternal
|
|
contentFilterOptions,
|
|
void** result) noexcept final try {
|
|
clear_abi(result);
|
|
typename D::abi_guard guard(this->shim());
|
|
*result = detach_from<
|
|
hstring>(this->shim().GenerateResponseWithProgressEvent(
|
|
*reinterpret_cast<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
LanguageModelOptionsInternal const*>(&options),
|
|
*reinterpret_cast<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
LanguageModelInitialContextParam const*>(
|
|
&contextParam),
|
|
array_view<float const>(
|
|
reinterpret_cast<float const*>(embedding),
|
|
reinterpret_cast<float const*>(embedding) + __embeddingSize),
|
|
*reinterpret_cast<winrt::guid const*>(&eventToken), priority, frequency,
|
|
*reinterpret_cast<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ContentFilterOptionsInternal const*>(
|
|
&contentFilterOptions)));
|
|
return 0;
|
|
} catch (...) {
|
|
return to_hresult();
|
|
}
|
|
int32_t __stdcall GetTokens(
|
|
void* prompt,
|
|
struct
|
|
struct_Microsoft_Windows_AI_GenerativeInternal_ContentFilterOptionsInternal
|
|
contentFilterOptions,
|
|
void** result) noexcept final try {
|
|
clear_abi(result);
|
|
typename D::abi_guard guard(this->shim());
|
|
*result = detach_from<winrt::Windows::Foundation::Collections::
|
|
IVectorView<int64_t>>(this->shim().GetTokens(
|
|
*reinterpret_cast<hstring const*>(&prompt),
|
|
*reinterpret_cast<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ContentFilterOptionsInternal const*>(
|
|
&contentFilterOptions)));
|
|
return 0;
|
|
} catch (...) {
|
|
return to_hresult();
|
|
}
|
|
int32_t __stdcall GetEmbeddings(
|
|
void* prompt,
|
|
struct
|
|
struct_Microsoft_Windows_AI_GenerativeInternal_ContentFilterOptionsInternal
|
|
contentFilterOptions,
|
|
void** result) noexcept final try {
|
|
clear_abi(result);
|
|
typename D::abi_guard guard(this->shim());
|
|
*result = detach_from<winrt::Windows::Foundation::Collections::IVectorView<
|
|
winrt::Microsoft::Windows::SemanticSearch::EmbeddingVector>>(
|
|
this->shim().GetEmbeddings(
|
|
*reinterpret_cast<hstring const*>(&prompt),
|
|
*reinterpret_cast<
|
|
winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ContentFilterOptionsInternal const*>(
|
|
&contentFilterOptions)));
|
|
return 0;
|
|
} catch (...) {
|
|
return to_hresult();
|
|
}
|
|
int32_t __stdcall GenerateResponse(
|
|
struct
|
|
struct_Microsoft_Windows_AI_GenerativeInternal_LanguageModelOptionsInternal
|
|
options,
|
|
void* prompt, uint32_t priority, uint32_t frequency,
|
|
struct
|
|
struct_Microsoft_Windows_AI_GenerativeInternal_ContentFilterOptionsInternal
|
|
contentFilterOptions,
|
|
void* context, void** result) noexcept final try {
|
|
clear_abi(result);
|
|
typename D::abi_guard guard(this->shim());
|
|
*result = detach_from<hstring>(this->shim().GenerateResponse(
|
|
*reinterpret_cast<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
LanguageModelOptionsInternal const*>(&options),
|
|
*reinterpret_cast<hstring const*>(&prompt), priority, frequency,
|
|
*reinterpret_cast<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ContentFilterOptionsInternal const*>(
|
|
&contentFilterOptions),
|
|
*reinterpret_cast<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSessionContext const*>(&context)));
|
|
return 0;
|
|
} catch (...) {
|
|
return to_hresult();
|
|
}
|
|
int32_t __stdcall GenerateResponseWithProgressEvent2(
|
|
struct
|
|
struct_Microsoft_Windows_AI_GenerativeInternal_LanguageModelOptionsInternal
|
|
options,
|
|
void* prompt, winrt::guid eventToken, uint32_t priority,
|
|
uint32_t frequency,
|
|
struct
|
|
struct_Microsoft_Windows_AI_GenerativeInternal_ContentFilterOptionsInternal
|
|
contentFilterOptions,
|
|
void* context, void** result) noexcept final try {
|
|
clear_abi(result);
|
|
typename D::abi_guard guard(this->shim());
|
|
*result = detach_from<
|
|
hstring>(this->shim().GenerateResponseWithProgressEvent(
|
|
*reinterpret_cast<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
LanguageModelOptionsInternal const*>(&options),
|
|
*reinterpret_cast<hstring const*>(&prompt),
|
|
*reinterpret_cast<winrt::guid const*>(&eventToken), priority, frequency,
|
|
*reinterpret_cast<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ContentFilterOptionsInternal const*>(
|
|
&contentFilterOptions),
|
|
*reinterpret_cast<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSessionContext const*>(&context)));
|
|
return 0;
|
|
} catch (...) {
|
|
return to_hresult();
|
|
}
|
|
int32_t __stdcall GenerateResponseWithProgressEvent3(
|
|
struct
|
|
struct_Microsoft_Windows_AI_GenerativeInternal_LanguageModelOptionsInternal
|
|
options,
|
|
void* promptEmbedding, winrt::guid eventToken, uint32_t priority,
|
|
uint32_t frequency,
|
|
struct
|
|
struct_Microsoft_Windows_AI_GenerativeInternal_ContentFilterOptionsInternal
|
|
contentFilterOptions,
|
|
void* context, void** result) noexcept final try {
|
|
clear_abi(result);
|
|
typename D::abi_guard guard(this->shim());
|
|
*result = detach_from<
|
|
hstring>(this->shim().GenerateResponseWithProgressEvent(
|
|
*reinterpret_cast<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
LanguageModelOptionsInternal const*>(&options),
|
|
*reinterpret_cast<winrt::Windows::Foundation::Collections::IVectorView<
|
|
winrt::Microsoft::Windows::SemanticSearch::EmbeddingVector> const*>(
|
|
&promptEmbedding),
|
|
*reinterpret_cast<winrt::guid const*>(&eventToken), priority, frequency,
|
|
*reinterpret_cast<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ContentFilterOptionsInternal const*>(
|
|
&contentFilterOptions),
|
|
*reinterpret_cast<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSessionContext const*>(&context)));
|
|
return 0;
|
|
} catch (...) {
|
|
return to_hresult();
|
|
}
|
|
int32_t __stdcall GenerateResponseWithProgressEvent4(
|
|
struct
|
|
struct_Microsoft_Windows_AI_GenerativeInternal_LanguageModelOptionsInternal
|
|
options,
|
|
void* promptTokens, winrt::guid eventToken, uint32_t priority,
|
|
uint32_t frequency,
|
|
struct
|
|
struct_Microsoft_Windows_AI_GenerativeInternal_ContentFilterOptionsInternal
|
|
contentFilterOptions,
|
|
void* context, void** result) noexcept final try {
|
|
clear_abi(result);
|
|
typename D::abi_guard guard(this->shim());
|
|
*result = detach_from<
|
|
hstring>(this->shim().GenerateResponseWithProgressEvent(
|
|
*reinterpret_cast<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
LanguageModelOptionsInternal const*>(&options),
|
|
*reinterpret_cast<winrt::Windows::Foundation::Collections::IVectorView<
|
|
int64_t> const*>(&promptTokens),
|
|
*reinterpret_cast<winrt::guid const*>(&eventToken), priority, frequency,
|
|
*reinterpret_cast<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ContentFilterOptionsInternal const*>(
|
|
&contentFilterOptions),
|
|
*reinterpret_cast<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSessionContext const*>(&context)));
|
|
return 0;
|
|
} catch (...) {
|
|
return to_hresult();
|
|
}
|
|
int32_t __stdcall CreateContext(
|
|
struct
|
|
struct_Microsoft_Windows_AI_GenerativeInternal_LanguageModelInitialContextParam
|
|
contextParam,
|
|
struct
|
|
struct_Microsoft_Windows_AI_GenerativeInternal_ContentFilterOptionsInternal
|
|
contentFilterOptions,
|
|
void** result) noexcept final try {
|
|
clear_abi(result);
|
|
typename D::abi_guard guard(this->shim());
|
|
*result = detach_from<
|
|
winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSessionContext>(this->shim().CreateContext(
|
|
*reinterpret_cast<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
LanguageModelInitialContextParam const*>(
|
|
&contextParam),
|
|
*reinterpret_cast<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ContentFilterOptionsInternal const*>(
|
|
&contentFilterOptions)));
|
|
return 0;
|
|
} catch (...) {
|
|
return to_hresult();
|
|
}
|
|
int32_t __stdcall IsPromptLargerThanContext(void* context, void* prompt,
|
|
bool* result) noexcept final try {
|
|
typename D::abi_guard guard(this->shim());
|
|
*result = detach_from<bool>(this->shim().IsPromptLargerThanContext(
|
|
*reinterpret_cast<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSessionContext const*>(&context),
|
|
*reinterpret_cast<hstring const*>(&prompt)));
|
|
return 0;
|
|
} catch (...) {
|
|
return to_hresult();
|
|
}
|
|
};
|
|
template <typename D>
|
|
struct produce<
|
|
D,
|
|
winrt::Microsoft::Windows::AI::GenerativeInternal::ILanguageModelSession5>
|
|
: produce_base<D, winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSession5> {
|
|
int32_t __stdcall GetContextPromptCutoffIndex(void* prompt,
|
|
uint64_t* result) noexcept final
|
|
try {
|
|
typename D::abi_guard guard(this->shim());
|
|
*result = detach_from<uint64_t>(this->shim().GetContextPromptCutoffIndex(
|
|
*reinterpret_cast<hstring const*>(&prompt)));
|
|
return 0;
|
|
} catch (...) {
|
|
return to_hresult();
|
|
}
|
|
int32_t __stdcall GetContextPromptCutoffIndex2(
|
|
void* context, void* prompt, uint64_t* result) noexcept final try {
|
|
typename D::abi_guard guard(this->shim());
|
|
*result = detach_from<uint64_t>(this->shim().GetContextPromptCutoffIndex(
|
|
*reinterpret_cast<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSessionContext const*>(&context),
|
|
*reinterpret_cast<hstring const*>(&prompt)));
|
|
return 0;
|
|
} catch (...) {
|
|
return to_hresult();
|
|
}
|
|
};
|
|
template <typename D>
|
|
struct produce<
|
|
D,
|
|
winrt::Microsoft::Windows::AI::GenerativeInternal::ILanguageModelSession6>
|
|
: produce_base<D, winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSession6> {
|
|
int32_t __stdcall GenerateResponseWithProgressEvent(
|
|
struct
|
|
struct_Microsoft_Windows_AI_GenerativeInternal_LanguageModelOptionsInternal
|
|
options,
|
|
void* promptEmbedding, winrt::guid eventToken, uint32_t priority,
|
|
uint32_t frequency,
|
|
struct
|
|
struct_Microsoft_Windows_AI_GenerativeInternal_ContentFilterOptionsInternal
|
|
contentFilterOptions,
|
|
void* context, void** result) noexcept final try {
|
|
clear_abi(result);
|
|
typename D::abi_guard guard(this->shim());
|
|
*result = detach_from<
|
|
hstring>(this->shim().GenerateResponseWithProgressEvent(
|
|
*reinterpret_cast<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
LanguageModelOptionsInternal const*>(&options),
|
|
*reinterpret_cast<winrt::Windows::Foundation::Collections::IIterable<
|
|
winrt::Microsoft::Windows::SemanticSearch::EmbeddingVector> const*>(
|
|
&promptEmbedding),
|
|
*reinterpret_cast<winrt::guid const*>(&eventToken), priority, frequency,
|
|
*reinterpret_cast<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ContentFilterOptionsInternal const*>(
|
|
&contentFilterOptions),
|
|
*reinterpret_cast<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSessionContext const*>(&context)));
|
|
return 0;
|
|
} catch (...) {
|
|
return to_hresult();
|
|
}
|
|
};
|
|
template <typename D>
|
|
struct produce<D, winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSessionAdapter>
|
|
: produce_base<D, winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSessionAdapter> {};
|
|
template <typename D>
|
|
struct produce<D, winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSessionContext>
|
|
: produce_base<D, winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSessionContext> {};
|
|
template <typename D>
|
|
struct produce<D, winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSessionCore>
|
|
: produce_base<D, winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSessionCore> {
|
|
int32_t __stdcall GetContextLength(uint32_t* result) noexcept final try {
|
|
typename D::abi_guard guard(this->shim());
|
|
*result = detach_from<uint32_t>(this->shim().GetContextLength());
|
|
return 0;
|
|
} catch (...) {
|
|
return to_hresult();
|
|
}
|
|
int32_t __stdcall GetEmbeddingSize(uint32_t* result) noexcept final try {
|
|
typename D::abi_guard guard(this->shim());
|
|
*result = detach_from<uint32_t>(this->shim().GetEmbeddingSize());
|
|
return 0;
|
|
} catch (...) {
|
|
return to_hresult();
|
|
}
|
|
int32_t __stdcall get_ModelVersion(void** value) noexcept final try {
|
|
clear_abi(value);
|
|
typename D::abi_guard guard(this->shim());
|
|
*value = detach_from<hstring>(this->shim().ModelVersion());
|
|
return 0;
|
|
} catch (...) {
|
|
return to_hresult();
|
|
}
|
|
int32_t __stdcall get_VectorSpaceId(winrt::guid* value) noexcept final try {
|
|
typename D::abi_guard guard(this->shim());
|
|
*value = detach_from<winrt::guid>(this->shim().VectorSpaceId());
|
|
return 0;
|
|
} catch (...) {
|
|
return to_hresult();
|
|
}
|
|
int32_t __stdcall GetPartialResult(void** result) noexcept final try {
|
|
clear_abi(result);
|
|
typename D::abi_guard guard(this->shim());
|
|
*result = detach_from<hstring>(this->shim().GetPartialResult());
|
|
return 0;
|
|
} catch (...) {
|
|
return to_hresult();
|
|
}
|
|
int32_t __stdcall GetTokens(
|
|
void* prompt,
|
|
struct
|
|
struct_Microsoft_Windows_AI_GenerativeInternal_ContentFilterOptionsInternal
|
|
contentFilterOptions,
|
|
void** result) noexcept final try {
|
|
clear_abi(result);
|
|
typename D::abi_guard guard(this->shim());
|
|
*result = detach_from<winrt::Windows::Foundation::Collections::
|
|
IVectorView<int64_t>>(this->shim().GetTokens(
|
|
*reinterpret_cast<hstring const*>(&prompt),
|
|
*reinterpret_cast<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ContentFilterOptionsInternal const*>(
|
|
&contentFilterOptions)));
|
|
return 0;
|
|
} catch (...) {
|
|
return to_hresult();
|
|
}
|
|
int32_t __stdcall GetEmbeddingsCore(
|
|
void* prompt,
|
|
struct
|
|
struct_Microsoft_Windows_AI_GenerativeInternal_ContentFilterOptionsInternal
|
|
contentFilterOptions,
|
|
void** result) noexcept final try {
|
|
clear_abi(result);
|
|
typename D::abi_guard guard(this->shim());
|
|
*result = detach_from<winrt::Windows::Foundation::Collections::IVectorView<
|
|
winrt::Microsoft::Windows::AI::FoundationInternal::EmbeddingVector>>(
|
|
this->shim().GetEmbeddingsCore(
|
|
*reinterpret_cast<hstring const*>(&prompt),
|
|
*reinterpret_cast<
|
|
winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ContentFilterOptionsInternal const*>(
|
|
&contentFilterOptions)));
|
|
return 0;
|
|
} catch (...) {
|
|
return to_hresult();
|
|
}
|
|
int32_t __stdcall GenerateResponseWithProgressEvent(
|
|
struct
|
|
struct_Microsoft_Windows_AI_GenerativeInternal_LanguageModelOptionsInternal
|
|
options,
|
|
struct
|
|
struct_Microsoft_Windows_AI_GenerativeInternal_LanguageModelInitialContextParam
|
|
contextParam,
|
|
uint32_t __embeddingSize, float* embedding, winrt::guid eventToken,
|
|
uint32_t priority, uint32_t frequency,
|
|
struct
|
|
struct_Microsoft_Windows_AI_GenerativeInternal_ContentFilterOptionsInternal
|
|
contentFilterOptions,
|
|
void** result) noexcept final try {
|
|
clear_abi(result);
|
|
typename D::abi_guard guard(this->shim());
|
|
*result = detach_from<
|
|
hstring>(this->shim().GenerateResponseWithProgressEvent(
|
|
*reinterpret_cast<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
LanguageModelOptionsInternal const*>(&options),
|
|
*reinterpret_cast<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
LanguageModelInitialContextParam const*>(
|
|
&contextParam),
|
|
array_view<float const>(
|
|
reinterpret_cast<float const*>(embedding),
|
|
reinterpret_cast<float const*>(embedding) + __embeddingSize),
|
|
*reinterpret_cast<winrt::guid const*>(&eventToken), priority, frequency,
|
|
*reinterpret_cast<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ContentFilterOptionsInternal const*>(
|
|
&contentFilterOptions)));
|
|
return 0;
|
|
} catch (...) {
|
|
return to_hresult();
|
|
}
|
|
int32_t __stdcall GenerateResponseWithProgressEvent2(
|
|
struct
|
|
struct_Microsoft_Windows_AI_GenerativeInternal_LanguageModelOptionsInternal
|
|
options,
|
|
void* promptTokens, winrt::guid eventToken, uint32_t priority,
|
|
uint32_t frequency,
|
|
struct
|
|
struct_Microsoft_Windows_AI_GenerativeInternal_ContentFilterOptionsInternal
|
|
contentFilterOptions,
|
|
void* context, void** result) noexcept final try {
|
|
clear_abi(result);
|
|
typename D::abi_guard guard(this->shim());
|
|
*result = detach_from<
|
|
hstring>(this->shim().GenerateResponseWithProgressEvent(
|
|
*reinterpret_cast<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
LanguageModelOptionsInternal const*>(&options),
|
|
*reinterpret_cast<winrt::Windows::Foundation::Collections::IVectorView<
|
|
int64_t> const*>(&promptTokens),
|
|
*reinterpret_cast<winrt::guid const*>(&eventToken), priority, frequency,
|
|
*reinterpret_cast<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ContentFilterOptionsInternal const*>(
|
|
&contentFilterOptions),
|
|
*reinterpret_cast<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSessionContext const*>(&context)));
|
|
return 0;
|
|
} catch (...) {
|
|
return to_hresult();
|
|
}
|
|
int32_t __stdcall CreateContext(
|
|
struct
|
|
struct_Microsoft_Windows_AI_GenerativeInternal_LanguageModelInitialContextParam
|
|
contextParam,
|
|
struct
|
|
struct_Microsoft_Windows_AI_GenerativeInternal_ContentFilterOptionsInternal
|
|
contentFilterOptions,
|
|
void** result) noexcept final try {
|
|
clear_abi(result);
|
|
typename D::abi_guard guard(this->shim());
|
|
*result = detach_from<
|
|
winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSessionContext>(this->shim().CreateContext(
|
|
*reinterpret_cast<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
LanguageModelInitialContextParam const*>(
|
|
&contextParam),
|
|
*reinterpret_cast<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ContentFilterOptionsInternal const*>(
|
|
&contentFilterOptions)));
|
|
return 0;
|
|
} catch (...) {
|
|
return to_hresult();
|
|
}
|
|
int32_t __stdcall IsPromptLargerThanContext(void* context, void* prompt,
|
|
bool* result) noexcept final try {
|
|
typename D::abi_guard guard(this->shim());
|
|
*result = detach_from<bool>(this->shim().IsPromptLargerThanContext(
|
|
*reinterpret_cast<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSessionContext const*>(&context),
|
|
*reinterpret_cast<hstring const*>(&prompt)));
|
|
return 0;
|
|
} catch (...) {
|
|
return to_hresult();
|
|
}
|
|
int32_t __stdcall GetContextPromptCutoffIndex(void* context, void* prompt,
|
|
uint64_t* result) noexcept final
|
|
try {
|
|
typename D::abi_guard guard(this->shim());
|
|
*result = detach_from<uint64_t>(this->shim().GetContextPromptCutoffIndex(
|
|
*reinterpret_cast<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSessionContext const*>(&context),
|
|
*reinterpret_cast<hstring const*>(&prompt)));
|
|
return 0;
|
|
} catch (...) {
|
|
return to_hresult();
|
|
}
|
|
int32_t __stdcall GenerateResponseWithProgressEvent3(
|
|
struct
|
|
struct_Microsoft_Windows_AI_GenerativeInternal_LanguageModelOptionsInternal
|
|
options,
|
|
uint32_t __promptEmbeddingSize, void** promptEmbedding,
|
|
winrt::guid eventToken, uint32_t priority, uint32_t frequency,
|
|
struct
|
|
struct_Microsoft_Windows_AI_GenerativeInternal_ContentFilterOptionsInternal
|
|
contentFilterOptions,
|
|
void* context, void** result) noexcept final try {
|
|
clear_abi(result);
|
|
typename D::abi_guard guard(this->shim());
|
|
*result = detach_from<
|
|
hstring>(this->shim().GenerateResponseWithProgressEvent(
|
|
*reinterpret_cast<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
LanguageModelOptionsInternal const*>(&options),
|
|
array_view<winrt::Microsoft::Windows::AI::FoundationInternal::
|
|
EmbeddingVector const>(
|
|
reinterpret_cast<winrt::Microsoft::Windows::AI::FoundationInternal::
|
|
EmbeddingVector const*>(promptEmbedding),
|
|
reinterpret_cast<winrt::Microsoft::Windows::AI::FoundationInternal::
|
|
EmbeddingVector const*>(promptEmbedding) +
|
|
__promptEmbeddingSize),
|
|
*reinterpret_cast<winrt::guid const*>(&eventToken), priority, frequency,
|
|
*reinterpret_cast<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ContentFilterOptionsInternal const*>(
|
|
&contentFilterOptions),
|
|
*reinterpret_cast<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSessionContext const*>(&context)));
|
|
return 0;
|
|
} catch (...) {
|
|
return to_hresult();
|
|
}
|
|
int32_t __stdcall GenerateResponseWithProgressEvent4(
|
|
struct
|
|
struct_Microsoft_Windows_AI_GenerativeInternal_LanguageModelOptionsInternal
|
|
options,
|
|
void* prompt, winrt::guid eventToken, uint32_t priority,
|
|
uint32_t frequency,
|
|
struct
|
|
struct_Microsoft_Windows_AI_GenerativeInternal_ContentFilterOptionsInternal
|
|
contentFilterOptions,
|
|
void* context, void* skillOptions, void** result) noexcept final try {
|
|
clear_abi(result);
|
|
typename D::abi_guard guard(this->shim());
|
|
*result = detach_from<
|
|
hstring>(this->shim().GenerateResponseWithProgressEvent(
|
|
*reinterpret_cast<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
LanguageModelOptionsInternal const*>(&options),
|
|
*reinterpret_cast<hstring const*>(&prompt),
|
|
*reinterpret_cast<winrt::guid const*>(&eventToken), priority, frequency,
|
|
*reinterpret_cast<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ContentFilterOptionsInternal const*>(
|
|
&contentFilterOptions),
|
|
*reinterpret_cast<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSessionContext const*>(&context),
|
|
*reinterpret_cast<hstring const*>(&skillOptions)));
|
|
return 0;
|
|
} catch (...) {
|
|
return to_hresult();
|
|
}
|
|
int32_t __stdcall GetSessionBoundEmbedding(uint32_t __dataSize, float* data,
|
|
winrt::guid vectorSpaceID,
|
|
void** result) noexcept final try {
|
|
clear_abi(result);
|
|
typename D::abi_guard guard(this->shim());
|
|
*result = detach_from<
|
|
winrt::Microsoft::Windows::AI::FoundationInternal::EmbeddingVector>(
|
|
this->shim().GetSessionBoundEmbedding(
|
|
array_view<float const>(
|
|
reinterpret_cast<float const*>(data),
|
|
reinterpret_cast<float const*>(data) + __dataSize),
|
|
*reinterpret_cast<winrt::guid const*>(&vectorSpaceID)));
|
|
return 0;
|
|
} catch (...) {
|
|
return to_hresult();
|
|
}
|
|
};
|
|
template <typename D>
|
|
struct produce<D, winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSessionCore2>
|
|
: produce_base<D, winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSessionCore2> {
|
|
int32_t __stdcall GenerateResponseWithProgressEvent(
|
|
struct
|
|
struct_Microsoft_Windows_AI_GenerativeInternal_LanguageModelOptionsInternal
|
|
options,
|
|
uint32_t __promptEmbeddingSize, void** promptEmbedding,
|
|
winrt::guid eventToken, uint32_t priority, uint32_t frequency,
|
|
struct
|
|
struct_Microsoft_Windows_AI_GenerativeInternal_ContentFilterOptionsInternal
|
|
contentFilterOptions,
|
|
void* context, void* adapter, void** result) noexcept final try {
|
|
clear_abi(result);
|
|
typename D::abi_guard guard(this->shim());
|
|
*result = detach_from<
|
|
hstring>(this->shim().GenerateResponseWithProgressEvent(
|
|
*reinterpret_cast<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
LanguageModelOptionsInternal const*>(&options),
|
|
array_view<winrt::Microsoft::Windows::AI::FoundationInternal::
|
|
EmbeddingVector const>(
|
|
reinterpret_cast<winrt::Microsoft::Windows::AI::FoundationInternal::
|
|
EmbeddingVector const*>(promptEmbedding),
|
|
reinterpret_cast<winrt::Microsoft::Windows::AI::FoundationInternal::
|
|
EmbeddingVector const*>(promptEmbedding) +
|
|
__promptEmbeddingSize),
|
|
*reinterpret_cast<winrt::guid const*>(&eventToken), priority, frequency,
|
|
*reinterpret_cast<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ContentFilterOptionsInternal const*>(
|
|
&contentFilterOptions),
|
|
*reinterpret_cast<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSessionContext const*>(&context),
|
|
*reinterpret_cast<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSessionAdapter const*>(&adapter)));
|
|
return 0;
|
|
} catch (...) {
|
|
return to_hresult();
|
|
}
|
|
int32_t __stdcall GenerateResponseWithProgressEvent2(
|
|
struct
|
|
struct_Microsoft_Windows_AI_GenerativeInternal_LanguageModelOptionsInternal
|
|
options,
|
|
void* prompt, winrt::guid eventToken, uint32_t priority,
|
|
uint32_t frequency,
|
|
struct
|
|
struct_Microsoft_Windows_AI_GenerativeInternal_ContentFilterOptionsInternal
|
|
contentFilterOptions,
|
|
void* context, void* skillOptions, void* adapter,
|
|
void** result) noexcept final try {
|
|
clear_abi(result);
|
|
typename D::abi_guard guard(this->shim());
|
|
*result = detach_from<
|
|
hstring>(this->shim().GenerateResponseWithProgressEvent(
|
|
*reinterpret_cast<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
LanguageModelOptionsInternal const*>(&options),
|
|
*reinterpret_cast<hstring const*>(&prompt),
|
|
*reinterpret_cast<winrt::guid const*>(&eventToken), priority, frequency,
|
|
*reinterpret_cast<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ContentFilterOptionsInternal const*>(
|
|
&contentFilterOptions),
|
|
*reinterpret_cast<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSessionContext const*>(&context),
|
|
*reinterpret_cast<hstring const*>(&skillOptions),
|
|
*reinterpret_cast<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSessionAdapter const*>(&adapter)));
|
|
return 0;
|
|
} catch (...) {
|
|
return to_hresult();
|
|
}
|
|
};
|
|
template <typename D>
|
|
struct produce<
|
|
D,
|
|
winrt::Microsoft::Windows::AI::GenerativeInternal::ITextIntelligenceSession>
|
|
: produce_base<D, winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ITextIntelligenceSession> {
|
|
int32_t __stdcall GetTIContextPromptCutoffIndex(
|
|
void* prompt, void* context, int32_t skill, void* skillOptions,
|
|
uint64_t* result) noexcept final try {
|
|
typename D::abi_guard guard(this->shim());
|
|
*result = detach_from<uint64_t>(this->shim().GetTIContextPromptCutoffIndex(
|
|
*reinterpret_cast<hstring const*>(&prompt),
|
|
*reinterpret_cast<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSessionContext const*>(&context),
|
|
*reinterpret_cast<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
LanguageModelSkill const*>(&skill),
|
|
*reinterpret_cast<hstring const*>(&skillOptions)));
|
|
return 0;
|
|
} catch (...) {
|
|
return to_hresult();
|
|
}
|
|
};
|
|
} // namespace winrt::impl
|
|
WINRT_EXPORT namespace winrt::Microsoft::Windows::AI::GenerativeInternal {}
|
|
namespace std {
|
|
#ifndef WINRT_LEAN_AND_MEAN
|
|
template <>
|
|
struct hash<
|
|
winrt::Microsoft::Windows::AI::GenerativeInternal::IImageDescriptionSession>
|
|
: winrt::impl::hash_base {};
|
|
template <>
|
|
struct hash<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
IImageDescriptionSessionResult> : winrt::impl::hash_base {};
|
|
template <>
|
|
struct hash<
|
|
winrt::Microsoft::Windows::AI::GenerativeInternal::IImageLLMAdapterSession>
|
|
: winrt::impl::hash_base {};
|
|
template <>
|
|
struct hash<
|
|
winrt::Microsoft::Windows::AI::GenerativeInternal::ILanguageModelSession>
|
|
: winrt::impl::hash_base {};
|
|
template <>
|
|
struct hash<
|
|
winrt::Microsoft::Windows::AI::GenerativeInternal::ILanguageModelSession2>
|
|
: winrt::impl::hash_base {};
|
|
template <>
|
|
struct hash<
|
|
winrt::Microsoft::Windows::AI::GenerativeInternal::ILanguageModelSession3>
|
|
: winrt::impl::hash_base {};
|
|
template <>
|
|
struct hash<
|
|
winrt::Microsoft::Windows::AI::GenerativeInternal::ILanguageModelSession4>
|
|
: winrt::impl::hash_base {};
|
|
template <>
|
|
struct hash<
|
|
winrt::Microsoft::Windows::AI::GenerativeInternal::ILanguageModelSession5>
|
|
: winrt::impl::hash_base {};
|
|
template <>
|
|
struct hash<
|
|
winrt::Microsoft::Windows::AI::GenerativeInternal::ILanguageModelSession6>
|
|
: winrt::impl::hash_base {};
|
|
template <>
|
|
struct hash<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSessionAdapter> : winrt::impl::hash_base {};
|
|
template <>
|
|
struct hash<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSessionContext> : winrt::impl::hash_base {};
|
|
template <>
|
|
struct hash<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSessionCore> : winrt::impl::hash_base {};
|
|
template <>
|
|
struct hash<winrt::Microsoft::Windows::AI::GenerativeInternal::
|
|
ILanguageModelSessionCore2> : winrt::impl::hash_base {};
|
|
template <>
|
|
struct hash<
|
|
winrt::Microsoft::Windows::AI::GenerativeInternal::ITextIntelligenceSession>
|
|
: winrt::impl::hash_base {};
|
|
#endif
|
|
#ifdef __cpp_lib_format
|
|
#endif
|
|
} // namespace std
|
|
#endif
|