watsonx_rs/lib.rs
1//! # WatsonX-RS
2//!
3//! An unofficial Rust SDK for IBM WatsonX AI platform.
4//!
5//! This crate provides a high-level interface to interact with IBM WatsonX AI services,
6//! including text generation, streaming responses, model management, and WatsonX Orchestrate
7//! custom assistants and document collections.
8//!
9//! ## Features
10//!
11//! - **Text Generation**: Generate text using various WatsonX models
12//! - **Streaming Support**: Real-time streaming responses with callbacks
13//! - **Authentication**: Automatic token management and refresh
14//! - **Error Handling**: Comprehensive error types and handling
15//! - **Async/Await**: Full async support with Tokio
16//! - **Configuration**: Flexible configuration options
17//! - **WatsonX Orchestrate**: Custom assistant management and document collections
18//! - **Chat Functionality**: Interactive chat with custom assistants
19//! - **Document Management**: Vector search and knowledge base management
20//!
21//! ## Quick Start
22//!
23//! ```rust,no_run
24//! use watsonx_rs::{WatsonxClient, WatsonxConfig};
25//!
26//! #[tokio::main]
27//! async fn main() -> Result<(), Box<dyn std::error::Error>> {
28//! // Create configuration
29//! let config = WatsonxConfig::new(
30//! "your-api-key".to_string(),
31//! "your-project-id".to_string(),
32//! );
33//!
34//! // Create client
35//! let mut client = WatsonxClient::new(config)?;
36//!
37//! // Connect to WatsonX
38//! client.connect().await?;
39//!
40//! // Generate text
41//! let result = client.generate("Hello, world!").await?;
42//! println!("Generated: {}", result.text);
43//!
44//! Ok(())
45//! }
46//! ```
47//!
48//! ## Examples
49//!
50//! See the `examples/` directory for more detailed usage examples.
51
52pub mod client;
53pub mod config;
54pub mod error;
55pub mod models;
56pub mod orchestrate;
57pub mod types;
58
59#[cfg(test)]
60mod tests;
61
62#[cfg(test)]
63mod orchestrate_tests;
64
65// Re-export main types for convenience
66pub use client::WatsonxClient;
67pub use config::WatsonxConfig;
68pub use error::{Error, Result};
69pub use models::*;
70pub use orchestrate::OrchestrateClient;
71pub use orchestrate::{OrchestrateConfig, Agent, Message, MessagePayload};
72pub use orchestrate::*;
73pub use types::*;
74// Re-export batch types explicitly for better discoverability
75pub use types::{BatchRequest, BatchItemResult, BatchGenerationResult};