Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/cog 553 graph memory projection #196

Merged
merged 33 commits into from
Nov 14, 2024
Merged
Changes from 16 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
c901fa8
feat: add falkordb adapter
borisarzentar Oct 24, 2024
62022a8
Merge remote-tracking branch 'origin/main' into feat/COG-184-add-falk…
borisarzentar Oct 29, 2024
14e2c7e
feat: add FalkorDB integration
borisarzentar Nov 7, 2024
758698a
Merge remote-tracking branch 'origin/main' into feat/COG-184-add-falk…
borisarzentar Nov 7, 2024
897bbac
fix: serialize UUID in pgvector data point payload
borisarzentar Nov 7, 2024
f569088
fix: add summaries to the graph
borisarzentar Nov 7, 2024
cf5b337
Merge remote-tracking branch 'origin/main' into feat/COG-184-add-falk…
borisarzentar Nov 7, 2024
c890636
fix: remove unused import
borisarzentar Nov 7, 2024
9e10c61
fix: resolves pg asyncpg UUID to UUID
hajdul88 Nov 7, 2024
19d62f2
fix: add code graph generation pipeline
borisarzentar Nov 8, 2024
9579cc7
Merge remote-tracking branch 'origin/feat/COG-184-add-falkordb' into …
borisarzentar Nov 8, 2024
51a8305
Merge remote-tracking branch 'origin/main' into feat/COG-184-add-falk…
borisarzentar Nov 8, 2024
64424bd
fix: Fixes LanceDB datapoint add
hajdul88 Nov 11, 2024
14868ea
Fix: Solves the issue of Neo4j concurrent sessions
hajdul88 Nov 11, 2024
38d29ee
Adds an entrypoint to enable/disable individual steps
hajdul88 Nov 11, 2024
3e7df33
Merge remote-tracking branch 'origin/main' into feat/COG-553-graph-me…
hajdul88 Nov 11, 2024
e988a67
Fixes LanceDB datapoint add
hajdul88 Nov 11, 2024
dcc8c96
fix: Fixes the consecutive DocumentChunk false text
hajdul88 Nov 12, 2024
b1a2831
feat: Adds CogneeGraph elements
hajdul88 Nov 12, 2024
f8ffdb4
feat: Adds cognee abstract graph class
hajdul88 Nov 12, 2024
7363909
feat: Adds CogneeGraph + memory projection init
hajdul88 Nov 12, 2024
9b62617
Merge branch 'main' into feat/COG-553-graph-memory-projection
hajdul88 Nov 12, 2024
953fc7b
Fix: Satisfies Pydantic model
hajdul88 Nov 13, 2024
d3ff7e2
fix: removes duplicate from extensions
hajdul88 Nov 13, 2024
68bfb87
feat: Extends graph elements with new features
hajdul88 Nov 13, 2024
8e3a991
feat: implements DB projection to memory
hajdul88 Nov 13, 2024
bf4eedd
Merge branch 'main' into feat/COG-553-graph-memory-projection
hajdul88 Nov 13, 2024
d8024db
fix: Fixes edge case handling
hajdul88 Nov 13, 2024
0d27371
Checks the pgvector test issue
hajdul88 Nov 13, 2024
d3fddda
Revert "Checks the pgvector test issue"
hajdul88 Nov 13, 2024
b516862
Fix: Fixes import paths
hajdul88 Nov 14, 2024
3250425
feat: Adds unit tests to CogneeGraph class
hajdul88 Nov 14, 2024
867e18d
fix: Changes GraphDBInterface typing in CogneeGraph
hajdul88 Nov 14, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
229 changes: 229 additions & 0 deletions examples/python/dynamic_steps_example.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,229 @@
import cognee
import asyncio
from cognee.api.v1.search import SearchType

job_position = """0:Senior Data Scientist (Machine Learning)

Company: TechNova Solutions
Location: San Francisco, CA

Job Description:

TechNova Solutions is seeking a Senior Data Scientist specializing in Machine Learning to join our dynamic analytics team. The ideal candidate will have a strong background in developing and deploying machine learning models, working with large datasets, and translating complex data into actionable insights.

Responsibilities:

Develop and implement advanced machine learning algorithms and models.
Analyze large, complex datasets to extract meaningful patterns and insights.
Collaborate with cross-functional teams to integrate predictive models into products.
Stay updated with the latest advancements in machine learning and data science.
Mentor junior data scientists and provide technical guidance.
Qualifications:

Master’s or Ph.D. in Data Science, Computer Science, Statistics, or a related field.
5+ years of experience in data science and machine learning.
Proficient in Python, R, and SQL.
Experience with deep learning frameworks (e.g., TensorFlow, PyTorch).
Strong problem-solving skills and attention to detail.
Candidate CVs
"""

job_1 = """
CV 1: Relevant
Name: Dr. Emily Carter
Contact Information:

Email: emily.carter@example.com
Phone: (555) 123-4567
Summary:

Senior Data Scientist with over 8 years of experience in machine learning and predictive analytics. Expertise in developing advanced algorithms and deploying scalable models in production environments.

Education:

Ph.D. in Computer Science, Stanford University (2014)
B.S. in Mathematics, University of California, Berkeley (2010)
Experience:

Senior Data Scientist, InnovateAI Labs (2016 – Present)
Led a team in developing machine learning models for natural language processing applications.
Implemented deep learning algorithms that improved prediction accuracy by 25%.
Collaborated with cross-functional teams to integrate models into cloud-based platforms.
Data Scientist, DataWave Analytics (2014 – 2016)
Developed predictive models for customer segmentation and churn analysis.
Analyzed large datasets using Hadoop and Spark frameworks.
Skills:

Programming Languages: Python, R, SQL
Machine Learning: TensorFlow, Keras, Scikit-Learn
Big Data Technologies: Hadoop, Spark
Data Visualization: Tableau, Matplotlib
"""

job_2 = """
CV 2: Relevant
Name: Michael Rodriguez
Contact Information:

Email: michael.rodriguez@example.com
Phone: (555) 234-5678
Summary:

Data Scientist with a strong background in machine learning and statistical modeling. Skilled in handling large datasets and translating data into actionable business insights.

Education:

M.S. in Data Science, Carnegie Mellon University (2013)
B.S. in Computer Science, University of Michigan (2011)
Experience:

Senior Data Scientist, Alpha Analytics (2017 – Present)
Developed machine learning models to optimize marketing strategies.
Reduced customer acquisition cost by 15% through predictive modeling.
Data Scientist, TechInsights (2013 – 2017)
Analyzed user behavior data to improve product features.
Implemented A/B testing frameworks to evaluate product changes.
Skills:

Programming Languages: Python, Java, SQL
Machine Learning: Scikit-Learn, XGBoost
Data Visualization: Seaborn, Plotly
Databases: MySQL, MongoDB
"""


job_3 = """
CV 3: Relevant
Name: Sarah Nguyen
Contact Information:

Email: sarah.nguyen@example.com
Phone: (555) 345-6789
Summary:

Data Scientist specializing in machine learning with 6 years of experience. Passionate about leveraging data to drive business solutions and improve product performance.

Education:

M.S. in Statistics, University of Washington (2014)
B.S. in Applied Mathematics, University of Texas at Austin (2012)
Experience:

Data Scientist, QuantumTech (2016 – Present)
Designed and implemented machine learning algorithms for financial forecasting.
Improved model efficiency by 20% through algorithm optimization.
Junior Data Scientist, DataCore Solutions (2014 – 2016)
Assisted in developing predictive models for supply chain optimization.
Conducted data cleaning and preprocessing on large datasets.
Skills:

Programming Languages: Python, R
Machine Learning Frameworks: PyTorch, Scikit-Learn
Statistical Analysis: SAS, SPSS
Cloud Platforms: AWS, Azure
"""


job_4 = """
CV 4: Not Relevant
Name: David Thompson
Contact Information:

Email: david.thompson@example.com
Phone: (555) 456-7890
Summary:

Creative Graphic Designer with over 8 years of experience in visual design and branding. Proficient in Adobe Creative Suite and passionate about creating compelling visuals.

Education:

B.F.A. in Graphic Design, Rhode Island School of Design (2012)
Experience:

Senior Graphic Designer, CreativeWorks Agency (2015 – Present)
Led design projects for clients in various industries.
Created branding materials that increased client engagement by 30%.
Graphic Designer, Visual Innovations (2012 – 2015)
Designed marketing collateral, including brochures, logos, and websites.
Collaborated with the marketing team to develop cohesive brand strategies.
Skills:

Design Software: Adobe Photoshop, Illustrator, InDesign
Web Design: HTML, CSS
Specialties: Branding and Identity, Typography
"""


job_5 = """
CV 5: Not Relevant
Name: Jessica Miller
Contact Information:

Email: jessica.miller@example.com
Phone: (555) 567-8901
Summary:

Experienced Sales Manager with a strong track record in driving sales growth and building high-performing teams. Excellent communication and leadership skills.

Education:

B.A. in Business Administration, University of Southern California (2010)
Experience:

Sales Manager, Global Enterprises (2015 – Present)
Managed a sales team of 15 members, achieving a 20% increase in annual revenue.
Developed sales strategies that expanded customer base by 25%.
Sales Representative, Market Leaders Inc. (2010 – 2015)
Consistently exceeded sales targets and received the 'Top Salesperson' award in 2013.
Skills:

Sales Strategy and Planning
Team Leadership and Development
CRM Software: Salesforce, Zoho
Negotiation and Relationship Building
"""

async def main(enable_steps):
hajdul88 marked this conversation as resolved.
Show resolved Hide resolved
borisarzentar marked this conversation as resolved.
Show resolved Hide resolved
# Step 1: Reset data and system state
if enable_steps.get("prune_data"):
await cognee.prune.prune_data()
print("Data pruned.")

if enable_steps.get("prune_system"):
await cognee.prune.prune_system(metadata=True)
print("System pruned.")
hajdul88 marked this conversation as resolved.
Show resolved Hide resolved

# Step 2: Add text
if enable_steps.get("add_text"):
text_list = [job_position, job_1, job_2, job_3, job_4, job_5]
for text in text_list:
await cognee.add(text)
print(f"Added text: {text[:35]}...")

# Step 3: Create knowledge graph
if enable_steps.get("cognify"):
await cognee.cognify()
print("Knowledge graph created.")

# Step 4: Query insights
if enable_steps.get("search_insights"):
search_results = await cognee.search(
SearchType.INSIGHTS,
{'query': 'Which applicant has the most relevant experience?'}
)
print("Search results:")
for result_text in search_results:
print(result_text)


if __name__ == '__main__':
# Flags to enable/disable steps
steps_to_enable = {
"prune_data": True,
"prune_system": True,
"add_text": True,
"cognify": True,
"search_insights": True
}

asyncio.run(main(steps_to_enable))
Loading