SDK for plagiarism detection in Platform Network challenges.
- AST Similarity: Structural code comparison with 97% threshold
- Agent Sandbox: Isolated workspace for agentic investigation
- Agentic Investigator: LLM-powered investigation with function calling
Add to your Cargo.toml:
[dependencies]
plagiarism-sdk = { git = "https://github.com/PlatformNetwork/plagiarism-sdk" }use plagiarism_sdk::{check_plagiarism, PlagiarismReport};
let code_a = r#"
def fibonacci(n):
if n <= 1:
return n
return fibonacci(n-1) + fibonacci(n-2)
"#;
let code_b = r#"
def fib(x):
if x <= 1:
return x
return fib(x-1) + fib(x-2)
"#;
let report = check_plagiarism(&[code_a, code_b])?;
match report {
PlagiarismReport::Results { comparisons, plagiarized, .. } => {
println!("Highest similarity: {:?}", comparisons.iter().max_by_key(|c| c.score));
if !plagiarized.is_empty() {
println!("Plagiarism detected in submissions: {:?}", plagiarized);
}
}
_ => println!("No comparison possible"),
}use plagiarism_sdk::{AgenticInvestigator, InvestigatorConfig};
let config = InvestigatorConfig {
max_iterations: 20,
timeout_seconds: 60,
llm_endpoint: "http://localhost:11434/api/chat".to_string(),
llm_model: "llama3".to_string(),
};
let investigator = AgenticInvestigator::new(config)?;
let result = investigator.investigate(code_a, code_b, 0.95).await?;
println!("Verdict: {}", result.verdict.is_plagiarism);
println!("Confidence: {:.2}%", result.verdict.confidence * 100.0);
println!("Reasoning: {}", result.verdict.reasoning);use plagiarism_sdk::AgentWorkspace;
let workspace = AgentWorkspace::new()?;
workspace.write_file("submission.py", code)?;
let content = workspace.read_file("submission.py")?;
let matches = workspace.grep(r"def\s+\w+")?;std(default): Enables full standard library support including sandbox and agentic featuresalloc: Enablesno_stdmode with allocator support (limited to core AST types)python-parser: Enables Python AST parsing (pulls inrustpython-parser)
| Score | Status | Action |
|---|---|---|
| < 30% | Clean | No action needed |
| 30-96% | NeedsLlmVerification | Flag for agentic review |
| ≥ 97% | Plagiarized | Mark as plagiarized |
Apache-2.0