MCPcopy
hub / github.com/apache/caldera / _store_results

Method _store_results

app/service/learning_svc.py:52–65  ·  view source on GitHub ↗
(self, link, facts, operation=None)

Source from the content-addressed store, hash-verified

50 await self._store_results(link, found_facts, operation)
51
52 async def _store_results(self, link, facts, operation=None):
53 facts_covered = []
54 for relationship in self.model:
55 matches = []
56 for fact in facts:
57 if fact.trait in relationship:
58 matches.append(fact)
59 facts_covered.append(fact)
60 for pair in itertools.combinations(matches, r=2):
61 if pair[0].trait != pair[1].trait:
62 await link.create_relationships([Relationship(source=pair[0], edge='has', target=pair[1])],
63 operation=operation)
64 for f in [x for x in facts if x not in facts_covered]:
65 await link.save_fact(operation=operation, fact=f, score=1, relationship=[])

Callers 2

learnMethod · 0.95

Calls 3

RelationshipClass · 0.90
create_relationshipsMethod · 0.80
save_factMethod · 0.80

Tested by 1