Skip to content

Commit 6e90bc6

Browse files
authored
bump version (#1219)
1 parent 6773dd2 commit 6e90bc6

File tree

8 files changed

+25
-44
lines changed

8 files changed

+25
-44
lines changed

graphiti_core/llm_client/gemini_client.py

Lines changed: 12 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -147,11 +147,9 @@ def _check_safety_blocks(self, response) -> None:
147147
safety_info.append(f'{category}: {probability}')
148148

149149
safety_details = (
150-
', '.join(
151-
safety_info) if safety_info else 'Content blocked for safety reasons'
150+
', '.join(safety_info) if safety_info else 'Content blocked for safety reasons'
152151
)
153-
raise Exception(
154-
f'Response blocked by Gemini safety filters: {safety_details}')
152+
raise Exception(f'Response blocked by Gemini safety filters: {safety_details}')
155153

156154
def _check_prompt_blocks(self, response) -> None:
157155
"""Check if prompt was blocked and raise appropriate exceptions."""
@@ -282,8 +280,7 @@ async def _generate_response(
282280
for m in messages:
283281
m.content = self._clean_input(m.content)
284282
gemini_messages.append(
285-
types.Content(role=m.role, parts=[
286-
types.Part.from_text(text=m.content)])
283+
types.Content(role=m.role, parts=[types.Part.from_text(text=m.content)])
287284
)
288285

289286
# Get the appropriate model for the requested size
@@ -322,8 +319,7 @@ async def _generate_response(
322319
if not raw_output:
323320
raise ValueError('No response text')
324321

325-
validated_model = response_model.model_validate(
326-
json.loads(raw_output))
322+
validated_model = response_model.model_validate(json.loads(raw_output))
327323

328324
# Return as a dictionary for API consistency
329325
return validated_model.model_dump()
@@ -332,16 +328,13 @@ async def _generate_response(
332328
logger.error(
333329
'🦀 LLM generation failed parsing as JSON, will try to salvage.'
334330
)
335-
logger.error(self._get_failed_generation_log(
336-
gemini_messages, raw_output))
331+
logger.error(self._get_failed_generation_log(gemini_messages, raw_output))
337332
# Try to salvage
338333
salvaged = self.salvage_json(raw_output)
339334
if salvaged is not None:
340-
logger.warning(
341-
'Salvaged partial JSON from truncated/malformed output.')
335+
logger.warning('Salvaged partial JSON from truncated/malformed output.')
342336
return salvaged
343-
raise Exception(
344-
f'Failed to parse structured response: {e}') from e
337+
raise Exception(f'Failed to parse structured response: {e}') from e
345338

346339
# Otherwise, return the response text as a dictionary
347340
return {'content': raw_output}
@@ -424,14 +417,11 @@ async def generate_response(
424417
last_error = e
425418

426419
# Check if this is a safety block - these typically shouldn't be retried
427-
error_text = str(e) or (
428-
str(e.__cause__) if e.__cause__ else '')
420+
error_text = str(e) or (str(e.__cause__) if e.__cause__ else '')
429421
if 'safety' in error_text.lower() or 'blocked' in error_text.lower():
430-
logger.warning(
431-
f'Content blocked by safety filters: {e}')
422+
logger.warning(f'Content blocked by safety filters: {e}')
432423
span.set_status('error', str(e))
433-
raise Exception(
434-
f'Content blocked by safety filters: {e}') from e
424+
raise Exception(f'Content blocked by safety filters: {e}') from e
435425

436426
retry_count += 1
437427

@@ -452,10 +442,8 @@ async def generate_response(
452442

453443
# If we exit the loop without returning, all retries are exhausted
454444
logger.error('🦀 LLM generation failed and retries are exhausted.')
455-
logger.error(self._get_failed_generation_log(
456-
messages, last_output))
457-
logger.error(
458-
f'Max retries ({self.MAX_RETRIES}) exceeded. Last error: {last_error}')
445+
logger.error(self._get_failed_generation_log(messages, last_output))
446+
logger.error(f'Max retries ({self.MAX_RETRIES}) exceeded. Last error: {last_error}')
459447
span.set_status('error', str(last_error))
460448
span.record_exception(last_error) if last_error else None
461449
raise last_error or Exception('Max retries exceeded')

graphiti_core/prompts/dedupe_edges.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def resolve_edge(context: dict[str, Any]) -> list[Message]:
4545
Message(
4646
role='system',
4747
content='You are a helpful assistant that de-duplicates facts from fact lists and determines which existing '
48-
'facts are contradicted by the new fact.',
48+
'facts are contradicted by the new fact.',
4949
),
5050
Message(
5151
role='user',

graphiti_core/prompts/extract_edges.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,8 @@ def edge(context: dict[str, Any]) -> list[Message]:
7474
Message(
7575
role='system',
7676
content='You are an expert fact extractor that extracts fact triples from text. '
77-
'1. Extracted fact triples should also be extracted with relevant date information.'
78-
'2. Treat the CURRENT TIME as the time the CURRENT MESSAGE was sent. All temporal information should be extracted relative to this time.',
77+
'1. Extracted fact triples should also be extracted with relevant date information.'
78+
'2. Treat the CURRENT TIME as the time the CURRENT MESSAGE was sent. All temporal information should be extracted relative to this time.',
7979
),
8080
Message(
8181
role='user',

graphiti_core/prompts/extract_nodes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class ExtractedEntity(BaseModel):
2929
name: str = Field(..., description='Name of the extracted entity')
3030
entity_type_id: int = Field(
3131
description='ID of the classified entity type. '
32-
'Must be one of the provided entity_type_id integers.',
32+
'Must be one of the provided entity_type_id integers.',
3333
)
3434

3535

graphiti_core/utils/maintenance/edge_operations.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -160,10 +160,7 @@ async def extract_edges_for_chunk(
160160
# Prepare context for LLM
161161
context = {
162162
'episode_content': episode.content,
163-
'nodes': [
164-
{'name': node.name, 'entity_types': node.labels}
165-
for node in chunk
166-
],
163+
'nodes': [{'name': node.name, 'entity_types': node.labels} for node in chunk],
167164
'previous_episodes': [ep.content for ep in previous_episodes],
168165
'reference_time': episode.valid_at,
169166
'edge_types': edge_types_context,

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[project]
22
name = "graphiti-core"
33
description = "A temporal graph building library"
4-
version = "0.27.0pre2"
4+
version = "0.27.0"
55
authors = [
66
{ name = "Paul Paliychuk", email = "paul@getzep.com" },
77
{ name = "Preston Rasmussen", email = "preston@getzep.com" },

tests/utils/maintenance/test_edge_operations.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -501,9 +501,7 @@ def test_edge_type_signatures_map_preserves_multiple_signatures():
501501
edge_types_context = [
502502
{
503503
'fact_type_name': type_name,
504-
'fact_type_signatures': edge_type_signatures_map.get(
505-
type_name, [('Entity', 'Entity')]
506-
),
504+
'fact_type_signatures': edge_type_signatures_map.get(type_name, [('Entity', 'Entity')]),
507505
'fact_type_description': type_model.__doc__,
508506
}
509507
for type_name, type_model in edge_types.items()
@@ -547,9 +545,7 @@ def test_edge_type_signatures_map_single_signature_still_works():
547545
edge_types_context = [
548546
{
549547
'fact_type_name': type_name,
550-
'fact_type_signatures': edge_type_signatures_map.get(
551-
type_name, [('Entity', 'Entity')]
552-
),
548+
'fact_type_signatures': edge_type_signatures_map.get(type_name, [('Entity', 'Entity')]),
553549
'fact_type_description': type_model.__doc__,
554550
}
555551
for type_name, type_model in edge_types.items()

uv.lock

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)