#[derive(Clone, Debug, PartialEq, Eq, Hash)]
#[non_exhaustive]
pub enum EmbeddingContentFormat {
Text,
Base64,
Raw(::std::string::String),
}
impl EmbeddingContentFormat {
pub fn as_str(&self) -> &str {
match self {
Self::Text => "text",
Self::Base64 => "base64",
Self::Raw(value) => value,
}
}
pub fn from_known(value: &str) -> ::core::option::Option<Self> {
match value {
"text" => ::core::option::Option::Some(Self::Text),
"base64" => ::core::option::Option::Some(Self::Base64),
_ => ::core::option::Option::None,
}
}
}
impl ::serde::Serialize for EmbeddingContentFormat {
fn serialize<S__: ::serde::Serializer>(
&self,
serializer: S__,
) -> ::core::result::Result<S__::Ok, S__::Error> {
serializer.serialize_str(self.as_str())
}
}
impl<'de> ::serde::Deserialize<'de> for EmbeddingContentFormat {
fn deserialize<D__: ::serde::Deserializer<'de>>(
deserializer: D__,
) -> ::core::result::Result<Self, D__::Error> {
::oxsearch_core::__private::deserialize_string_enum(
deserializer,
"EmbeddingContentFormat",
|value| Self::from_known(value).unwrap_or_else(|| Self::Raw(value.to_owned())),
)
}
}
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
#[non_exhaustive]
pub enum EmbeddingContentType {
Text,
Image,
Audio,
Video,
Pdf,
Raw(::std::string::String),
}
impl EmbeddingContentType {
pub fn as_str(&self) -> &str {
match self {
Self::Text => "text",
Self::Image => "image",
Self::Audio => "audio",
Self::Video => "video",
Self::Pdf => "pdf",
Self::Raw(value) => value,
}
}
pub fn from_known(value: &str) -> ::core::option::Option<Self> {
match value {
"text" => ::core::option::Option::Some(Self::Text),
"image" => ::core::option::Option::Some(Self::Image),
"audio" => ::core::option::Option::Some(Self::Audio),
"video" => ::core::option::Option::Some(Self::Video),
"pdf" => ::core::option::Option::Some(Self::Pdf),
_ => ::core::option::Option::None,
}
}
}
impl ::serde::Serialize for EmbeddingContentType {
fn serialize<S__: ::serde::Serializer>(
&self,
serializer: S__,
) -> ::core::result::Result<S__::Ok, S__::Error> {
serializer.serialize_str(self.as_str())
}
}
impl<'de> ::serde::Deserialize<'de> for EmbeddingContentType {
fn deserialize<D__: ::serde::Deserializer<'de>>(
deserializer: D__,
) -> ::core::result::Result<Self, D__::Error> {
::oxsearch_core::__private::deserialize_string_enum(
deserializer,
"EmbeddingContentType",
|value| Self::from_known(value).unwrap_or_else(|| Self::Raw(value.to_owned())),
)
}
}