PubMed_Agent

PubMed Article Search Agent with LlamaIndex and OpenAI

Overview

This project demonstrates an AI-powered agent that efficiently retrieves and summarizes recent PubMed articles based on user queries. Leveraging LlamaIndex, OpenAI, and the Bio.Entrez library, the tool streamlines the process of accessing relevant scientific literature, assisting researchers and professionals in staying up-to-date with cutting-edge findings.

Features

Architecture

1. PubMed Querying

The query_pubmed function interacts with the PubMed API to search for articles and retrieve metadata such as:

2. Custom Tool Creation

The PubMed querying function is encapsulated into a reusable tool using LlamaIndex’s FunctionTool, ensuring seamless integration with the AI agent.

3. Agent Initialization

A ReActAgent is instantiated with the PubMed tool and OpenAI’s GPT model to handle complex queries and deliver contextual, human-readable responses.

4. Interactive Querying

The agent processes natural language queries like: “Find recent articles on diabetes treatment” and fetches relevant, high-quality articles.

Technology Stack

How It Works

1. Setup

Load the OpenAI API Key and Entrez email securely from environment variables or configuration files.

2. Query Execution

The user inputs a natural language query. The ReActAgent uses the PubMed tool to search for relevant articles and process metadata.

3. Response Delivery

The agent summarizes and returns a list of articles, each with:

Example Query and Output

User Query:

“Find recent articles on diabetes treatment.”

Agent Response:

I found some recent articles related to diabetes treatment:

Installation

Clone the repository:

```bash git clone https://github.com/yourusername/PubMed-Search-Agent.git cd PubMed-Search-Agent