Created
May 18, 2023 00:48
-
-
Save junichiro/22b78474c1829cf69d0431c32af729d8 to your computer and use it in GitHub Desktop.
Rust で OpenAI を呼ぶコードのテストコード
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use app::openai::OpenAi; | |
#[tokio::test] | |
async fn test_openai() { | |
let input_text = "Hello, world!"; | |
let client = OpenAi::new("text-davinci-003".to_string(), 400_u16); | |
let response_text = client.ask(input_text).await; | |
assert!( | |
response_text.contains(input_text), | |
"Expected '{}' to contain '{}'", | |
response_text, | |
input_text | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment