Credify
A robust Rust library for validating LinkedIn profile URLs with AI-first design. Built for the era of AI agents and LLMs, Credify provides both traditional validation APIs and specialized functions optimized for AI tool calling, especially with frameworks like Rig.
๐ฏ New in v0.4.0: Enhanced LinkedIn 404 detection with comprehensive apostrophe encoding support and complete Rig framework integration examples with real-world patterns.
๐ Real-World Use Cases
AI Recruiting Assistant
// Validate candidate profiles before outreach
let result = rig_validate_json.await;
// Returns: {"valid": true, "username": "john-doe", "confidence": 95, ...}
Lead Generation Bot
// Quick validation for scraped LinkedIn URLs
if rig_is_valid.await
Professional Network Analyzer
// Get human-readable validation for chat interfaces
let message = rig_validate_text.await;
// Returns: "โ
Valid profile @jane-smith (90% confidence)"
Data Enrichment Pipeline
// Batch validate URLs with confidence scoring
let results = urls.iter.map.collect.await;
// Filter by confidence level for data quality
๐ Key Features
- ๐ค AI-First Design - Multiple API levels from simple booleans to rich structured data
- ๐ฏ Rig Framework Optimized - Ergonomic helpers designed specifically for Rig tools
- โก Async & Sync APIs - Full async support to prevent blocking runtime panics
- ๐ Structured Responses -
AIValidationResultwith confidence scores and decisions - ๐ Smart Validation - Format checking, existence verification, and intelligent fallbacks
- ๐ Rich Error Context - Detailed explanations with actionable suggestions
- ๐ก๏ธ Never Panics - Comprehensive error handling throughout
- ๐ High Performance - Optimized for concurrent operations
๐ฆ Installation
[]
= "0.4.0"
Or use cargo add:
๐ Quick Start
For AI Agents & Rig Framework (Recommended)
use ;
// Ultra-simple validation
if rig_is_valid.await
// Get a human-readable response
let message = rig_validate_text.await;
// Returns: "โ
Valid profile @johndoe (95% confidence)"
For Rig Tool Implementation
// Complete Rig tool implementation
;
๐ API Overview
๐ฏ Ergonomic Rig Helpers (New!)
| Function | Returns | Use Case |
|---|---|---|
rig_is_valid() |
bool |
Quick true/false checks |
rig_validate_text() |
String |
One-line human-readable responses |
rig_validate_json() |
String |
Clean JSON for tool responses |
rig_validate() |
RigValidationResult |
Structured data with all details |
๐ค AI-Optimized Functions
| Function | Returns | Use Case |
|---|---|---|
ai_validate() |
AIValidationResult |
Full structured data |
ai_validate_json() |
String |
JSON for AI consumption |
validate_for_llm() |
String |
Verbose text reports |
๐ง Traditional API
| Function | Returns | Use Case |
|---|---|---|
is_valid_linkedin_profile_format() |
bool |
Format checking only |
LinkedInValidator::is_valid_linkedin_profile_url() |
Result<bool> |
Full validation |
๐ก Usage Examples
1. Rig Framework Integration (Recommended)
use ;
use Tool;
;
// Or use structured data
async
2. AI Agent Integration
use ;
async
3. Quick Validation
use is_valid_linkedin_profile_format;
// Format check only (no network calls)
if is_valid_linkedin_profile_format
// Full validation with network check
use LinkedInValidator;
let validator = new?;
match validator.is_valid_linkedin_profile_url
4. Async Operations
use validate_linkedin_url_async;
// Async validation
let is_valid = validate_linkedin_url_async.await?;
// Async with AI response
let json = ai_validate_json_async.await;
๐ฏ Complete Rig Framework Integration Guide
Setting Up Credify with Rig
Credify is designed to work seamlessly with the Rig framework for building AI agents. Here's a complete guide to integrating LinkedIn validation into your Rig-powered AI system.
1. Basic Tool Setup
use rig_validate_json;
use ;
use ;
use json;
;
2. Using with Rig Agents
use openai;
use ;
async
3. Advanced Usage with Multiple Response Types
use ;
// Quick boolean check for conditional logic
async
// Human-readable response for chat interfaces
async
// Structured data for complex workflows
async
4. Real-World Use Case: Recruiting Assistant
5. Error Handling Best Practices
// Credify's Rig helpers NEVER panic, making them safe for production
async
6. Batch Processing with Rig
use join_all;
async
Function Calling Patterns
Pattern 1: Simple Validation Tool
// Minimal implementation for basic needs
Pattern 2: Detailed Analysis Tool
// Rich responses for complex AI workflows
Pattern 3: Multi-Step Validation
// Complex validation with fallback strategies
Integration Tips
- Always use async: All Rig helpers are async to prevent blocking
- Never panics: Rig helpers return valid responses even on errors
- Structured responses: Use
rig_validate_jsonfor consistent AI parsing - Confidence scores: Use confidence levels to make nuanced decisions
- Batch wisely: Process multiple URLs concurrently for better performance
โ ๏ธ Important: Async Usage
When using Credify in async contexts (like web servers or AI frameworks), always use the async versions to avoid runtime panics:
// โ WRONG - Can cause panic in async context
async
// โ
CORRECT - Use async version
async
// โ
BEST - Use Rig helpers (always async)
async
๐ Response Types
RigValidationResult
AIValidationResult
๐ค Why AI-Friendly Validation Matters
Traditional validation returns simple true/false or error codes. AI agents need rich context to make intelligent decisions:
- Context-Rich Responses: Understand why validation failed
- Confidence Scores: Make nuanced decisions based on certainty
- Actionable Suggestions: Know what to do next
- Structured Data: Easy to parse and reason about
๐ ๏ธ Advanced Features
Custom User Agent
let validator = new_with_user_agent?;
Handling LinkedIn Authentication
LinkedIn often returns AUTH_REQUIRED (999 status) for valid profiles. Credify intelligently handles this:
// AUTH_REQUIRED is treated as a valid profile
let result = rig_validate.await;
if result.valid && result.status.contains
๐ More Examples
Check out the examples/ directory for:
basic.rs- Simple validation examplesrig_ergonomic.rs- Ergonomic Rig API showcaserig_integration.rs- Full Rig framework integration with function callingrig_async_proper.rs- Advanced async patterns for Rigbatch_validator.rs- Validate multiple URLs concurrentlyllm_simple.rs- LLM-friendly validationai_agent_demo.rs- Complete AI agent implementation
Quick Example: Rig Function Calling
// Define your tool
;
// Implement the tool - just one line!
// Use with your AI agent
let agent = client
.agent
.tool
.build;
let response = agent
.prompt
.await?;
Run examples with:
๐งช Testing
# Run all tests
# Run with verbose output
๐ License
Licensed under either of:
- Apache License, Version 2.0 (LICENSE-APACHE)
- MIT license (LICENSE-MIT)
at your option.
๐ค Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
๐ Acknowledgments
Built with โค๏ธ for the AI agent community. Special thanks to the Rig framework team for inspiring the ergonomic API design.