Upgrade to GPT-4 💪
This commit is contained in:
parent
0d896d30bd
commit
f438fb7341
3 changed files with 6 additions and 6 deletions
|
@ -9,7 +9,7 @@ parking_lot = "0.12.1"
|
||||||
poise = "0.5.2"
|
poise = "0.5.2"
|
||||||
tracing = "0.1.37"
|
tracing = "0.1.37"
|
||||||
tracing-futures = "0.2.5"
|
tracing-futures = "0.2.5"
|
||||||
openai = "1.0.0-alpha.6"
|
openai = "1.0.0-alpha.8"
|
||||||
rand = "0.8.5"
|
rand = "0.8.5"
|
||||||
thiserror = "1.0.39"
|
thiserror = "1.0.39"
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@ mod personality;
|
||||||
mod queue;
|
mod queue;
|
||||||
|
|
||||||
use commands::*;
|
use commands::*;
|
||||||
|
use openai::set_key;
|
||||||
use tracing_subscriber::{fmt, prelude::*, EnvFilter};
|
use tracing_subscriber::{fmt, prelude::*, EnvFilter};
|
||||||
|
|
||||||
use std::{env, sync::Arc};
|
use std::{env, sync::Arc};
|
||||||
|
@ -48,6 +49,8 @@ async fn main() -> Result<()> {
|
||||||
.with(EnvFilter::from_default_env())
|
.with(EnvFilter::from_default_env())
|
||||||
.init();
|
.init();
|
||||||
|
|
||||||
|
set_key(env::var("OPENAI_KEY").expect("Expected an OpenAI key in the environment: OPENAI_KEY"));
|
||||||
|
|
||||||
let token =
|
let token =
|
||||||
env::var("DISCORD_TOKEN").expect("Expected a bot token in the environment: DISCORD_TOKEN");
|
env::var("DISCORD_TOKEN").expect("Expected a bot token in the environment: DISCORD_TOKEN");
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
use anyhow::{Context, Result};
|
use anyhow::{Context, Result};
|
||||||
use openai::{
|
use openai::chat::{ChatCompletion, ChatCompletionMessage};
|
||||||
chat::{ChatCompletion, ChatCompletionMessage},
|
|
||||||
models::ModelID,
|
|
||||||
};
|
|
||||||
use rand::seq::SliceRandom;
|
use rand::seq::SliceRandom;
|
||||||
|
|
||||||
const LOADING_MESSAGES: [&str; 20] = [
|
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 prompt = format!("Play \"{title}\"");
|
||||||
|
|
||||||
let completion = ChatCompletion::builder(
|
let completion = ChatCompletion::builder(
|
||||||
ModelID::Gpt3_5Turbo,
|
"gpt-4",
|
||||||
[
|
[
|
||||||
system
|
system
|
||||||
.into_iter()
|
.into_iter()
|
||||||
|
|
Loading…
Add table
Reference in a new issue