MCPcopy Create free account
hub / github.com/FuzzAnything/PromptFuzz / test_get_client

Function test_get_client

src/request/openai.rs:339–362  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

337
338 #[test]
339 fn test_get_client() -> Result<()> {
340 dotenv::dotenv().ok();
341 config::init_openai_env();
342 config::Config::init_test("libaom");
343
344 let rt = tokio::runtime::Builder::new_current_thread()
345 .enable_all()
346 .build()
347 .unwrap_or_else(|_| panic!("Unable to build the openai runtime."));
348
349 let messages: Vec<ChatCompletionRequestMessage> = vec![
350 ChatCompletionRequestSystemMessageArgs::default()
351 .content("You are a helpful assistant.")
352 .build()?.into(),
353 ChatCompletionRequestUserMessageArgs::default()
354 .content("Explain Rust's ownership system in simple terms.")
355 .build()?.into()
356 ];
357
358 let request = create_reasoning_chat_request(messages, None)?;
359 let response = rt.block_on(get_reasoning_chat_response(request))?;
360 println!("{:#?}", response);
361 Ok(())
362 }
363}

Callers

nothing calls this directly

Calls 4

init_openai_envFunction · 0.85
buildMethod · 0.80

Tested by

no test coverage detected