MCPcopy Create free account
hub / github.com/VectifyAI/OpenKB / _gen_entity_create

Function _gen_entity_create

openkb/agent/compiler.py:1872–1899  ·  view source on GitHub ↗
(ent: dict)

Source from the content-addressed store, hash-verified

1870 return name, content, True, brief
1871
1872 async def _gen_entity_create(ent: dict) -> tuple[str, str, str, str]:
1873 name = ent["name"]
1874 title = ent.get("title", name)
1875 etype = ent.get("type", "other")
1876 async with semaphore:
1877 raw = await _llm_call_page_async(
1878 model,
1879 [
1880 system_msg,
1881 doc_msg, # cached (BP1)
1882 summary_msg, # cached (BP2)
1883 known_targets_msg, # cached (BP3) — whitelist
1884 {
1885 "role": "user",
1886 "content": _ENTITY_PAGE_USER.format(
1887 title=title,
1888 type=etype,
1889 doc_name=doc_name,
1890 ).replace("__ENTITY_TYPES__", types_str),
1891 },
1892 ],
1893 f"entity: {name}",
1894 response_format=_JSON_RESPONSE_FORMAT,
1895 )
1896 brief, content, obj = _page_fields(raw)
1897 etype_out = obj.get("type") if obj and obj.get("type") in valid_types else etype
1898 _require_nonempty_content(content, name)
1899 return name, content, brief, etype_out
1900
1901 async def _gen_entity_update(ent: dict) -> tuple[str, str, str, str]:
1902 name = ent["name"]

Callers 1

_compile_conceptsFunction · 0.85

Calls 4

_llm_call_page_asyncFunction · 0.85
_page_fieldsFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected