Expand description
LinkedIn profile URL validation library with AI-first design (v0.4.0).
Credify provides comprehensive LinkedIn URL validation with multiple API levels, from simple boolean checks to rich structured data optimized for AI agents and LLM tool calling, especially with frameworks like Rig.
§Features
- 🤖 AI-First Design - Multiple API levels for different use cases
- 🎯 Rig Framework Optimized - Ergonomic async helpers that prevent runtime panics
- ⚡ Async & Sync APIs - Full async support for modern applications
- 📊 Structured Responses - Rich data with confidence scores and decisions
- 🔍 Smart Validation - Format checking and existence verification
- 🛡️ Never Panics - Comprehensive error handling throughout
§Quick Start
§For AI Agents & Rig Framework (Recommended)
use credify::{rig_is_valid, rig_validate_text};
// Ultra-simple validation
if rig_is_valid("https://linkedin.com/in/johndoe").await {
println!("Valid LinkedIn profile!");
}
// Get a human-readable response
let message = rig_validate_text("https://linkedin.com/in/johndoe").await;
println!("{}", message); // "✅ Valid profile @johndoe (95% confidence)"
§Traditional API
use credify::{LinkedInValidator, LinkedInUrlError};
let validator = LinkedInValidator::new().expect("Failed to create validator");
match validator.is_valid_linkedin_profile_url("https://www.linkedin.com/in/johndoe") {
Ok(_) => println!("Profile exists!"),
Err(LinkedInUrlError::ProfileNotFound) => println!("Profile not found"),
Err(LinkedInUrlError::AuthenticationRequired) => println!("LinkedIn requires auth"),
Err(e) => println!("Error: {}", e),
}
§Format validation only
use credify::is_valid_linkedin_profile_format;
if is_valid_linkedin_profile_format("https://www.linkedin.com/in/johndoe") {
println!("Valid LinkedIn profile URL format");
}
§LLM-friendly validation
use credify::validate_for_llm;
let result = validate_for_llm("https://www.linkedin.com/in/johndoe");
println!("{}", result);
// Parse the structured output for automated decision making
§AI-optimized API
use credify::{ai_validate, AIDecision};
let result = ai_validate("https://www.linkedin.com/in/johndoe");
// Simple boolean check
if result.is_valid {
println!("Valid profile!");
}
// Use confidence level
if result.confidence >= 0.9 {
println!("High confidence validation");
}
// AI decision making
match result.decision {
AIDecision::Accept => println!("Use this profile"),
AIDecision::Retry => println!("Try again later"),
AIDecision::Reject => println!("Invalid URL"),
}
// Get JSON for direct consumption
use credify::ai_validate_json;
let json = ai_validate_json("https://linkedin.com/in/user");
§Rig Tool Implementation
async fn call(&self, args: Args) -> Result<String, Error> {
// Just one line! No runtime panics, perfect for Rig
Ok(credify::rig_validate_json(&args.url).await)
}
§API Levels
Credify provides multiple API levels for different use cases:
API Level | Functions | Use Case |
---|---|---|
Ergonomic Rig | rig_* functions | AI agents, Rig tools |
AI-Optimized | ai_* functions | Structured data for AI |
LLM-Friendly | validate_for_llm* | Verbose text reports |
Traditional | LinkedInValidator | Direct validation |
§Important: Async Usage
When using Credify in async contexts, always use async versions:
// ❌ WRONG - Can panic in async context
// let result = credify::ai_validate_json(url);
// ✅ CORRECT - Use async version
let result = credify::ai_validate_json_async("url").await;
// ✅ BEST - Rig helpers are always async
let result = credify::rig_validate_json("url").await;
Structs§
- AIValidation
Result - AI-agent friendly validation result with structured data
- Linked
InValidator - A
LinkedIn
profile validator that performs HTTP requests to verify profile existence. - RigValidation
Result - Ergonomic validation result optimized for Rig tool responses
- Validation
Metadata - Validation metadata for advanced AI agents
Enums§
- AIDecision
- Simple decision enum for AI agents
- Linked
InUrl Error - Errors that can occur during
LinkedIn
URL validation.
Functions§
- ai_
validate - Validate LinkedIn URL optimized for AI agents (sync version)
- ai_
validate_ async - Async version of ai_validate
- ai_
validate_ json - Get validation result as JSON for AI agents
- ai_
validate_ json_ async - Async version of ai_validate_json
- is_
valid_ linkedin_ profile_ format - Checks if a URL has valid
LinkedIn
profile format without making network calls. - rig_
is_ valid - Quick validation check for Rig - returns just true/false
- rig_
validate - Validate LinkedIn URL with Rig-optimized response format
- rig_
validate_ json - Rig-optimized JSON validation with clean structure
- rig_
validate_ text - Get validation as a one-line string for Rig tool responses
- validate_
for_ llm - Validates a LinkedIn profile URL and returns a structured string for LLM consumption.
- validate_
for_ llm_ async - Validates a LinkedIn profile URL asynchronously and returns a structured string for LLM consumption.
- validate_
linkedin_ url_ async - Validates a
LinkedIn
profile URL asynchronously.