-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cleanup maintenance utilities + add podcast runner (#5)
* chore: Fix minor issues with episodic edge building + cleanup * feat: Port podcast runner * feat: Port podcast runner
- Loading branch information
1 parent
f1c2224
commit ad552b5
Showing
10 changed files
with
679 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
from core import Graphiti | ||
from core.utils.maintenance.graph_data_operations import clear_data | ||
from dotenv import load_dotenv | ||
import os | ||
import asyncio | ||
import logging | ||
import sys | ||
from transcript_parser import parse_podcast_messages | ||
|
||
load_dotenv() | ||
|
||
neo4j_uri = os.environ.get("NEO4J_URI") or "bolt://localhost:7687" | ||
neo4j_user = os.environ.get("NEO4J_USER") or "neo4j" | ||
neo4j_password = os.environ.get("NEO4J_PASSWORD") or "password" | ||
|
||
|
||
def setup_logging(): | ||
# Create a logger | ||
logger = logging.getLogger() | ||
logger.setLevel(logging.INFO) # Set the logging level to INFO | ||
|
||
# Create console handler and set level to INFO | ||
console_handler = logging.StreamHandler(sys.stdout) | ||
console_handler.setLevel(logging.INFO) | ||
|
||
# Create formatter | ||
formatter = logging.Formatter( | ||
"%(asctime)s - %(name)s - %(levelname)s - %(message)s" | ||
) | ||
|
||
# Add formatter to console handler | ||
console_handler.setFormatter(formatter) | ||
|
||
# Add console handler to logger | ||
logger.addHandler(console_handler) | ||
|
||
return logger | ||
|
||
|
||
async def main(): | ||
setup_logging() | ||
client = Graphiti(neo4j_uri, neo4j_user, neo4j_password) | ||
await clear_data(client.driver) | ||
messages = parse_podcast_messages() | ||
for i, message in enumerate(messages[3:14]): | ||
await client.add_episode( | ||
name=f"Message {i}", | ||
episode_body=f"{message.speaker_name} ({message.role}): {message.content}", | ||
reference_time=message.actual_timestamp, | ||
source_description="Podcast Transcript", | ||
) | ||
|
||
|
||
asyncio.run(main()) |
Oops, something went wrong.