v2.43.0
What's New
Token Usage Tracking for RemoteMultimodalEngine
The remote multimodal automation engine now tracks and returns token usage conforming to the OpenAI API format:
AutomationUsagestruct withprompt_tokens,completion_tokens,total_tokens- Usage is accumulated across all inference rounds
- Stored on
Page.remote_multimodal_usage
Extraction Support
New extraction capabilities for RemoteMultimodalEngine, similar to the OpenAI integration:
extra_ai_data- Enable extraction modeextraction_prompt- Custom extraction instructionsscreenshot- Capture final screenshot
Extracted data is automatically stored on Page.extra_remote_multimodal_data as AutomationResults.
Example Usage
use spider::features::automation::RemoteMultimodalConfigs;
let mm = RemoteMultimodalConfigs::new(
"http://localhost:11434/v1/chat/completions",
"qwen2.5-vl",
)
.with_extra_ai_data(true)
.with_extraction_prompt(Some("Extract all product names and prices"))
.with_screenshot(true);
website.configuration.remote_multimodal = Some(Box::new(mm));
// After crawling, access on page:
for page in website.get_pages().await {
if let Some(usage) = &page.remote_multimodal_usage {
println!("Tokens: {:?}", usage);
}
if let Some(data) = &page.extra_remote_multimodal_data {
for result in data {
println!("Extracted: {:?}", result.content_output);
}
}
}Full Changelog: v2.42.0...v2.43.0