-
Notifications
You must be signed in to change notification settings - Fork 88
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Website search tool #160
Website search tool #160
Conversation
if (!this.content || this.content === '') { | ||
throw new Error('Please provide content to process.'); | ||
} | ||
if (!query || query === '') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi! I'd like to suggest updating the error messages in SimpleRAG to be more explicit for agent decision-making.
Currently, the tool throws errors, but since this tool is meant to be used by agents, we should return structured error messages that help agents make decisions. Here's the proposed change:
js
async call(input) {
const { content = this.content, query } = input;
if (!content) {
return "ERROR_MISSING_CONTENT: No text content was provided for analysis. Agent should provide content in the 'content' field.";
}
if (!query) {
return "ERROR_MISSING_QUERY: No question was provided. Agent should provide a question in the 'query' field.";
}
try {
const ragToolkit = this.ragToolkit;
await ragToolkit.addDocuments([{ source: content, type: 'string' }]);
const response = await ragToolkit.askQuestion(query);
return response;
} catch (error) {
return ERROR_RAG_PROCESSING: RAG processing failed. Details: ${error.message}. Agent should verify content format and query validity.;
}
}
Key improvements:
- Returns errors as strings instead of throwing exceptions
- Adds clear
ERROR_
prefixes for easy error type identification - Makes error messages explicit about what's missing or wrong
- Provides direct guidance on what the agent should do next
- Makes error states machine-parseable while remaining human-readable
Let me know if you'd like me to explain any part of these changes!
this.url = url; | ||
} | ||
if (!this.url || this.url === '') { | ||
throw new Error('Please provide url to process.'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this.chunkOptions = fields.chunkOptions; | ||
this.embeddings = fields.embeddings; | ||
this.vectorStore = fields.vectorStore; | ||
this.llm = fields.llm; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's called it llmInstance ... To speak the same "language" of the KaibanJS framework
this.chunkOptions = fields.chunkOptions; | ||
this.embeddings = fields.embeddings; | ||
this.vectorStore = fields.vectorStore; | ||
this.llm = fields.llm; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's called it llmInstance ... To speak the same "language" of the KaibanJS framework
this.llm = | ||
options.llm || | ||
new ChatOpenAI({ | ||
model: 'gpt-4', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use the 4o-mini as the default instead?
|
||
this.loaders = { | ||
string: (source) => new TextInputLoader(source), | ||
// text: source => new TextLoader(source), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's remove this from here if we are not using it yet
…te query in tool stories
…nd error handling
…F and textfile search exports
…nd restore replace plugin functionality
…ist for improved compatibility
…de.js and Browser environments refactor(pdf-search): rename PDF File Analyzer to PDF File Searcher for consistency refactor(textfile-search): rename Text File Analyzer to Text File Searcher for consistency refactor(textfile-search): update task description and expected output for semantic search fix(website-search): add installation instructions for cheerio dependency chore: add server.js to .gitignore
…ant exclusions for pdf-parse and pdfjs-dist
…in Rollup configuration
… with 'fs/promises'
…cies in README files
RAG-based Search Tools Release 🚀
This PR introduces four new powerful search tools leveraging Retrieval-Augmented Generation (RAG) technology.
What's New
SimpleRAG
: Foundational RAG implementation with langchain componentsWebsiteSearch
: Semantic search capabilities for web contentPDFSearch
: Comprehensive PDF document analysis toolTextFileSearch
: Optimized plain text document searchKey Features
Testing
Documentation
Dependencies
Added:
cheerio
for HTML parsingpdf-parse
for Node.js PDF processingpdfjs-dist
for browser PDF processingRelated Issues
Closes #141