Tutorials
Talk2Competitors Tutorial¶
This tutorial will walk you through the process of using Talk2Competitors for academic paper search and analysis. We'll cover installation, setup, and how to use each of the available tools.
Installation¶
First, install the aiagents4pharma package using pip:
# !pip install aiagents4pharma
# This will install the package and all required dependencies
Set up your API key¶
Before using the tools, you need to set up your OpenAI API key. You can do this in two ways:
Option 1: The recommended way to manage your API keys securely.¶
Create a
.env
file in your project root. Example project structure:AIAgents4Pharma/ ├── .env
Add the following line to your
.env
file (replace 'your_api_key_here' with your actual key):OPENAI_API_KEY=your_api_key_here
Use the code below to load your API key from the
.env
file. If your.env
file is not in the same directory, specify its location using a dummy path:
# Import required libraries
import os
from dotenv import load_dotenv
# Specify the path to your .env file
dotenv_path = "./.env" # Replace this with the actual path to your .env file if it's not in the same directory
load_dotenv(dotenv_path)
# Fetch the API key from the environment variables
api_key = os.getenv("OPENAI_API_KEY")
# Validate that the API key was loaded successfully
if not api_key:
raise ValueError(f"API key not found in {dotenv_path}! Ensure the .env file exists and contains the API key.")
# Print statement for debugging (optional, remove in production)
print(f"Loaded API key: {api_key[:5]}... (truncated for security)")
Loaded API key: sk-pr... (truncated for security)
Option 2: Set API Key Directly (for testing only)¶
If you are just testing the script and don’t want to create a .env
file,
you can set the API key directly in your script.
Note: Avoid using this method in production as it exposes your key in plain text.
# Set API key directly (for testing only)
# os.environ["OPENAI_API_KEY"] = "your_api_key_here"
# Example of using the API key
def example_functionality():
if not api_key:
raise ValueError("API key is not set! Ensure you loaded it correctly.")
print("API key is ready to use!")
# Call the example function
example_functionality()
API key is ready to use!
1. Paper Search Tool¶
Let's start by searching for academic papers using the search tool:
# Import the package
import pandas as pd
from aiagents4pharma.talk2competitors.tools.s2.search import search_tool
# Define search parameters
search_input = {
"query": "machine learning in healthcare",
"limit": 5, # Number of results to return
"year": "2023-", # Papers from 2023 onwards
"tool_call_id": "search_demo_1"
}
# Execute search
search_results = search_tool.invoke(input=search_input)
print(search_results)
Starting paper search... Command(update={'papers': {'ac2cffc4b9f96bae24809d738777ae897094ae33': {'Title': 'A Comprehensive Review on Machine Learning in Healthcare Industry: Classification, Restrictions, Opportunities and Challenges', 'Abstract': 'Recently, various sophisticated methods, including machine learning and artificial intelligence, have been employed to examine health-related data. Medical professionals are acquiring enhanced diagnostic and treatment abilities by utilizing machine learning applications in the healthcare domain. Medical data have been used by many researchers to detect diseases and identify patterns. In the current literature, there are very few studies that address machine learning algorithms to improve healthcare data accuracy and efficiency. We examined the effectiveness of machine learning algorithms in improving time series healthcare metrics for heart rate data transmission (accuracy and efficiency). In this paper, we reviewed several machine learning algorithms in healthcare applications. After a comprehensive overview and investigation of supervised and unsupervised machine learning algorithms, we also demonstrated time series tasks based on past values (along with reviewing their feasibility for both small and large datasets).', 'Year': 2023, 'Citation Count': 95, 'URL': 'https://www.semanticscholar.org/paper/ac2cffc4b9f96bae24809d738777ae897094ae33'}, '95e239db43b53a3d0f40f66acdacdce915fe50be': {'Title': 'Federated machine learning in healthcare: A systematic review on clinical applications and technical architecture', 'Abstract': None, 'Year': 2024, 'Citation Count': 12, 'URL': 'https://www.semanticscholar.org/paper/95e239db43b53a3d0f40f66acdacdce915fe50be'}, '5289f24cc7b7d3551d82c336b6dbab5e3e5a5944': {'Title': 'Multiple stakeholders drive diverse interpretability requirements for machine learning in healthcare', 'Abstract': None, 'Year': 2023, 'Citation Count': 21, 'URL': 'https://www.semanticscholar.org/paper/5289f24cc7b7d3551d82c336b6dbab5e3e5a5944'}, '0dbd01fa18af261c2286c6b593633e924e7c9847': {'Title': 'Combining simulation models and machine learning in healthcare management: strategies and applications', 'Abstract': 'Simulation models and artificial intelligence (AI) are largely used to address healthcare and biomedical engineering problems. Both approaches showed promising results in the analysis and optimization of healthcare processes. Therefore, the combination of simulation models and AI could provide a strategy to further boost the quality of health services. In this work, a systematic review of studies applying a hybrid simulation models and AI approach to address healthcare management challenges was carried out. Scopus, Web of Science, and PubMed databases were screened by independent reviewers. The main strategies to combine simulation and AI as well as the major healthcare application scenarios were identified and discussed. Moreover, tools and algorithms to implement the proposed approaches were described. Results showed that machine learning appears to be the most employed AI strategy in combination with simulation models, which mainly rely on agent-based and discrete-event systems. The scarcity and heterogeneity of the included studies suggested that a standardized framework to implement hybrid machine learning-simulation approaches in healthcare management is yet to be defined. Future efforts should aim to use these approaches to design novel intelligent in-silico models of healthcare processes and to provide effective translation to the clinics.', 'Year': 2024, 'Citation Count': 4, 'URL': 'https://www.semanticscholar.org/paper/0dbd01fa18af261c2286c6b593633e924e7c9847'}, '7a93f0136f2ef9976904c99e915abf321ced241a': {'Title': 'How does the model make predictions? A systematic literature review on the explainability power of machine learning in healthcare', 'Abstract': None, 'Year': 2023, 'Citation Count': 45, 'URL': 'https://www.semanticscholar.org/paper/7a93f0136f2ef9976904c99e915abf321ced241a'}}, 'messages': [ToolMessage(content='+----------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------+\n| | ac2cffc4b9f96bae24809d738777ae897094ae33 | 95e239db43b53a3d0f40f66acdacdce915fe50be | 5289f24cc7b7d3551d82c336b6dbab5e3e5a5944 | 0dbd01fa18af261c2286c6b593633e924e7c9847 | 7a93f0136f2ef9976904c99e915abf321ced241a |\n+================+============================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================+===================================================================================================================+======================================================================================================+===========================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================+===================================================================================================================================+\n| Title | A Comprehensive Review on Machine Learning in Healthcare Industry: Classification, Restrictions, Opportunities and Challenges | Federated machine learning in healthcare: A systematic review on clinical applications and technical architecture | Multiple stakeholders drive diverse interpretability requirements for machine learning in healthcare | Combining simulation models and machine learning in healthcare management: strategies and applications | How does the model make predictions? A systematic literature review on the explainability power of machine learning in healthcare |\n+----------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------+\n| Abstract | Recently, various sophisticated methods, including machine learning and artificial intelligence, have been employed to examine health-related data. Medical professionals are acquiring enhanced diagnostic and treatment abilities by utilizing machine learning applications in the healthcare domain. Medical data have been used by many researchers to detect diseases and identify patterns. In the current literature, there are very few studies that address machine learning algorithms to improve healthcare data accuracy and efficiency. We examined the effectiveness of machine learning algorithms in improving time series healthcare metrics for heart rate data transmission (accuracy and efficiency). In this paper, we reviewed several machine learning algorithms in healthcare applications. After a comprehensive overview and investigation of supervised and unsupervised machine learning algorithms, we also demonstrated time series tasks based on past values (along with reviewing their feasibility for both small and large datasets). | | | Simulation models and artificial intelligence (AI) are largely used to address healthcare and biomedical engineering problems. Both approaches showed promising results in the analysis and optimization of healthcare processes. Therefore, the combination of simulation models and AI could provide a strategy to further boost the quality of health services. In this work, a systematic review of studies applying a hybrid simulation models and AI approach to address healthcare management challenges was carried out. Scopus, Web of Science, and PubMed databases were screened by independent reviewers. The main strategies to combine simulation and AI as well as the major healthcare application scenarios were identified and discussed. Moreover, tools and algorithms to implement the proposed approaches were described. Results showed that machine learning appears to be the most employed AI strategy in combination with simulation models, which mainly rely on agent-based and discrete-event systems. The scarcity and heterogeneity of the included studies suggested that a standardized framework to implement hybrid machine learning-simulation approaches in healthcare management is yet to be defined. Future efforts should aim to use these approaches to design novel intelligent in-silico models of healthcare processes and to provide effective translation to the clinics. | |\n+----------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------+\n| Year | 2023 | 2024 | 2023 | 2024 | 2023 |\n+----------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------+\n| Citation Count | 95 | 12 | 21 | 4 | 45 |\n+----------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------+\n| URL | https://www.semanticscholar.org/paper/ac2cffc4b9f96bae24809d738777ae897094ae33 | https://www.semanticscholar.org/paper/95e239db43b53a3d0f40f66acdacdce915fe50be | https://www.semanticscholar.org/paper/5289f24cc7b7d3551d82c336b6dbab5e3e5a5944 | https://www.semanticscholar.org/paper/0dbd01fa18af261c2286c6b593633e924e7c9847 | https://www.semanticscholar.org/paper/7a93f0136f2ef9976904c99e915abf321ced241a |\n+----------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------+', tool_call_id='search_demo_1')]})
# Extract the actual data from the Command object
if hasattr(search_results, "update") and "papers" in search_results.update:
papers = search_results.update["papers"] # Extract the 'papers' dictionary
# Convert the nested dictionary to a list of dictionaries for DataFrame
papers_list = [
{"ID": key, **details} for key, details in papers.items()
]
# Create the DataFrame
df = pd.DataFrame(papers_list)
else:
print("Invalid format for search results!")
df = pd.DataFrame() # Empty DataFrame
# Display the DataFrame
print(df)
ID \ 0 ac2cffc4b9f96bae24809d738777ae897094ae33 1 95e239db43b53a3d0f40f66acdacdce915fe50be 2 5289f24cc7b7d3551d82c336b6dbab5e3e5a5944 3 0dbd01fa18af261c2286c6b593633e924e7c9847 4 7a93f0136f2ef9976904c99e915abf321ced241a Title \ 0 A Comprehensive Review on Machine Learning in ... 1 Federated machine learning in healthcare: A sy... 2 Multiple stakeholders drive diverse interpreta... 3 Combining simulation models and machine learni... 4 How does the model make predictions? A systema... Abstract Year Citation Count \ 0 Recently, various sophisticated methods, inclu... 2023 95 1 None 2024 12 2 None 2023 21 3 Simulation models and artificial intelligence ... 2024 4 4 None 2023 45 URL 0 https://www.semanticscholar.org/paper/ac2cffc4... 1 https://www.semanticscholar.org/paper/95e239db... 2 https://www.semanticscholar.org/paper/5289f24c... 3 https://www.semanticscholar.org/paper/0dbd01fa... 4 https://www.semanticscholar.org/paper/7a93f013...
2. Display Results Tool¶
After searching, we can display the results in a structured format:
from aiagents4pharma.talk2competitors.tools.s2.display_results import display_results
# Ensure `search_results.update["papers"]` returns valid data
state = {"papers": search_results.update["papers"]}
# Correctly provide the required arguments for `invoke`
displayed_results = display_results.invoke({"state": state})
# Convert the displayed results to a Pandas DataFrame
df = pd.DataFrame(displayed_results)
# Display the DataFrame as a table
print(df) # To view in the consoledisplay_results
ac2cffc4b9f96bae24809d738777ae897094ae33 \ Title A Comprehensive Review on Machine Learning in ... Abstract Recently, various sophisticated methods, inclu... Year 2023 Citation Count 95 URL https://www.semanticscholar.org/paper/ac2cffc4... 95e239db43b53a3d0f40f66acdacdce915fe50be \ Title Federated machine learning in healthcare: A sy... Abstract None Year 2024 Citation Count 12 URL https://www.semanticscholar.org/paper/95e239db... 5289f24cc7b7d3551d82c336b6dbab5e3e5a5944 \ Title Multiple stakeholders drive diverse interpreta... Abstract None Year 2023 Citation Count 21 URL https://www.semanticscholar.org/paper/5289f24c... 0dbd01fa18af261c2286c6b593633e924e7c9847 \ Title Combining simulation models and machine learni... Abstract Simulation models and artificial intelligence ... Year 2024 Citation Count 4 URL https://www.semanticscholar.org/paper/0dbd01fa... 7a93f0136f2ef9976904c99e915abf321ced241a Title How does the model make predictions? A systema... Abstract None Year 2023 Citation Count 45 URL https://www.semanticscholar.org/paper/7a93f013...
3. Single Paper Recommendations¶
Get recommendations based on a specific paper:
from aiagents4pharma.talk2competitors.tools.s2.single_paper_rec import get_single_paper_recommendations
# Get first paper ID from search results
paper_id = list(search_results.update["papers"].keys())[0]
# Get recommendations
rec_input = {
"paper_id": paper_id,
"limit": 3,
"year": "2022-",
"tool_call_id": "rec_demo_1"
}
recommendations = get_single_paper_recommendations.invoke(input=rec_input)
print(recommendations)
Command(update={'papers': {'48d264ccc0dbf741a1de41fec22853258d05bd89': {'Title': 'Machine Learning in Healthcare: A Deep Dive into Classification, Limitations, Prospects, And Hurdles', 'Abstract': "Recently, a range of advanced techniques, such as artificial intelligence and machine learning, have been used to analyse health-related data. Machine learning applications are helping medical practitioners become more proficient in diagnosing and treating patients. Numerous academics have used medical data to find trends and diagnose illnesses. There aren't many papers in the literature right now that discuss using machine learning algorithms to increase the efficiency and accuracy of healthcare data. We investigated how well time series healthcare parameters for heart rate data transfer (accuracy and efficiency) may be enhanced using machine learning methods. We explored a number of machine learning techniques for use in healthcare applications in this research. Following a thorough introduction and analysis of supervised and unsupervised machine learning algorithms.", 'Year': 2024, 'Citation Count': 0, 'URL': 'https://www.semanticscholar.org/paper/48d264ccc0dbf741a1de41fec22853258d05bd89'}, 'fc9eba0a8f330654a27c12b33d555c813d0dc450': {'Title': 'The Significance of Machine Learning in Clinical Disease Diagnosis: A Review', 'Abstract': 'The global need for effective disease diagnosis remains substantial, given the complexities of various disease mechanisms and diverse patient symptoms. To tackle these challenges, researchers, physicians, and patients are turning to machine learning (ML), an artificial intelligence (AI) discipline, to develop solutions. By leveraging sophisticated ML and AI methods, healthcare stakeholders gain enhanced diagnostic and treatment capabilities. However, there is a scarcity of research focused on ML algorithms for enhancing the accuracy and computational efficiency. This research investigates the capacity of machine learning algorithms to improve the transmission of heart rate data in time series healthcare metrics, concentrating particularly on optimizing accuracy and efficiency. By exploring various ML algorithms used in healthcare applications, the review presents the latest trends and approaches in ML-based disease diagnosis (MLBDD). The factors under consideration include the algorithm utilized, the types of diseases targeted, the data types employed, the applications, and the evaluation metrics. This review aims to shed light on the prospects of ML in healthcare, particularly in disease diagnosis. By analyzing the current literature, the study provides insights into state-of-the-art methodologies and their performance metrics.', 'Year': 2023, 'Citation Count': 15, 'URL': 'https://www.semanticscholar.org/paper/fc9eba0a8f330654a27c12b33d555c813d0dc450'}, '70980b98e1d84573832ae096e15fd6664556aeae': {'Title': 'Applications of Machine Learning in Healthcare: An Overview', 'Abstract': 'Traditional research techniques do not work well in the dynamic environment of big data in the healthcare industry, which is characterized by enormous numbers, complexity, and speeds. Methods that can effectively estimate models across massive datasets of medical usage data, health findings, private computer data, and records from many other sources are critically needed. The goal of machine learning (ML), a branch of artificial intelligence (AI), is to increase the efficiency and precision of healthcare. Applications of machine learning (ML) are significantly changing the healthcare industry. Big data and improved computing power present an opportunity to apply ML algorithms to benefit healthcare. The healthcare curriculum has to incorporate a variety of ML-related topics so that medical personnel may successfully direct and analyze research in this field. Machine learning will revolutionize nearly every aspect of the healthcare profession as it stands today. To understand the various healthcare applications of this technology, it is necessary to examine the research that has been done in this area. This enumerative article provides a thorough review of machine learning in healthcare, covering its terminology, basic concepts, and present and potential uses.', 'Year': 2022, 'Citation Count': 10, 'URL': 'https://www.semanticscholar.org/paper/70980b98e1d84573832ae096e15fd6664556aeae'}}, 'messages': [ToolMessage(content="+----------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+\n| | 48d264ccc0dbf741a1de41fec22853258d05bd89 | fc9eba0a8f330654a27c12b33d555c813d0dc450 | 70980b98e1d84573832ae096e15fd6664556aeae |\n+================+===================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================+========================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================+================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================+\n| Title | Machine Learning in Healthcare: A Deep Dive into Classification, Limitations, Prospects, And Hurdles | The Significance of Machine Learning in Clinical Disease Diagnosis: A Review | Applications of Machine Learning in Healthcare: An Overview |\n+----------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+\n| Abstract | Recently, a range of advanced techniques, such as artificial intelligence and machine learning, have been used to analyse health-related data. Machine learning applications are helping medical practitioners become more proficient in diagnosing and treating patients. Numerous academics have used medical data to find trends and diagnose illnesses. There aren't many papers in the literature right now that discuss using machine learning algorithms to increase the efficiency and accuracy of healthcare data. We investigated how well time series healthcare parameters for heart rate data transfer (accuracy and efficiency) may be enhanced using machine learning methods. We explored a number of machine learning techniques for use in healthcare applications in this research. Following a thorough introduction and analysis of supervised and unsupervised machine learning algorithms. | The global need for effective disease diagnosis remains substantial, given the complexities of various disease mechanisms and diverse patient symptoms. To tackle these challenges, researchers, physicians, and patients are turning to machine learning (ML), an artificial intelligence (AI) discipline, to develop solutions. By leveraging sophisticated ML and AI methods, healthcare stakeholders gain enhanced diagnostic and treatment capabilities. However, there is a scarcity of research focused on ML algorithms for enhancing the accuracy and computational efficiency. This research investigates the capacity of machine learning algorithms to improve the transmission of heart rate data in time series healthcare metrics, concentrating particularly on optimizing accuracy and efficiency. By exploring various ML algorithms used in healthcare applications, the review presents the latest trends and approaches in ML-based disease diagnosis (MLBDD). The factors under consideration include the algorithm utilized, the types of diseases targeted, the data types employed, the applications, and the evaluation metrics. This review aims to shed light on the prospects of ML in healthcare, particularly in disease diagnosis. By analyzing the current literature, the study provides insights into state-of-the-art methodologies and their performance metrics. | Traditional research techniques do not work well in the dynamic environment of big data in the healthcare industry, which is characterized by enormous numbers, complexity, and speeds. Methods that can effectively estimate models across massive datasets of medical usage data, health findings, private computer data, and records from many other sources are critically needed. The goal of machine learning (ML), a branch of artificial intelligence (AI), is to increase the efficiency and precision of healthcare. Applications of machine learning (ML) are significantly changing the healthcare industry. Big data and improved computing power present an opportunity to apply ML algorithms to benefit healthcare. The healthcare curriculum has to incorporate a variety of ML-related topics so that medical personnel may successfully direct and analyze research in this field. Machine learning will revolutionize nearly every aspect of the healthcare profession as it stands today. To understand the various healthcare applications of this technology, it is necessary to examine the research that has been done in this area. This enumerative article provides a thorough review of machine learning in healthcare, covering its terminology, basic concepts, and present and potential uses. |\n+----------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+\n| Year | 2024 | 2023 | 2022 |\n+----------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+\n| Citation Count | 0 | 15 | 10 |\n+----------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+\n| URL | https://www.semanticscholar.org/paper/48d264ccc0dbf741a1de41fec22853258d05bd89 | https://www.semanticscholar.org/paper/fc9eba0a8f330654a27c12b33d555c813d0dc450 | https://www.semanticscholar.org/paper/70980b98e1d84573832ae096e15fd6664556aeae |\n+----------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+", tool_call_id='rec_demo_1')]})
# Extract recommendation data
if hasattr(recommendations, "update") and "papers" in recommendations.update:
rec_papers = recommendations.update["papers"] # Extract the 'papers' dictionary
# Convert the nested dictionary to a list of dictionaries for DataFrame
rec_papers_list = [
{"ID": key, **details} for key, details in rec_papers.items()
]
# Create the DataFrame
df_recommendations = pd.DataFrame(rec_papers_list)
else:
print("Invalid format for recommendations!")
df_recommendations = pd.DataFrame() # Empty DataFrame
# Display the DataFrame
print(df_recommendations)
ID \ 0 48d264ccc0dbf741a1de41fec22853258d05bd89 1 fc9eba0a8f330654a27c12b33d555c813d0dc450 2 70980b98e1d84573832ae096e15fd6664556aeae Title \ 0 Machine Learning in Healthcare: A Deep Dive in... 1 The Significance of Machine Learning in Clinic... 2 Applications of Machine Learning in Healthcare... Abstract Year Citation Count \ 0 Recently, a range of advanced techniques, such... 2024 0 1 The global need for effective disease diagnosi... 2023 15 2 Traditional research techniques do not work we... 2022 10 URL 0 https://www.semanticscholar.org/paper/48d264cc... 1 https://www.semanticscholar.org/paper/fc9eba0a... 2 https://www.semanticscholar.org/paper/70980b98...
4. Multi-Paper Recommendations¶
Get recommendations based on multiple papers:
from aiagents4pharma.talk2competitors.tools.s2.multi_paper_rec import get_multi_paper_recommendations
paper_ids = list(search_results.update["papers"].keys())[:2]
# Get multi-paper recommendations
multi_rec_input = {
"paper_ids": paper_ids,
"limit": 3,
"year": "2022-",
"tool_call_id": "multi_rec_demo_1"
}
multi_recommendations = get_multi_paper_recommendations.invoke(input=multi_rec_input)
print(multi_recommendations)
Command(update={'papers': {'c0a618a3d7cf8aba7f0ba8fd978cc7a2b631f258': {'Title': 'A Comprehensive Review of Supervised Learning Algorithms in Healthcare Applications', 'Abstract': 'Supervised learning has revolutionized the concept of personalization in treatment with the development of Precision Medicine. This review aims to provide a systematic analysis of the utilization of supervised learning in healthcare and its functions in diagnostics and prognoses, recommendations for treatment, and patient surveillance. Classification algorithms such as Logistic Regression, Support Vector Machines, and Decision Trees. Regression techniques such as Linear Regression, Polynomial Regression, and Neural Networks. Ensemble methods such as Bagging, Boosting, and Stacking. Deep learning techniques such as Convolutional Neural Networks, Recurrent Neural Networks, and Long Short-Term Memory are discussed for their efficiency and applicability in various healthcare applications. There are strengths highlighted by the review including enhanced diagnostic capabilities and patient-targeted therapy alongside weaknesses such as quality of data, interpretability as well as compatibility with existing healthcare systems. This review gives a more generalized approach to how supervised learning algorithms help to enhance healthcare results and identifies the likely topic that requires more research in the future.', 'Year': 2024, 'Citation Count': 0, 'URL': 'https://www.semanticscholar.org/paper/c0a618a3d7cf8aba7f0ba8fd978cc7a2b631f258'}, '08c0dbcbd075558dd2c58e7c043dd4cc9becef5a': {'Title': 'Classification Algorithms for performing Predictive Analysis in Healthcare using Machine Learning Techniques', 'Abstract': ': Machine Learning and Artificial Intelligence have garnered significant attention from researchers in the field of healthcare and medical sciences. The ever-increasing volume, velocity, and variety of healthcare data necessitate the development of an efficient machine learning tool to improve prediction accuracy in the healthcare domain. The primary objective of this paper is to identify the most optimal and appropriate algorithm for disease prediction and diagnosis, and to explore the application of machine learning in healthcare systems. Additionally, this paper provides a comprehensive overview of data science concepts, ranging from data mining techniques to machine learning classification algorithms. The abstract succinctly encapsulates the key aspects of the entire paper, adhering to a predetermined sequence.', 'Year': None, 'Citation Count': 0, 'URL': 'https://www.semanticscholar.org/paper/08c0dbcbd075558dd2c58e7c043dd4cc9becef5a'}, '832d0994201119020488d3b67c70b58a329785e3': {'Title': 'Advancements in Artificial Intelligence: Machine Learning Techniques and Their Real-World Applications', 'Abstract': "Artificial Intelligence (AI) has made major advancements in recent years, with Machine Learning (ML) emerging as one of its most potent subfields. Machine learning techniques, such as supervised learning, unsupervised learning, reinforcement learning, and deep learning, have transformed various sectors by enabling systems to learn from data and make intelligent judgements. the newest breakthroughs in machine learning techniques and their real-world applications across diverse sectors, including healthcare, banking, transportation, and entertainment. We analyse the evolution of algorithms, increases in computer power, and the rising availability of huge data, all of which have contributed to AI's rapid advancement. Additionally, we explore issues such as model interpretability, bias in training data, and ethical implications. By emphasising cutting-edge ML models and their implementations, this article seeks to provide an overview of how machine learning is influencing industries and transforming the way we address challenging challenges.", 'Year': 2024, 'Citation Count': 0, 'URL': 'https://www.semanticscholar.org/paper/832d0994201119020488d3b67c70b58a329785e3'}}, 'messages': [ToolMessage(content="+------------------------------------------+--------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------+------------------+--------------------------------------------------------------------------------+\n| | Title | Abstract | Year | Citation Count | URL |\n+==========================================+==============================================================================================================+===============================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================+========+==================+================================================================================+\n| c0a618a3d7cf8aba7f0ba8fd978cc7a2b631f258 | A Comprehensive Review of Supervised Learning Algorithms in Healthcare Applications | Supervised learning has revolutionized the concept of personalization in treatment with the development of Precision Medicine. This review aims to provide a systematic analysis of the utilization of supervised learning in healthcare and its functions in diagnostics and prognoses, recommendations for treatment, and patient surveillance. Classification algorithms such as Logistic Regression, Support Vector Machines, and Decision Trees. Regression techniques such as Linear Regression, Polynomial Regression, and Neural Networks. Ensemble methods such as Bagging, Boosting, and Stacking. Deep learning techniques such as Convolutional Neural Networks, Recurrent Neural Networks, and Long Short-Term Memory are discussed for their efficiency and applicability in various healthcare applications. There are strengths highlighted by the review including enhanced diagnostic capabilities and patient-targeted therapy alongside weaknesses such as quality of data, interpretability as well as compatibility with existing healthcare systems. This review gives a more generalized approach to how supervised learning algorithms help to enhance healthcare results and identifies the likely topic that requires more research in the future. | 2024 | 0 | https://www.semanticscholar.org/paper/c0a618a3d7cf8aba7f0ba8fd978cc7a2b631f258 |\n+------------------------------------------+--------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------+------------------+--------------------------------------------------------------------------------+\n| 08c0dbcbd075558dd2c58e7c043dd4cc9becef5a | Classification Algorithms for performing Predictive Analysis in Healthcare using Machine Learning Techniques | : Machine Learning and Artificial Intelligence have garnered significant attention from researchers in the field of healthcare and medical sciences. The ever-increasing volume, velocity, and variety of healthcare data necessitate the development of an efficient machine learning tool to improve prediction accuracy in the healthcare domain. The primary objective of this paper is to identify the most optimal and appropriate algorithm for disease prediction and diagnosis, and to explore the application of machine learning in healthcare systems. Additionally, this paper provides a comprehensive overview of data science concepts, ranging from data mining techniques to machine learning classification algorithms. The abstract succinctly encapsulates the key aspects of the entire paper, adhering to a predetermined sequence. | nan | 0 | https://www.semanticscholar.org/paper/08c0dbcbd075558dd2c58e7c043dd4cc9becef5a |\n+------------------------------------------+--------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------+------------------+--------------------------------------------------------------------------------+\n| 832d0994201119020488d3b67c70b58a329785e3 | Advancements in Artificial Intelligence: Machine Learning Techniques and Their Real-World Applications | Artificial Intelligence (AI) has made major advancements in recent years, with Machine Learning (ML) emerging as one of its most potent subfields. Machine learning techniques, such as supervised learning, unsupervised learning, reinforcement learning, and deep learning, have transformed various sectors by enabling systems to learn from data and make intelligent judgements. the newest breakthroughs in machine learning techniques and their real-world applications across diverse sectors, including healthcare, banking, transportation, and entertainment. We analyse the evolution of algorithms, increases in computer power, and the rising availability of huge data, all of which have contributed to AI's rapid advancement. Additionally, we explore issues such as model interpretability, bias in training data, and ethical implications. By emphasising cutting-edge ML models and their implementations, this article seeks to provide an overview of how machine learning is influencing industries and transforming the way we address challenging challenges. | 2024 | 0 | https://www.semanticscholar.org/paper/832d0994201119020488d3b67c70b58a329785e3 |\n+------------------------------------------+--------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------+------------------+--------------------------------------------------------------------------------+", tool_call_id='multi_rec_demo_1')]})
# Extract recommendation data
if hasattr(multi_recommendations, "update") and "papers" in multi_recommendations.update:
multi_rec_papers = multi_recommendations.update["papers"] # Extract the 'papers' dictionary
# Convert the nested dictionary to a list of dictionaries for DataFrame
multi_rec_papers_list = [
{"ID": key, **details} for key, details in multi_rec_papers.items()
]
# Create the DataFrame
df_multi_recommendations = pd.DataFrame(multi_rec_papers_list)
else:
print("Invalid format for multi-paper recommendations!")
df_multi_recommendations = pd.DataFrame() # Empty DataFrame
# Display the DataFrame
print(df_multi_recommendations)
ID \ 0 c0a618a3d7cf8aba7f0ba8fd978cc7a2b631f258 1 08c0dbcbd075558dd2c58e7c043dd4cc9becef5a 2 832d0994201119020488d3b67c70b58a329785e3 Title \ 0 A Comprehensive Review of Supervised Learning ... 1 Classification Algorithms for performing Predi... 2 Advancements in Artificial Intelligence: Machi... Abstract Year Citation Count \ 0 Supervised learning has revolutionized the con... 2024.0 0 1 : Machine Learning and Artificial Intelligence... NaN 0 2 Artificial Intelligence (AI) has made major ad... 2024.0 0 URL 0 https://www.semanticscholar.org/paper/c0a618a3... 1 https://www.semanticscholar.org/paper/08c0dbcb... 2 https://www.semanticscholar.org/paper/832d0994...
Using the Main Agent¶
Instead of using individual tools, you can use the main agent for a more integrated experience:
from aiagents4pharma.talk2competitors.agents.main_agent import get_app
from langchain_core.messages import HumanMessage
# Initialize the app
app = get_app(thread_id="tutorial_demo", llm_model="gpt-4o-mini")
# Create initial state
initial_state = {
"messages": [HumanMessage(content="search for recent papers about machine learning in healthcare")],
"papers": {},
"is_last_step": False,
"current_agent": None,
"llm_model": "gpt-4o-mini"
}
# Run query through main agent
response = app.invoke(initial_state)
Testing the Application¶
The application includes comprehensive tests. Here's how to run them:
# !pytest tests/test_langgraph.py -v
# This will run all tests and show detailed output
Tips for Best Results¶
For paper searches:
- Use specific academic terms
- Include relevant keywords
- Specify year ranges when needed
For recommendations:
- Use paper IDs from search results
- Try both single and multi-paper recommendations
- Adjust the limit parameter based on your needs
Error handling:
- Always check the response structure
- Use try-except blocks for robust error handling
- Verify paper IDs exist before requesting recommendations