Query Collection Block

Query and filter collections within Scout workflows

The Query Collection block enables users to perform searches within a specified Scout collection. It supports filtering based on metadata and querying with Jinja templating, providing flexible data retrieval options.

Configuration (Required)

Collection
stringRequired

The ID of the collection to query. Ensure the collection ID is correct and accessible. This field supports Jinja templating for dynamic content generation.

limit
integer

Specifies the maximum number of documents to retrieve from the collection. The default value is 10. Adjust this setting based on the specific needs of your task or application.

minimum_similarity
float

Determines the threshold for document similarity in the retrieval process. A value closer to 1.0 requires a higher similarity between the query and the document text, while a value closer to 0.0 allows for more lenient matches. The default value is 0.5, with a step of 0.1.

Filter Collection
list

Filters to apply to the collections metadata. Use appropriate filters to narrow down search results and retrieve precise data. The default is an empty list.

Query
stringRequired

The query to search for in the collection. This input supports Jinja templating, allowing for dynamic query construction based on workflow state.

See Workflow Logic & State > State Management for details on using dynamic variables in this block.

Outputs

The block outputs a list of results matching the query, including similarity scores, text, and metadata. This structured output allows for further processing and integration within the workflow.

Usage Context

Use this block to search and filter data within a Scout collection. This is particularly useful for retrieving specific documents or entries based on dynamic query conditions.

Best Practices

  • Ensure the collection ID is correct and accessible to prevent errors during execution.
  • Use Jinja templating in the ‘query’ and ‘collection’ fields for dynamic content generation.
  • Set appropriate ‘limit’ and ‘minimum_similarity’ values to optimize search results.
  • Define clear and precise filters to narrow down search results effectively.