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/setup talk2cells #60

Merged
merged 10 commits into from
Jan 20, 2025
Merged

Feat/setup talk2cells #60

merged 10 commits into from
Jan 20, 2025

Conversation

gurdeep330
Copy link
Member

@gurdeep330 gurdeep330 commented Jan 17, 2025

For authors

T2CellsDemo.mp4

Description

Talk2Cells Agent Initial Implementation

This PR introduces the initial implementation of the talk2cells agentic workflow using Langgraph. The current implementation defines a graph with a single node, the Single-Cell Protocol Agent (scp_agent), and includes two tools. The graph has a state containing one key: search_table.

Tools

1. search_studies

This tool searches for studies based on specific search terms in the Single-Cell Protocol database. It demonstrates how a tool can modify the graph's state.

  • Functionality:
    Upon retrieving results, the tool updates the graph's state by writing the results to the key search_table.
  • Implementation:
    The tool uses the Command object in its return statement to perform this state update.

2. display_studies

This tool reads the contents of the state (key search_table) and displays the data back to the user on the front end. It serves as an example of how to share the graph's state with another tool.

  • Functionality:
    The state is passed as an argument using Langgraph's prebuilt module InjectedState. This argument is hidden from the LLM.
  • Implementation:
    The tool accesses the existing state, processes it, and delivers the data for display without altering the state.

Additional Notes:

  • More agents will be added to this workflow in the coming weeks.
  • This workflow has its known streamlit app for now. Once the other agents have also migrated to Lnaggraph, their streamlit apps will merged into a single app and led by a main agent.
  • Currently, the system prompt for Talk2Cells is defined within the scp_agent, but this will eventually handled by Hydra in a different issue.

Revision:

  • Logging and Langsmith tracer were added for observability.

Fixes # (issue) NA

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • 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.: tests/testX.py)
  • No new tests added (Please explain the rationale in this case)

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.

@gurdeep330 gurdeep330 self-assigned this Jan 17, 2025
@gurdeep330 gurdeep330 added the enhancement New feature or request label Jan 17, 2025
Copy link
Member

@dmccloskey dmccloskey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work 💪. I don't have any major comments on the code. A major concern was already addressed by the new issue of using Hydra for configs. Another concern is the addition of langsmith and observability. I would recommend having this added in early on. If you agree, I would recommend adding another issue for observability.

@gurdeep330
Copy link
Member Author

Thanks for the comments, @dmccloskey. Initially, I was planning to add tracers when we connect all the agents later. However, I think having separate tracers for each agent makes sense (we can always refactor them later/still have one for the main agent). I have updated the PR:

  • Added logging (to the agents and tools code) and tracer (to the Streamlit code)
  • Updated PR description
  • Updated video in the PR

@gurdeep330 gurdeep330 requested a review from dmccloskey January 20, 2025 08:17
Copy link
Member

@dmccloskey dmccloskey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks nice 🤩.

The addition application logging, Tracing, and Feedback will provide a solid template for the other agents and a good working example for onboarding potential contributors

ERROR_FLAG = False
with collect_runs() as cb:
# Add Langsmith tracer
tracer = LangChainTracer(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

# Get the app
app = st.session_state.app

def _submit_feedback(user_response):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@dmccloskey dmccloskey merged commit e2535a7 into main Jan 20, 2025
6 checks passed
Copy link
Contributor

🎉 This PR is included in version 1.6.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@dmccloskey dmccloskey deleted the feat/setup-talk2cells branch January 20, 2025 08:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request released
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants