Repository challenges
Validate evidence citations
Feature · Intermediate · AI engineering · 35 minutes
Engineering ticket
Implement validate(citations, allowed_ids). Return a sorted, unique list of citation IDs not present in allowed_ids. IDs are strings. An empty citation list returns []. Matching is case-sensitive. Keep retrieval and validation concerns in separate files.
Review rubric
- Correctness on documented inputs
- Tests and edge cases
- Clear explanation of trade-offs
Reading the ticket and starter files is public. Sign in to save edits, run tests and submit evidence. Code-review quality requires human review.
Starter repository
README.md
# InferenceAI engineering lab Read the ticket, inspect the files, reproduce the issue and implement the contract. Run visible tests while working. Submit checks protected cases. Explain your changes and limitations.
citations.py
def validate(citations, allowed_ids):
# Return unknown citation IDs.
return []
retrieval.py
def context_ids(documents):
return [doc["id"] for doc in documents]
tests/test_citations.py
import unittest
from citations import *
class ContractTest(unittest.TestCase):
def test_example(self):
self.assertEqual(validate(["A","X","X"], ["A"]), ["X"])