npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

research_agent

v1.3.0

Published

A research agent that uses AI to research the web and summarize and create reports

Downloads

18

Readme

Description

research_agent leverages AI to automate the research process. It can: Analyze websites and extract relevant information. Generate summaries of findings. Create detailed reports in markdown format. The library supports multiple AI models

  • [x] OpenAI
  • [x] Mistral AI (partial)

Getting Started

Install

pnpm add research_agent

Usage

import { writeFileSync } from 'fs';
import { ResearchManager } from 'research_agent';

const writeToFile = async (fileName, data) => {
  writeFileSync(fileName, data);
};

const main = async () => {
  const manager = new ResearchManager(); // You can customize the LLM model here
  const result = await manager.search('Who is this person in that website "www.youssefhany.dev"?');

  // Write the report to a markdown file
  await writeToFile('output.md', result);
};

void main();

Example with Mistral AI

import { WebPageLoaderWithSummary, QuestionGeneratorAgent, ResearchManager, NotificationManager } from 'research_agent';
import { ChatMistralAI } from '@langchain/mistralai';

const main = async (): Promise<void> => {
  const chatgpt = createOpenAIChatModel({
    modelName: 'gpt-3.5-turbo',
  });
  const mistralai = new ChatMistralAI({
    apiKey: process.env.MISTRAL_API_KEY,
    modelName: 'mistral-large-latest',
  });

  NotificationManager.addListener(console.log);

  const questionGeneratorAgent = new QuestionGeneratorAgent(mistralai); // still not stable with mistral ai
  const researchManager = new ResearchManager(mistralai, questionGeneratorAgent, {
    maxIterations: 2,
    researchWorkerConfig: {
      llmModel: chatgpt,
      tools: {
        webLoader: new WebPageLoaderWithSummary(mistralai),
      },
    },
  });
  const query = 'Write a report about ramadan and its importance';
  await researchManager.search(query);
};

await main();

This code snippet creates a ResearchManager instance and uses it to search for information about a person on a specific website. The search results are then written to a markdown file.

Features

  • Multiple AI model support: Choose from OpenAI, Mistral AI, and potentially others.
  • Question generation: Automatically generates questions to guide the research process.
  • Web search and analysis: Utilizes tools like Tavily Search and Puppeteer to gather information from the web.
  • Report generation: Creates comprehensive reports in markdown format.

Contributing

Contributions are welcome!

License

This project is licensed under the MIT license.

API Reference

For detailed information about the library's API, please refer to the exported classes and functions: ResearchManager: Manages the research process and generates reports. QuestionGeneratorAgent: Generates questions to guide research. SearchWorker: Performs web searches and analyzes websites.