Signpost AI Logo
WorkersTools

Documentselector

📸 Screenshots

Here are visual examples of this section:

Documentselector - Worker Configuration Interface Documentselector - Worker Configuration Interface

1. Overview and Purpose

The Documentselector worker intelligently filters and prioritizes documents from a collection based on a user question and custom selection criteria. It uses AI to analyze document content and return the most relevant matches according to specified prompt instructions. This worker is essential for document retrieval and content filtering workflows.

2. Configuration Parameters

The Worker accepts the following parameters:

  • results: Optional parameter that specifies the maximum number of documents to return (defaults to 8)

3. Input/Output Handles

  • documents: Input handle - accepts an array of VectorDocument objects containing title and body content
  • input: Input handle - accepts the question or query string used for document selection
  • prompt: Input handle - accepts custom criteria or instructions for document selection
  • output: Output handle - returns an array of selected documents ranked by relevance

4. Usage Examples with Code

// Configure the document selector worker
const documentSelector = {
  type: "documentSelector",
  parameters: {
    results: 5  // Return top 5 most relevant documents
  },
  fields: {
    documents: vectorDocuments,  // Array of documents to search
    input: "What are the benefits of renewable energy?",
    prompt: "Prioritize documents that discuss environmental impact and cost savings"
  }
}

5. Integration Examples

This worker fits perfectly into RAG (Retrieval-Augmented Generation) pipelines and knowledge base search systems. It's commonly used before content generation workers to provide relevant context or as part of document analysis workflows.

6. Best Practices

  • Provide clear, specific selection criteria in the prompt field for better results
  • Ensure documents have meaningful titles and content for accurate selection
  • Adjust the results parameter based on your downstream processing needs
  • Use descriptive questions that clearly indicate the type of information you're seeking

7. Troubleshooting Tips

  • Verify that the documents array contains properly formatted VectorDocument objects with title and body fields
  • Check that both input question and documents are provided - the worker returns empty results if either is missing
  • Monitor the worker's error field for API-related issues with the underlying language model
  • If results seem irrelevant, refine your prompt with more specific selection criteria