Skip to content

Commit

Permalink
feat: update tests and streamlit_app
Browse files Browse the repository at this point in the history
  • Loading branch information
gurdeep330 committed Jan 17, 2025
1 parent e1ef1a1 commit 31817f7
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 41 deletions.
6 changes: 2 additions & 4 deletions aiagents4pharma/talk2cells/agents/agent_scp.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,11 @@
'''

import os
import sys
from langchain_openai import ChatOpenAI
from langgraph.checkpoint.memory import MemorySaver
from langgraph.graph import START, StateGraph
from langgraph.prebuilt import ToolNode
# from langgraph.prebuilt import ToolNode
from langgraph.prebuilt import create_react_agent
sys.path.append('..')
from ..tools.search_studies import search_studies
from ..tools.display_studies import display_studies
from ..states.state_talk2cells import Talk2Cells
Expand Down Expand Up @@ -44,7 +42,7 @@ def agent_scp_node(state: Talk2Cells):
# Create a ToolNode
# This node will call the tools based
# on the response from the LLM
tool_node = ToolNode(tools)
# tool_node = ToolNode(tools)

# Create the LLM
# And bind the tools to it
Expand Down
16 changes: 0 additions & 16 deletions aiagents4pharma/talk2cells/tests/test_display_studies.py

This file was deleted.

23 changes: 23 additions & 0 deletions aiagents4pharma/talk2cells/tests/test_scp_agent.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
'''
Test cases for the search_studies
'''

# from ..tools.search_studies import search_studies
from aiagents4pharma.talk2cells.agents.agent_scp import get_app
from langchain_core.messages import HumanMessage

def test_agent_scp():
'''
Test the agent_scp.
'''
unique_id = 12345
app = get_app(unique_id)
config = {"configurable": {"thread_id": unique_id}}
prompt = "Search for studies on Crohns Disease."
response = app.invoke(
{"messages": [HumanMessage(content=prompt)]},
config=config
)
assistant_msg = response["messages"][-1].content
# Check if the assistant message is a string
assert isinstance(assistant_msg, str)
17 changes: 0 additions & 17 deletions aiagents4pharma/talk2cells/tests/test_search_studies.py

This file was deleted.

2 changes: 1 addition & 1 deletion aiagents4pharma/talk2cells/tools/search_studies.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def search_studies(search_term: str,
# with the selected columns
df = pd.DataFrame(search_response.json()['studies'])[selected_columns]

# Convert column 'Study Name' into clickable
# Convert column 'Study Name' into clickable
# hyperlinks from the column 'Study URL'
scp_api_url = 'https://singlecell.broadinstitute.org'
df['name'] = df.apply(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@
Talk2Cells: A Streamlit app for the Talk2Cells graph.
'''

from langchain_core.messages import HumanMessage
from agents.agent_scp import get_app
import os
import streamlit as st
import sys
import random
import streamlit as st
from langchain_core.messages import SystemMessage, HumanMessage, AIMessage
from langchain_core.messages import ChatMessage
from langchain_core.prompts import ChatPromptTemplate, MessagesPlaceholder
sys.path.append('./')
from aiagents4pharma.talk2cells.agents.agent_scp import get_app

st.set_page_config(page_title="Talk2Cells", page_icon="🤖", layout="wide")

Expand Down

0 comments on commit 31817f7

Please sign in to comment.