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/t2kg langgraph migration #86

Open
wants to merge 13 commits into
base: main
Choose a base branch
from

Conversation

awmulyadi
Copy link
Contributor

@awmulyadi awmulyadi commented Feb 5, 2025

For authors

Description

I have migrated Talk2KGs agentic workflow to adopt LangGraph. Following are the detailed key updates:

  1. Source Code: Within the folder of aiagents4pharma/talk2knowledgegraphs/, I included
    agents, state, and tools folder.
  • Within agents/t2kg_agent.py, we have only agent_t2kg as a solely agent as of now.
  • Within state/state_talk2knowledgegraphs.py, we utilize AgentState of LangGraph in Talk2KnowledgeGraphs to store variables and update it as we interact with agent.
  • Within tools/*, there are three tools that agent can invoke:
    • tools/subgraph_extraction.py to extract a subgraph using the PCST algorithm (G-Retriever approach).
    • tools/subgraph_summarization.py to summarize textual graph obtained from subgraph extraction process.
    • tools/graphrag_reasoning.py to perform reasoning in addition to RAG using a summarized subgraph and additional documents uploaded by the user.

Streamlit-related codes are placed under app/frontend/*.

In addition, we can set parameters configuration within configs that utilize Hydra library.
2. Pytest: I updated Talk2KGs-related codes under aiagents4pharma/talk2knowledgegraphs/tests/*
3. Tutorial Notebooks: I added an interactive notebook for showcasing Talk2KGs agentic tools in docs/notebooks/talk2knowledgegraphs/tutorial_talk2kg_agentic_tools.ipynb.
4. Documentation: Finally, I updated the related documentation using mkdocs, which is available in docs/talk2knowledgegraphs/*.

Notes:

  • As of now, I use a toy dataset for testing. I will open a separate issue related to this so that we can interact with public (e.g., subgraph of PrimeKG) and private KGs seamlessly.

  • I switch to Llama3.2:1b (~1.4 GB) for testing to make sure that it supports and can utilize LangGraph tools as well as understand the instructions from user queries.

Fixes #34

Type of change

Please delete options that are not relevant.

  • New feature (non-breaking change which adds functionality)
  • This change requires a documentation update

How Has This Been Tested?

Please describe the tests you conducted to verify your changes. These may involve creating new test scripts or updating existing ones.

  • Added new test(s) in the tests folder
  • Added new function(s) to an existing test(s) (e.g.: aiagents4pharma/talk2knowledgegraphs/tests/*)

Checklist

  • My code follows the style guidelines mentioned in the Code/DevOps guides
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation (e.g. MkDocs)
  • My changes generate no new warnings
  • I have added or updated tests (in the tests folder) that prove my fix is effective or that my feature works
  • New and existing tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

For reviewers

Checklist pre-approval

  • Is there enough documentation?
  • If a new feature has been added, or a bug fixed, has a test been added to confirm good behavior?
  • Does the test(s) successfully test edge/corner cases?
  • Does the PR pass the tests? (if the repository has continuous integration)

Checklist post-approval

  • Does this PR merge develop into main? If so, please make sure to add a prefix (feat/fix/chore) and/or a suffix BREAKING CHANGE (if it's a major release) to your commit message.
  • Does this PR close an issue? If so, please make sure to descriptively close this issue when the PR is merged.

Checklist post-merge

  • When you approve of the PR, merge and close it (Read this article to know about different merge methods on GitHub)
  • Did this PR merge develop into main and is it suppose to run an automated release workflow (if applicable)? If so, please make sure to check under the "Actions" tab to see if the workflow has been initiated, and return later to verify that it has completed successfully.

@awmulyadi awmulyadi requested a review from dmccloskey February 6, 2025 14:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Transfer GraphRAG agent and supporting functions to Talk2KnowledgeGraphs
1 participant