pub struct EmbeddingsInputBuilder { /* private fields */ }
Expand description
Builder for EmbeddingsInput
.
Implementations§
Source§impl EmbeddingsInputBuilder
impl EmbeddingsInputBuilder
Sourcepub fn texts<VALUE: Into<Vec<String>>>(&mut self, value: VALUE) -> &mut Self
pub fn texts<VALUE: Into<Vec<String>>>(&mut self, value: VALUE) -> &mut Self
文本列表
Examples found in repository?
examples/text-embedding.rs (lines 15-20)
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = Client::new();
let input = EmbeddingsParamBuilder::default()
.model("text-embedding-v3")
.input(
EmbeddingsInputBuilder::default()
.texts(vec![
"风急天高猿啸哀".into(),
"渚清沙白鸟飞回".into(),
"无边落木萧萧下".into(),
"不尽长江滚滚来".into()
])
.build()?,
)
.parameters(
EmbeddingsParametersBuilder::default()
.dimension(1024)
.build()?,
)
.build()?;
let output = client.text_embeddings().call(input).await?;
dbg!(output);
Ok(())
}
Sourcepub fn build(&self) -> Result<EmbeddingsInput, EmbeddingsInputBuilderError>
pub fn build(&self) -> Result<EmbeddingsInput, EmbeddingsInputBuilderError>
Examples found in repository?
examples/text-embedding.rs (line 21)
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = Client::new();
let input = EmbeddingsParamBuilder::default()
.model("text-embedding-v3")
.input(
EmbeddingsInputBuilder::default()
.texts(vec![
"风急天高猿啸哀".into(),
"渚清沙白鸟飞回".into(),
"无边落木萧萧下".into(),
"不尽长江滚滚来".into()
])
.build()?,
)
.parameters(
EmbeddingsParametersBuilder::default()
.dimension(1024)
.build()?,
)
.build()?;
let output = client.text_embeddings().call(input).await?;
dbg!(output);
Ok(())
}
Trait Implementations§
Source§impl Clone for EmbeddingsInputBuilder
impl Clone for EmbeddingsInputBuilder
Source§fn clone(&self) -> EmbeddingsInputBuilder
fn clone(&self) -> EmbeddingsInputBuilder
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl Freeze for EmbeddingsInputBuilder
impl RefUnwindSafe for EmbeddingsInputBuilder
impl Send for EmbeddingsInputBuilder
impl Sync for EmbeddingsInputBuilder
impl Unpin for EmbeddingsInputBuilder
impl UnwindSafe for EmbeddingsInputBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more