Crate ai_workbench_lib

Crate ai_workbench_lib 

Source
Expand description

§AI Workbench Library

A comprehensive library for AI workbench operations including:

  • File discovery and S3 operations
  • Intelligent file splitting with type-aware chunking
  • Model runner for AWS Bedrock integration
  • Job processor for orchestrating the entire workflow

§Example Usage

use ai_workbench_lib::{JobProcessor, JobConfig, FileDiscovery};
use aws_config::BehaviorVersion;
use aws_sdk_s3::Client as S3Client;
use aws_sdk_bedrockruntime::Client as BedrockClient;
use std::sync::Arc;
 
#[tokio::main]
async fn main() -> anyhow::Result<()> {
    // Initialize AWS clients
    let config = aws_config::load_defaults(BehaviorVersion::latest()).await;
    let s3_client = Arc::new(S3Client::new(&config));
    let bedrock_client = Arc::new(BedrockClient::new(&config));
     
    // Create job configuration
    let job_config = JobConfig {
        job_id: "test-job".to_string(),
        prompt: "Analyze this file: {{file}}".to_string(),
        workspace_bucket: "my-workspace-bucket".to_string(),
        input_spec: "path/to/file.txt".to_string(),
        output_prefix: "outputs/".to_string(),
        model_id: "amazon.nova-micro-v1:0".to_string(),
        workspace_id: "ws-123".to_string(),
        user_id: "user-123".to_string(),
        chunk_size_mb: Some(5.0),
        max_parallel: Some(4),
        include_file_context: Some(true),
    };
     
    // Create and run job processor
    let processor = JobProcessor::new(s3_client, bedrock_client, job_config);
    let (output_key, metrics) = processor.run().await?;
     
    println!("Job completed! Output: {}", output_key);
    println!("Processed {} files with {} tokens", metrics.files_processed, metrics.total_tokens);
     
    Ok(())
}

Re-exports§

pub use tokio;
pub use tracing;
pub use modules::*;

Modules§

modules
Library for AI Workbench file processing

Structs§

BedrockClient
Client for Amazon Bedrock Runtime
S3Client
Client for Amazon Simple Storage Service

Constants§

DESCRIPTION
Library information
VERSION
Version information for the library

Traits§

Context
Provides the context method for Result.
Deserialize
A data structure that can be deserialized from any data format supported by Serde.
Serialize
A data structure that can be serialized into any data format supported by Serde.

Type Aliases§

Result
Result<T, Error>

Derive Macros§

Deserialize
Serialize