Registry / ai-ml / gpt-researcher

gpt-researcher

JSON →
library1.0.27jsnpmunverified

The gpt-researcher npm package (v1.0.27) is a WebSocket client for interacting with GPT Researcher, an open deep research agent. It enables sending research tasks and receiving detailed reports via WebSocket connection to a local or remote GPT Researcher server. The package is in active development with regular updates. Key differentiators: provides structured log data during research process, supports various report types and sources, and is designed for easy integration into Node.js applications. Requires a running GPT Researcher backend server (Python or Docker).

npm install gpt-researcher
INSTALL
IMPORT
SIG · GPT-RESEARCHER
G
gpt-researcher
ai-mljavascriptv1.0.27
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

GPTResearcher
const GPTResearcher = require('gpt-researcher')
import GPTResearcher from 'gpt-researcher'
This package uses CommonJS. ESM import is not supported directly.
GPTResearcher
import GPTResearcher from 'gpt-researcher'
const { GPTResearcher } = require('gpt-researcher')
Default export only. Named destructure from require will fail.
GPTResearcher
const researcher = new GPTResearcher({...})
const researcher = GPTResearcher({...})
You must use the 'new' keyword to instantiate.

Basic usage of GPTResearcher: create instance with host and logListener, then send a research task.

const GPTResearcher = require('gpt-researcher'); const researcher = new GPTResearcher({ host: 'http://localhost:8000', logListener: (data) => console.log('Log:', data) }); researcher.sendMessage({ task: 'What is the capital of France?' });
Debug
Known issues
breakingRequires a running GPT Researcher backend server
fix
Ensure GPT Researcher server (Python or Docker) is running on the specified host and port.
affects: >=0.0.0
gotchaThe package uses CommonJS only. ESM imports will fail.
fix
Use require() instead of import.
affects: >=0.0.0
deprecatedThe 'query' parameter in sendMessage replaced by 'task' in v1.0.0
fix
Use 'task' instead of 'query'.
affects: >=1.0.0
gotchalogListener is optional but if not provided, logs are silently dropped
fix
Always provide a logListener to monitor research progress.
affects: >=0.0.0
breakingWebSocket connection is established on instantiation, not lazily
fix
Make sure the server is reachable before creating a GPTResearcher instance.
affects: >=0.0.0
Errors
Common errors & fixes
Error: connect ECONNREFUSED 127.0.0.1:8000
GPT Researcher backend server is not running or not accessible.
fix
Start the backend server (e.g., using Docker: docker run -p 8000:8000 gptresearcher/gpt-researcher).
TypeError: GPTResearcher is not a constructor
Using destructured require or missing 'new' keyword.
fix
Use 'const GPTResearcher = require("gpt-researcher");' then 'const researcher = new GPTResearcher({...});'.
SyntaxError: Cannot use import statement outside a module
Attempting to use ES import in a CommonJS environment.
fix
Use require() instead of import.
TypeError: researcher.sendMessage is not a function
sendMessage was called before WebSocket connection is fully open.
fix
Wait for the 'open' event or ensure the server is running before sending.
Upgrade
Version history
1.0.27latest on npm
Audit
Dependencies
wsrequiredWebSocket library for client-server communication
Agent activity
39 hits · last 30 days
node
35
Resources
gpt-researcher — npm install gpt-researcher · libregistry