openai-flows 0.2.3

OpenAI integration for flows.network
Documentation
This is a library for integrating OpenAI in your flow function for [flows.network](https://flows.network).

## Usage example
```rust
use openai_flows::{CompletionRequest, create_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 a new message is received from `mychannel`, we will create completions using [`create_completion`](https://docs.rs/openai-flows/latest/openai_flows/fn.create_completion.html) then send the result back to Slack.

## Visit ChatGPT
```rust
use openai_flows::{chat_completion, ChatOptions, ChatModel};
use slack_flows::{listen_to_channel, send_message_to_channel};

#[no_mangle]
pub fn run() {
    listen_to_channel("myworkspace", "mychannel", |sm| {
        let co = ChatOptions {
            model: ChatModel::GPT35Turbo,
            restart: sm.text.eq_ignore_ascii_case("/restart"),
            restarted_sentence: Some("let's change the subject"),
        };
        if let Some(r) = chat_completion("myaccount", "any_conversation_id", &sm.text, &co) {
            send_message_to_channel("myworkspace", "mychannel", r.choice);
        }
    });
}
```

This example lets you have a conversation with ChatGPT using [`chat_completion`](https://docs.rs/openai-flows/latest/openai_flows/fn.chat_completion.html) in Slack.
When you want to restart a new topic, just type `/restart`.

The whole document is [here](https://docs.rs/openai-flows).