Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
search-gpt-agent
Advanced tools
SearchGPT is a versatile Node.js library that leverages OpenAI's LLMs and Google Search capabilities, allowing for powerful, context-aware query handling and web search functionality. With this library, you can build custom search agents capable of conduc
SearchGPT is a versatile Node.js library that leverages OpenAI's LLMs and Google Search capabilities, allowing for powerful, context-aware query handling and web search functionality. With this library, you can build custom search agents capable of conducting Google searches and extracting and analyzing content using vector similarities.
Before using SearchGPT, please ensure you have Node.js and npm installed. Then, create a .env
file in your project root and include your OpenAI and Google API keys:
OPENAI_API_KEY=your_openai_api_key
GOOGLE_SEARCH_API_KEY=your_google_search_api_key
GOOGLE_SEARCH_ENGINE_ID=your_search_engine_id
To install, run:
npm install search-gpt
Below is a brief example of how to use SearchGPT to create a search agent and perform a context-aware search.
import { config } from 'dotenv';
import { searchGpt, googleSearchWithVectorSimilarityTool } from 'search-gpt';
config();
// Create a search agent
async function example() {
const { createSearchAgent } = searchGpt({
openaiApiKey: process.env.OPENAI_API_KEY,
});
const searchTool = googleSearchWithVectorSimilarityTool({
googleSearchApiKey: process.env.GOOGLE_SEARCH_API_KEY,
googleSearchEngineId: process.env.GOOGLE_SEARCH_ENGINE_ID,
googleSearchApiEntpoint: "https://www.googleapis.com/customsearch/v1",
});
const searchAgent = await createSearchAgent("gpt-4o", [], [searchTool]);
// Perform a context-aware search
const response = await searchAgent.invoke("What is the current price of bitcoin?");
console.log(response.output);
const searchAgentWithContext = await createSearchAgent("gpt-4o", response.outputMessageArray, [searchTool]);
const response2 = await searchAgentWithContext.invoke("How much is that in Australian dollars?");
console.log(response2.output);
}
example();
googleSearchTool
googleSearchWithVectorSimilarityTool
For further customization, explore additional tools provided in src/tools
.
Ensure to replace required API keys and any instance-specific details to utilize SearchGPT effectively. Adjust configurations and refine prompt templates to build agents suited to your domain-specific needs.
FAQs
SearchGPT is a versatile Node.js library that leverages OpenAI's LLMs and Google Search capabilities, allowing for powerful, context-aware query handling and web search functionality. With this library, you can build custom search agents capable of conduc
The npm package search-gpt-agent receives a total of 6 weekly downloads. As such, search-gpt-agent popularity was classified as not popular.
We found that search-gpt-agent demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.