diff --git a/packages/tools/README.md b/packages/tools/README.md index 375ecfe..82fa7d6 100644 --- a/packages/tools/README.md +++ b/packages/tools/README.md @@ -21,130 +21,22 @@ npm install @kaibanjs/tools ## Available Tools -### 1. Firecrawl - -Firecrawl is a tool that allows agents to interact with the Firecrawl web scraping service, enabling them to extract clean, structured data from websites. - -Learn more: https://www.firecrawl.dev/ - -### 2. Tavily Search - -Tavily Search is a tool that provides AI-optimized search capabilities, delivering comprehensive and accurate results. It's particularly useful for retrieving current information and answering questions about recent events. - -Learn more: https://tavily.com/ - -### 3. Serper - -Serper is a tool that integrates with Google Search API service, providing access to various types of search results including web search, news, images, and more. It's particularly useful for retrieving real-time information from Google's search engine. - -Learn more: https://serper.dev/ - -### 4. Exa Search - -Exa Search is a tool that integrates with Exa (https://exa.ai/), a search engine for AI that organizes the web using embeddings. It provides high-quality web data specifically optimized for AI applications. - -Key features: - -- Neural Search: Meaning-based search using embeddings -- Keyword Search: Traditional search capabilities -- Auto Search: Dynamically chooses between neural and keyword -- Category-focused search (company, research paper, news, github, tweet, etc.) -- Domain and text filtering -- Date-based filtering - -Learn more: https://exa.ai/ - -### 5. WolframAlpha - -WolframAlpha is a tool that integrates with WolframAlpha's computational intelligence engine, providing detailed answers to complex queries across various domains. It's particularly powerful for mathematical, scientific, and technical computations. - -Key features: - -- Advanced computations and data analysis -- Scientific and mathematical calculations -- Real-time data processing -- Domain-specific knowledge in: - - Mathematics - - Physics - - Chemistry - - Engineering - - Earth Sciences - - Life Sciences - - Units & Measures - - Financial calculations - - And more - -Learn more: https://www.wolframalpha.com/ - -### 6. Github Issues - -Github Issues is a tool that allows agents to interact with the Github API, enabling them to fetch issues from a repository. - -Learn more: https://docs.github.com/en/rest/issues/issues - -### 7. Simple RAG - -The Simple RAG Tool integrates with various components from the langchain library to provide a simple interface for asking questions and retrieving answers using the Retrieval-Augmented Generation (RAG) approach. By default use MemoryVectorStore for storing vectors, OpenAIEmbeddings for embeddings, and OpenAI LLM for generating answers. - -#### Features - -- Integrates with the RAG Toolkit for handling the RAG process -- Uses a Loader instance to load and process documents -- Utilizes a Chunker instance to chunk and process text -- Employs an Embeddings instance for handling embeddings -- Stores vectors using a VectorStore instance -- Leverages an LLM instance for the language model -- Defines a promptQuestionTemplate for asking questions -- Requires an OpenAI API key for interacting with the OpenAI API - -#### Usage - -```js -const tool = new SimpleRAG({ - OPENAI_API_KEY: 'your-openai-api-key', - content: 'Large content to process', -}); -const result = await tool._call({ query: 'question to ask' }); -``` - -or - -```js -const tool = new SimpleRAG({ - OPENAI_API_KEY: 'your-openai-api-key', -}); -const result = await tool._call({ - content: 'large content to process', - query: 'question to ask', -}); -``` - -### 8. Website Search - -The Website Search Tool is specifically crafted for conducting semantic searches within the content of a particular website. Leveraging a Retrieval-Augmented Generation (RAG) model, it navigates through the information provided on a given URL. Users have the flexibility to either initiate a search across any website known or discovered during its usage or to concentrate the search on a predefined, specific website. - -#### Features - -Conduct semantic searches within the content of a specific website. -Utilize a RAG model to navigate and retrieve relevant information. -Flexibility to search across any website or focus on a predefined one. -Usage - -#### Usage - -```js -import { WebsiteSearch } from '@kaibanjs/website-search'; - -const tool = new WebsiteSearch({ - OPENAI_API_KEY: 'your-openai-api-key', - url: 'https://example.com', -}); - -const result = await tool._call({ - query: 'What is the main topic of this website?', -}); -console.log(result); -``` +Here's a list of all available tools. Click on the tool names to view their detailed documentation. + +| Tool | Description | Documentation | +|------|-------------|---------------| +| Exa | AI-focused search engine using embeddings to organize web data | [README](src/exa/README.md) | +| Firecrawl | Web scraping service for extracting structured data | [README](src/firecrawl/README.md) | +| GitHub Issues | GitHub API integration for fetching and analyzing repository issues | [README](src/github-issues/README.md) | +| PDF Search | Extract and search content from PDF documents | [README](src/pdf-search/README.md) | +| Serper | Google Search API integration with support for multiple search types | [README](src/serper/README.md) | +| Simple RAG | Basic Retrieval-Augmented Generation implementation for Q&A | [README](src/simple-rag/README.md) | +| Tavily Search | AI-optimized search engine for comprehensive and accurate results | [README](src/tavily/README.md) | +| Text File Search | Search and analyze content within text files | [README](src/textfile-search/README.md) | +| Website Search | Semantic search within website content using RAG models | [README](src/website-search/README.md) | +| WolframAlpha | Computational intelligence engine for complex queries and calculations | [README](src/wolfram-alpha/README.md) | +| Zapier Webhook | Integration with Zapier for workflow automation | [README](src/zapier-webhook/README.md) | +| Make Webhook | Integration with Make (formerly Integromat) for workflow automation | [README](src/make-webhook/README.md) | ## Development @@ -186,13 +78,13 @@ VITE_WOLFRAM_APP_ID=your_wolfram_app_id npm run storybook ``` -5. Build the package: +6. Build the package: ```bash npm run build ``` -6. Run tests: +7. Run tests: ```bash npm run test diff --git a/packages/tools/src/github-issues/README.md b/packages/tools/src/github-issues/README.md new file mode 100644 index 0000000..4433860 --- /dev/null +++ b/packages/tools/src/github-issues/README.md @@ -0,0 +1,92 @@ +# GitHub Issues Tool + +This tool integrates with GitHub's API to fetch issues from specified repositories. It provides a clean, structured way to retrieve open issues, making it ideal for monitoring and analysis purposes in AI applications and automation workflows. + +## Components + +The tool uses the following components: + +- A GitHub API client instance +- Optional GitHub Personal Access Token for authentication +- A custom HTTP client (ky) for making API requests +- Input validation using Zod schema +- Configurable issue limit parameter +- Automatic pagination handling + +## Key Features + +- Fetches open issues from any public GitHub repository +- Handles pagination automatically +- Returns structured data with issue details +- Includes metadata like issue numbers, titles, labels, and descriptions +- Configurable limit for number of issues to fetch +- Built-in error handling and validation +- Support for both authenticated and unauthenticated requests + +## Authentication + +The tool supports two authentication modes: +- Unauthenticated: Works with public repositories (60 requests/hour limit) +- Authenticated: Uses GitHub Personal Access Token (5,000 requests/hour limit) + +## Input + +The input should be a JSON object with a "repoUrl" field containing the GitHub repository URL (e.g., https://github.com/owner/repo). + +## Output + +The output is a structured JSON object containing: +- Repository information (name, URL, owner) +- Metadata (total issues, last updated date, limit) +- Array of issues with details (number, title, URL, labels, description) + +## Example + +```javascript +// Basic usage +const tool = new GithubIssues({ + token: 'github_pat_...', // Optional: GitHub personal access token + limit: 20 // Optional: number of issues to fetch (default: 10) +}); + +const result = await tool._call({ + repoUrl: 'https://github.com/owner/repo' +}); +``` + +## Advanced Example with Error Handling + +```javascript +const tool = new GithubIssues({ + token: process.env.GITHUB_TOKEN, + limit: 50 +}); + +try { + const result = await tool._call({ + repoUrl: 'https://github.com/facebook/react' + }); + + // Access structured data + console.log('Repository:', result.repository.name); + console.log('Total Issues:', result.metadata.totalIssues); + + // Process issues + result.issues.forEach(issue => { + console.log(`#${issue.number}: ${issue.title}`); + console.log(`Labels: ${issue.labels.join(', ')}`); + console.log(`URL: ${issue.url}\n`); + }); +} catch (error) { + console.error('Error fetching GitHub issues:', error); +} +``` + +### Rate Limits + +- Authenticated requests: 5,000 requests per hour +- Unauthenticated requests: 60 requests per hour + +### Disclaimer + +Ensure you have proper API credentials if needed and respect GitHub's API rate limits and terms of service. For private repositories, authentication is required. \ No newline at end of file diff --git a/packages/tools/src/serper/README.md b/packages/tools/src/serper/README.md new file mode 100644 index 0000000..201bc6d --- /dev/null +++ b/packages/tools/src/serper/README.md @@ -0,0 +1,97 @@ +# Serper Tool + +This tool integrates with Serper (https://serper.dev/), a Google Search API service that provides programmatic access to Google Search results. It enables various types of Google searches including web search, image search, news search, and more, making it ideal for AI applications that need real-time information from the web. + +## Components + +The tool uses the following components: + +- A Serper API client instance +- An API Key for authentication +- A custom HTTP client (ky) for making API requests +- Input validation using Zod schema +- Search type configuration +- Optional search parameters + +## Search Types + +The tool supports multiple search types: +- "search" (default): For general search queries +- "images": For image search +- "videos": For video search +- "places": For location-based search +- "maps": For map search +- "news": For news search +- "shopping": For shopping search +- "scholar": For academic publications search +- "patents": For patents search +- "webpage": For scraping webpages (Beta) + +## Key Features + +- Multiple search types for different use cases +- Clean, structured JSON responses +- High-performance API with good uptime +- Webpage scraping capability (Beta) +- Customizable search parameters +- Error handling and validation + +## Input + +The input depends on the search type: +- For webpage scraping: A JSON object with a "url" field +- For all other search types: A JSON object with a "query" field + +## Output + +The output is a structured JSON response from Serper containing search results based on the search type and query. + +## Example + +```javascript +// Basic search +const tool = new Serper({ + apiKey: 'your-api-key', + type: 'search' // Optional, defaults to 'search' +}); + +const result = await tool._call({ + query: 'latest AI developments' +}); + +// Webpage scraping +const webScraperTool = new Serper({ + apiKey: 'your-api-key', + type: 'webpage' +}); + +const scrapingResult = await webScraperTool._call({ + url: 'https://example.com' +}); +``` + +## Advanced Example with Custom Parameters + +```javascript +const tool = new Serper({ + apiKey: process.env.SERPER_API_KEY, + type: 'news', + params: { + num: 10, // Number of results + gl: 'us' // Geographic location + } +}); + +try { + const result = await tool._call({ + query: 'artificial intelligence breakthroughs' + }); + console.log(result); +} catch (error) { + console.error('Error processing Serper query:', error); +} +``` + +### Disclaimer + +Ensure you have proper API credentials and respect Serper's usage terms and rate limits. The webpage scraping feature is in Beta and may be subject to changes. \ No newline at end of file diff --git a/packages/tools/src/tavily/README.md b/packages/tools/src/tavily/README.md new file mode 100644 index 0000000..96bb199 --- /dev/null +++ b/packages/tools/src/tavily/README.md @@ -0,0 +1,73 @@ +# Tavily Search Results Tool + +This tool integrates with Tavily (https://tavily.com/), an advanced search engine optimized for comprehensive, accurate, and trusted results. It's particularly useful for retrieving current information and answering questions about recent events, making it ideal for AI applications and Large Language Models (LLMs). + +## Components + +The tool uses the following components: + +- A Tavily API client instance +- An API Key for authentication +- A custom HTTP client (ky) for making API requests +- Input validation using Zod schema +- Configurable maximum results parameter + +## Key Features + +- Delivers accurate and trusted search results +- Optimized for current events and real-time information +- Returns well-structured JSON data ready for LLM consumption +- Includes content relevance scoring and filtering +- Configurable number of results +- Built-in error handling and validation +- JSON-formatted responses + +## Input + +The input should be a JSON object with a "searchQuery" field containing the search query to process. + +## Output + +The output is a JSON-formatted string containing an array of search results from Tavily. Each result includes relevant information about the search query. + +## Example + +```javascript +const tool = new TavilySearchResults({ + apiKey: 'your-api-key', + maxResults: 5 // Optional, defaults to 5 +}); + +const result = await tool._call({ + searchQuery: 'What are the latest developments in AI?' +}); +``` + +## Advanced Example with Error Handling + +```javascript +const tool = new TavilySearchResults({ + apiKey: process.env.TAVILY_API_KEY, + maxResults: 10 +}); + +try { + const result = await tool._call({ + searchQuery: 'recent breakthroughs in quantum computing' + }); + + // Parse the JSON string back to an object + const searchResults = JSON.parse(result); + + // Process the results + searchResults.forEach((item, index) => { + console.log(`Result ${index + 1}:`, item); + }); +} catch (error) { + console.error('Error processing Tavily search:', error); +} +``` + +### Disclaimer + +Ensure you have proper API credentials and respect Tavily's usage terms and rate limits. The search results are optimized for current events and may vary based on the time of the query. \ No newline at end of file diff --git a/packages/tools/src/wolfram-alpha/README.md b/packages/tools/src/wolfram-alpha/README.md new file mode 100644 index 0000000..7960344 --- /dev/null +++ b/packages/tools/src/wolfram-alpha/README.md @@ -0,0 +1,74 @@ +# WolframAlpha Tool + +This tool integrates with WolframAlpha (https://www.wolframalpha.com/), a computational intelligence engine that provides robust and detailed answers to complex queries across various domains. It leverages WolframAlpha's powerful computational capabilities to handle advanced calculations, data analysis, and domain-specific queries. + +## Components + +The tool uses the following components: + +- A WolframAlpha API client instance +- An App ID for authentication +- A custom HTTP client (ky) for making API requests +- Input validation using Zod schema + +## Key Features + +- Advanced computations and data analysis +- Scientific and mathematical calculations +- Real-time data processing +- Domain-specific knowledge in: + - Mathematics + - Physics + - Chemistry + - Engineering + - Earth Sciences + - Life Sciences + - Units & Measures + - Financial calculations + - And more + +## Input + +The input should be a JSON object with a "query" field containing the question or computation to process. + +## Output + +The output is the response from WolframAlpha's computational engine, providing detailed answers and calculations based on the input query. + +## Example + +```javascript +const tool = new WolframAlphaTool({ + appId: 'your-app-id' +}); + +const result = await tool._call({ + query: 'solve x^2 + 2x + 1 = 0' +}); +``` + +## Prerequisites + +- WolframAlpha API credentials (App ID) +- Sign up for API access at: https://developer.wolframalpha.com/ + +## Advanced Example with Error Handling + +```javascript +const tool = new WolframAlphaTool({ + appId: process.env.WOLFRAM_APP_ID +}); + +try { + const result = await tool._call({ + query: 'calculate the orbital period of Mars' + }); + console.log(result); +} catch (error) { + console.error('Error processing WolframAlpha query:', error); +} +``` + +### Disclaimer + +Ensure you have proper API credentials and respect WolframAlpha's usage terms and rate limits. \ No newline at end of file