pub struct OpenAIInstructModel<T>{ /* private fields */ }Expand description
Node for making requests to OpenAI Instruct models.
Implementations§
Source§impl<T> OpenAIInstructModel<T>
impl<T> OpenAIInstructModel<T>
Sourcepub async fn new_with_key(model: String, api_key: String) -> Self
pub async fn new_with_key(model: String, api_key: String) -> Self
Constructs a new OpenAI processor with a specified API key.
The model specified must support the instruct API.
Trait Implementations§
Source§impl<T> Debug for OpenAIInstructModel<T>
impl<T> Debug for OpenAIInstructModel<T>
Source§impl<T> Node for OpenAIInstructModel<T>
impl<T> Node for OpenAIInstructModel<T>
Source§fn process<'life0, 'async_trait>(
&'life0 self,
input: Self::Input,
) -> Pin<Box<dyn Future<Output = Result<Self::Output, AnchorChainError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn process<'life0, 'async_trait>(
&'life0 self,
input: Self::Input,
) -> Pin<Box<dyn Future<Output = Result<Self::Output, AnchorChainError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Sends the input to the OpenAI API and processes the response.
Constructs a request based on the input and the system prompt, then parses the model’s response to extract and return the processed content.
Auto Trait Implementations§
impl<T> Freeze for OpenAIInstructModel<T>
impl<T> !RefUnwindSafe for OpenAIInstructModel<T>
impl<T> Send for OpenAIInstructModel<T>where
T: Send,
impl<T> Sync for OpenAIInstructModel<T>where
T: Sync,
impl<T> Unpin for OpenAIInstructModel<T>where
T: Unpin,
impl<T> !UnwindSafe for OpenAIInstructModel<T>
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreCreates a shared type from an unshared type.