Upgrade to GPT-4 💪

This commit is contained in:
Alex Page 2023-03-29 00:12:42 -04:00
parent 0d896d30bd
commit f438fb7341
3 changed files with 6 additions and 6 deletions

View file

@ -9,7 +9,7 @@ parking_lot = "0.12.1"
poise = "0.5.2"
tracing = "0.1.37"
tracing-futures = "0.2.5"
openai = "1.0.0-alpha.6"
openai = "1.0.0-alpha.8"
rand = "0.8.5"
thiserror = "1.0.39"

View file

@ -5,6 +5,7 @@ mod personality;
mod queue;
use commands::*;
use openai::set_key;
use tracing_subscriber::{fmt, prelude::*, EnvFilter};
use std::{env, sync::Arc};
@ -48,6 +49,8 @@ async fn main() -> Result<()> {
.with(EnvFilter::from_default_env())
.init();
set_key(env::var("OPENAI_KEY").expect("Expected an OpenAI key in the environment: OPENAI_KEY"));
let token =
env::var("DISCORD_TOKEN").expect("Expected a bot token in the environment: DISCORD_TOKEN");

View file

@ -1,8 +1,5 @@
use anyhow::{Context, Result};
use openai::{
chat::{ChatCompletion, ChatCompletionMessage},
models::ModelID,
};
use openai::chat::{ChatCompletion, ChatCompletionMessage};
use rand::seq::SliceRandom;
const LOADING_MESSAGES: [&str; 20] = [
@ -57,7 +54,7 @@ pub async fn get_sassy_commentary(title: &str) -> Result<String> {
let prompt = format!("Play \"{title}\"");
let completion = ChatCompletion::builder(
ModelID::Gpt3_5Turbo,
"gpt-4",
[
system
.into_iter()