Skip to content

Commit 7f7a17c

Browse files
authored
chore: update dependencies and refactor type hinting (camel-ai#339)
* Bump version from 0.9.0 to 0.9.1 in pyproject.toml and update google-genai dependency to >=0.1.0 * Bump version from 0.9.1 to 0.9.2 in pyproject.toml * Update google-genai dependency version to >=0.8.0 in pyproject.toml * loc file * Update pyproject.toml to version 0.9.3, restructure dependencies, and modify author format. Remove outdated Google API key note from README.md. * upgrade poetry and ruff * Update README.md to include installation instructions for Graphiti with Google Gemini support * fix to deps since peotry doesn't fully implement PEP 735 * Refactor string formatting in various files to use single quotes for consistency and improve readability. This includes updates in agent.ipynb, quickstart.py, multiple prompt files, and ingest.py and retrieve.py modules. * Remove optional dependencies from pyproject.toml to streamline project requirements.
1 parent 77406df commit 7f7a17c

File tree

11 files changed

+785
-241
lines changed

11 files changed

+785
-241
lines changed

examples/langgraph-agent/agent.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@
363363
" asyncio.create_task(\n",
364364
" client.add_episode(\n",
365365
" name='Chatbot Response',\n",
366-
" episode_body=f\"{state['user_name']}: {state['messages'][-1]}\\nSalesBot: {response.content}\",\n",
366+
" episode_body=f'{state[\"user_name\"]}: {state[\"messages\"][-1]}\\nSalesBot: {response.content}',\n",
367367
" source=EpisodeType.message,\n",
368368
" reference_time=datetime.now(timezone.utc),\n",
369369
" source_description='Chatbot',\n",

examples/quickstart/quickstart.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ async def main():
217217
print(f'Node Name: {node.name}')
218218
node_summary = node.summary[:100] + '...' if len(node.summary) > 100 else node.summary
219219
print(f'Content Summary: {node_summary}')
220-
print(f"Node Labels: {', '.join(node.labels)}")
220+
print(f'Node Labels: {", ".join(node.labels)}')
221221
print(f'Created At: {node.created_at}')
222222
if hasattr(node, 'attributes') and node.attributes:
223223
print('Attributes:')

graphiti_core/embedder/voyage.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,4 +55,4 @@ async def create(
5555
return []
5656

5757
result = await self.client.embed(input_list, model=self.config.embedding_model)
58-
return result.embeddings[0][: self.config.embedding_dim]
58+
return [float(x) for x in result.embeddings[0][: self.config.embedding_dim]]

graphiti_core/prompts/dedupe_nodes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def node(context: dict[str, Any]) -> list[Message]:
5757
{json.dumps([ep for ep in context['previous_episodes']], indent=2)}
5858
</PREVIOUS MESSAGES>
5959
<CURRENT MESSAGE>
60-
{context["episode_content"]}
60+
{context['episode_content']}
6161
</CURRENT MESSAGE>
6262
6363
<EXISTING NODES>

graphiti_core/prompts/extract_edge_dates.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def v1(context: dict[str, Any]) -> list[Message]:
5353
{context['previous_episodes']}
5454
</PREVIOUS MESSAGES>
5555
<CURRENT MESSAGE>
56-
{context["current_episode"]}
56+
{context['current_episode']}
5757
</CURRENT MESSAGE>
5858
<REFERENCE TIMESTAMP>
5959
{context['reference_timestamp']}

graphiti_core/prompts/extract_edges.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,11 @@ def edge(context: dict[str, Any]) -> list[Message]:
6060
{json.dumps([ep for ep in context['previous_episodes']], indent=2)}
6161
</PREVIOUS MESSAGES>
6262
<CURRENT MESSAGE>
63-
{context["episode_content"]}
63+
{context['episode_content']}
6464
</CURRENT MESSAGE>
6565
6666
<ENTITIES>
67-
{context["nodes"]}
67+
{context['nodes']}
6868
</ENTITIES>
6969
7070
{context['custom_prompt']}
@@ -90,15 +90,15 @@ def reflexion(context: dict[str, Any]) -> list[Message]:
9090
{json.dumps([ep for ep in context['previous_episodes']], indent=2)}
9191
</PREVIOUS MESSAGES>
9292
<CURRENT MESSAGE>
93-
{context["episode_content"]}
93+
{context['episode_content']}
9494
</CURRENT MESSAGE>
9595
9696
<EXTRACTED ENTITIES>
97-
{context["nodes"]}
97+
{context['nodes']}
9898
</EXTRACTED ENTITIES>
9999
100100
<EXTRACTED FACTS>
101-
{context["extracted_facts"]}
101+
{context['extracted_facts']}
102102
</EXTRACTED FACTS>
103103
104104
Given the above MESSAGES, list of EXTRACTED ENTITIES entities, and list of EXTRACTED FACTS;

graphiti_core/prompts/extract_nodes.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def extract_message(context: dict[str, Any]) -> list[Message]:
6868
{json.dumps([ep for ep in context['previous_episodes']], indent=2)}
6969
</PREVIOUS MESSAGES>
7070
<CURRENT MESSAGE>
71-
{context["episode_content"]}
71+
{context['episode_content']}
7272
</CURRENT MESSAGE>
7373
7474
{context['custom_prompt']}
@@ -96,10 +96,10 @@ def extract_json(context: dict[str, Any]) -> list[Message]:
9696

9797
user_prompt = f"""
9898
<SOURCE DESCRIPTION>:
99-
{context["source_description"]}
99+
{context['source_description']}
100100
</SOURCE DESCRIPTION>
101101
<JSON>
102-
{context["episode_content"]}
102+
{context['episode_content']}
103103
</JSON>
104104
105105
{context['custom_prompt']}
@@ -121,7 +121,7 @@ def extract_text(context: dict[str, Any]) -> list[Message]:
121121

122122
user_prompt = f"""
123123
<TEXT>
124-
{context["episode_content"]}
124+
{context['episode_content']}
125125
</TEXT>
126126
127127
{context['custom_prompt']}
@@ -148,11 +148,11 @@ def reflexion(context: dict[str, Any]) -> list[Message]:
148148
{json.dumps([ep for ep in context['previous_episodes']], indent=2)}
149149
</PREVIOUS MESSAGES>
150150
<CURRENT MESSAGE>
151-
{context["episode_content"]}
151+
{context['episode_content']}
152152
</CURRENT MESSAGE>
153153
154154
<EXTRACTED ENTITIES>
155-
{context["extracted_entities"]}
155+
{context['extracted_entities']}
156156
</EXTRACTED ENTITIES>
157157
158158
Given the above previous messages, current message, and list of extracted entities; determine if any entities haven't been
@@ -172,7 +172,7 @@ def classify_nodes(context: dict[str, Any]) -> list[Message]:
172172
{json.dumps([ep for ep in context['previous_episodes']], indent=2)}
173173
</PREVIOUS MESSAGES>
174174
<CURRENT MESSAGE>
175-
{context["episode_content"]}
175+
{context['episode_content']}
176176
</CURRENT MESSAGE>
177177
178178
<EXTRACTED ENTITIES>

0 commit comments

Comments
 (0)