MCPcopy Create free account
hub / github.com/InfinitiBit/graphbit / test_cost_estimation

Function test_cost_estimation

tests/rust_integration_tests/llm_tests.rs:302–310  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

300
301#[tokio::test]
302async fn test_cost_estimation() {
303 graphbit_core::init().expect("Failed to initialize GraphBit");
304
305 let usage = LlmUsage::new(1000, 500);
306 let response = LlmResponse::new("Test response", "gpt-3.5-turbo").with_usage(usage);
307
308 let cost = response.estimate_cost(0.001, 0.002); // $0.001 per input token, $0.002 per output token
309 assert_eq!(cost, 2.0); // 1000 * 0.001 + 500 * 0.002 = 1.0 + 1.0 = 2.0
310}
311
312// Real API integration tests (require environment variables)
313#[tokio::test]

Callers

nothing calls this directly

Calls 3

estimate_costMethod · 0.80
initFunction · 0.50
with_usageMethod · 0.45

Tested by

no test coverage detected