Professional Documents
Culture Documents
Academic Research Assistance 1716570959
Academic Research Assistance 1716570959
Building an AI-Powered
Academic Research Assistance
1 ANSHUMAN JHA
A Comprehensive Guide: CrewAI, LangChain-Groq & DuckDuckGoSearch
Table of Contents
1. Introduction
• Project Overview
• Use Case Story and Background
2. Project Structure
3. Step-by-Step Guide
2 ANSHUMAN JHA
A Step-by-Step Guide: Building an AI-Powered Academic Research Assistance
1. Introduction
Project Overview
In this tutorial, we will create an AI-powered research agent using Python. This agent will leverage
various tools and APIs to gather information, specifically focusing on retrieving data from research
papers, performing web searches, and providing structured reports.
User: Dr. Jane Doe, a researcher in machine learning, needs to gather the latest advancements in
natural language processing (NLP) to include in her upcoming review paper.
Goal: Utilize the AI research agent to automate the retrieval of the latest NLP research papers and
summarize their abstracts for a comprehensive overview.
Steps:
1. Setup the Agent: Dr. Doe sets up the research agent by following the step-by-step guide to
install dependencies and configure API keys.
2. Dataset Preparation: She loads the arXiv dataset relevant to NLP and populates the
knowledge base using the provided utility functions.
3. Agent Invocation: Dr. Doe invokes the agent with the input "summarize the latest research in
NLP." The agent fetches the necessary data, performs web searches, and aggregates the
information.
4. Report Generation: The output from the agent is formatted into a structured report, which Dr.
Doe includes in her review paper.
Outcome:
Dr. Doe efficiently compiles a comprehensive summary of the latest NLP advancements, significantly
reducing her manual research time and increasing productivity.
3 ANSHUMAN JHA
A Step-by-Step Guide: Building an AI-Powered Academic Research Assistance
2. Project Structure
research_agent/
├── .env
├── agents.py
├── tasks.py
├── utils.py
├── main.py
├── requirements.txt
3. Step-by-Step Guide
Step 1: Set Up the Project
1.1 Create the Project Directory
Open your terminal or command prompt and create a new project directory:
mkdir email_reply
cd email_reply
4 ANSHUMAN JHA
A Step-by-Step Guide: Building an AI-Powered Academic Research Assistance
1.5 Install Dependencies
Install the required Python libraries using pip:
datasets==2.19.1
langchain-pinecone==0.1.0
langchain-openai==0.1.3
langchain==0.1.16
langchain-core==0.1.42
langgraph==0.0.37
langchainhub==0.1.15
semantic-router==0.0.39
serpapi==0.1.5
google-search-results==2.4.2
pygraphviz==1.12
5 ANSHUMAN JHA
A Step-by-Step Guide: Building an AI-Powered Academic Research Assistance
# Load dataset
def load_arxiv_dataset():
dataset = load_dataset("jamescalam/ai-arxiv2-semantic-chunks", split="train")
return dataset
6 ANSHUMAN JHA
A Step-by-Step Guide: Building an AI-Powered Academic Research Assistance
@tool("fetch_arxiv")
def fetch_arxiv_tool(arxiv_id: str):
res = requests.get(f"https://export.arxiv.org/abs/{arxiv_id}")
re_match = abstract_pattern.search(res.text)
return re_match.group(1)
prompt = hub.pull("hwchase17/openai-functions-agent")
7 ANSHUMAN JHA
A Step-by-Step Guide: Building an AI-Powered Academic Research Assistance
# tasks.py
from langchain_core.agents import AgentAction, AgentFinish
from langchain_core.messages import BaseMessage
import operator
import requests
from serpapi import GoogleSearch
import os
8 ANSHUMAN JHA
A Step-by-Step Guide: Building an AI-Powered Academic Research Assistance
report = build_report(agent_out)
print(report)
python main.py
9 ANSHUMAN JHA
A Step-by-Step Guide: Building an AI-Powered Academic Research Assistance
Defines helper functions and configurations, such as loading datasets and initializing Pinecone.
Contains the definitions and initialization of the research agent and tools.
Defines specific tasks and utility functions for the agent to perform.
Serves as the entry point for running the agent, setting up components, and invoking tasks.
10 ANSHUMAN JHA
A Step-by-Step Guide: Building an AI-Powered Academic Research Assistance
Project Overview: An AI-powered research agent that automates the retrieval of research data,
performs web searches, and provides structured reports. The project leverages various tools and APIs,
and we aim to deploy it in a cloud environment for scalability and reliability.
Components to Include:
12 ANSHUMAN JHA
A Step-by-Step Guide: Building an AI-Powered Academic Research Assistance
13 ANSHUMAN JHA