Download examples/evidence_paths.py from ayjays132/PhillNet_Recall: direct link, hf CLI and curl.
- Browser
- Download file 1.52 kB
-
https://huggingface.co/ayjays132/PhillNet_Recall/resolve/main/examples/evidence_paths.py
- Command line
-
hf download hf://ayjays132/PhillNet_Recall/examples/evidence_paths.py
-
curl -L -o evidence_paths.py https://huggingface.co/ayjays132/PhillNet_Recall/resolve/main/examples/evidence_paths.py
1.52 kB
| """Executable synthetic demo. No model download, private data or training.""" | |
| from phillnet_recall import RecallMemory,prepare_recall_prompt | |
| import json | |
| def main(): | |
| now=[100.] | |
| with RecallMemory(clock=lambda:now[0]) as m: | |
| m.remember('Project Willow uses Beacon.',source='operator:service-map', | |
| entity='Project Willow',predicate='uses_service',value='Beacon') | |
| old=m.remember('Beacon is deployed in us-west-2.',source='operator:deployment', | |
| entity='Beacon',predicate='deployment_region',value='us-west-2') | |
| question='Which region hosts the service used by Project Willow?' | |
| first=m.recall(question) | |
| now[0]=200. | |
| m.remember('Beacon is now deployed in eu-west-1.',source='operator:deployment', | |
| entity='Beacon',predicate='deployment_region',value='eu-west-1', | |
| valid_from=150.,replaces=old) | |
| current=m.recall(question);historical=m.recall(question,as_of=125.) | |
| packet=prepare_recall_prompt(m,question,max_input_units=8192) | |
| out={'before':first['answer_values'],'after':current['answer_values'], | |
| 'historical':historical['answer_values'], | |
| 'old_certificate_valid_now':m.verify_evidence(first['certificate'])['valid'], | |
| 'complete_context':packet['memory']['dependency_complete'], | |
| 'supporting_records':len(packet['memory']['ids'])} | |
| print(json.dumps(out,indent=2)) | |
| return out | |
| if __name__=='__main__':main() | |