Struct openai_api_rs::v1::embedding::EmbeddingRequest
source · pub struct EmbeddingRequest {
pub model: String,
pub input: String,
pub user: Option<String>,
}
Fields§
§model: String
§input: String
§user: Option<String>
Implementations§
source§impl EmbeddingRequest
impl EmbeddingRequest
sourcepub fn new(model: String, input: String) -> Self
pub fn new(model: String, input: String) -> Self
Examples found in repository?
examples/embedding.rs (lines 8-11)
5 6 7 8 9 10 11 12 13 14 15 16 17
fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = Client::new(env::var("OPENAI_API_KEY").unwrap().to_string());
let req = EmbeddingRequest::new(
"text-embedding-ada-002".to_string(),
"story time".to_string(),
);
let result = client.embedding(req)?;
println!("{:?}", result.data);
Ok(())
}
Trait Implementations§
source§impl Clone for EmbeddingRequest
impl Clone for EmbeddingRequest
source§fn clone(&self) -> EmbeddingRequest
fn clone(&self) -> EmbeddingRequest
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 moresource§impl Debug for EmbeddingRequest
impl Debug for EmbeddingRequest
Auto Trait Implementations§
impl RefUnwindSafe for EmbeddingRequest
impl Send for EmbeddingRequest
impl Sync for EmbeddingRequest
impl Unpin for EmbeddingRequest
impl UnwindSafe for EmbeddingRequest
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