Crate openai_flows

source ·
Expand description

OpenAI integration for Flows.network

Quick Start

To get started, let’s write a very tiny flow function.

use openai_flows::{CompletionRequest, completion}
use slack_flows::{listen_to_channel, send_message_to_channel};

#[no_mangle]
pub fn run() {
    listen_to_channel("myworkspace", "mychannel", |sm| {
        let cr = CompletionRequest {
            prompt: sm.text,
            ..Default::default()
        };
        let r = create_completion("myaccount", cr);
        r.iter().for_each(|c| {
            send_message_to_channel("myworkspace", "mychannel", c.to_string());
        });
    });
}

When the Slack message is received, create completion using create_completion then send the response to Slack.

Structs

Request struct for the completion.

Functions

Create completion for the provided prompt and parameters.