This is a library for integrating OpenAI in your flow function for flows.network.
```rust use openaiflows::{CompletionRequest, createcompletion}; use slackflows::{listentochannel, sendmessagetochannel};
pub fn run() { listentochannel("myworkspace", "mychannel", |sm| { let cr = CompletionRequest { prompt: sm.text, ..Default::default() }; let r = createcompletion("myaccount", cr); r.iter().foreach(|c| { sendmessagetochannel("myworkspace", "mychannel", c.tostring()); }); }); } ```
When a new message is received from mychannel
, we will create completions using create_completion
then send the result back to Slack.
The whole document is here.