Catch classification exceptions (#283)
* Catch classification exceptions * except * Update graphiti_core/utils/maintenance/node_operations.py Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com> --------- Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>
This commit is contained in:
parent
6f874730f3
commit
a18dde36be
2 changed files with 12 additions and 8 deletions
|
|
@ -158,13 +158,17 @@ async def extract_nodes(
|
||||||
node_classifications: dict[str, str | None] = {}
|
node_classifications: dict[str, str | None] = {}
|
||||||
|
|
||||||
if entity_types is not None:
|
if entity_types is not None:
|
||||||
llm_response = await llm_client.generate_response(
|
try:
|
||||||
prompt_library.extract_nodes.classify_nodes(node_classification_context),
|
llm_response = await llm_client.generate_response(
|
||||||
response_model=EntityClassification,
|
prompt_library.extract_nodes.classify_nodes(node_classification_context),
|
||||||
)
|
response_model=EntityClassification,
|
||||||
entities = llm_response.get('entities', [])
|
)
|
||||||
entity_classifications = llm_response.get('entity_classifications', [])
|
entities = llm_response.get('entities', [])
|
||||||
node_classifications.update(dict(zip(entities, entity_classifications)))
|
entity_classifications = llm_response.get('entity_classifications', [])
|
||||||
|
node_classifications.update(dict(zip(entities, entity_classifications)))
|
||||||
|
# catch classification errors and continue if we can't classify
|
||||||
|
except Exception as e:
|
||||||
|
logger.exception(e)
|
||||||
|
|
||||||
end = time()
|
end = time()
|
||||||
logger.debug(f'Extracted new nodes: {extracted_node_names} in {(end - start) * 1000} ms')
|
logger.debug(f'Extracted new nodes: {extracted_node_names} in {(end - start) * 1000} ms')
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
[tool.poetry]
|
[tool.poetry]
|
||||||
name = "graphiti-core"
|
name = "graphiti-core"
|
||||||
version = "0.7.5"
|
version = "0.7.6"
|
||||||
description = "A temporal graph building library"
|
description = "A temporal graph building library"
|
||||||
authors = [
|
authors = [
|
||||||
"Paul Paliychuk <paul@getzep.com>",
|
"Paul Paliychuk <paul@getzep.com>",
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue