async_openai_wasm/
responses.rs1use crate::{
2 Client,
3 config::Config,
4 error::OpenAIError,
5 types::responses::{CreateResponse, Response},
6};
7
8pub struct Responses<'c, C: Config> {
12 client: &'c Client<C>,
13}
14
15impl<'c, C: Config> Responses<'c, C> {
16 pub fn new(client: &'c Client<C>) -> Self {
18 Self { client }
19 }
20
21 #[crate::byot(
23 T0 = serde::Serialize,
24 R = serde::de::DeserializeOwned
25 )]
26 pub async fn create(&self, request: CreateResponse) -> Result<Response, OpenAIError> {
27 self.client.post("/responses", request).await
28 }
29}