Struct openai_flows::OpenAIFlows
source · pub struct OpenAIFlows { /* private fields */ }Expand description
The main struct for setting the basic configuration for OpenAI interface.
Implementations§
source§impl OpenAIFlows
impl OpenAIFlows
sourcepub async fn chat_completion(
&self,
conversation_id: &str,
sentence: &str,
options: &ChatOptions<'_>
) -> Result<ChatResponse, String>
pub async fn chat_completion( &self, conversation_id: &str, sentence: &str, options: &ChatOptions<'_> ) -> Result<ChatResponse, String>
Create chat completion with the provided sentence. It uses OpenAI’s GPT-3.5 model to make a conversation.
conversation_id is the identifier of the conversation.
The history will be fetched and attached to the sentence as a whole prompt for ChatGPT.
sentence is a String that reprensents the current utterance of the conversation.
If you haven’t connected your OpenAI account with Flows.network platform, you will receive an error in the flow’s building log or running log.
source§impl OpenAIFlows
impl OpenAIFlows
sourcepub async fn create_completion(
&self,
params: CompletionRequest
) -> Result<Vec<String>, String>
pub async fn create_completion( &self, params: CompletionRequest ) -> Result<Vec<String>, String>
Create completion for the provided prompt and parameters.
params is a CompletionRequest object.
If you haven’t connected your OpenAI account with Flows.network platform, you will receive an error in the flow’s building log or running log.
source§impl OpenAIFlows
impl OpenAIFlows
sourcepub async fn create_embeddings(
&self,
input: EmbeddingsInput
) -> Result<Vec<Vec<f64>>, String>
pub async fn create_embeddings( &self, input: EmbeddingsInput ) -> Result<Vec<Vec<f64>>, String>
Create embeddings from the provided input.
params is an [EmbeddingsRequest] object.
If you haven’t connected your OpenAI account with Flows.network platform, you will receive an error in the flow’s building log or running log.
source§impl OpenAIFlows
impl OpenAIFlows
sourcepub async fn create_image(
&self,
params: ImageRequest
) -> Result<Vec<String>, String>
pub async fn create_image( &self, params: ImageRequest ) -> Result<Vec<String>, String>
Create image for the provided prompt and parameters.
params is a ImageRequest object.
If you haven’t connected your OpenAI account with Flows.network platform, you will receive an error in the flow’s building log or running log.