Get Document Excerpt
get_doc_excerptRetrieve targeted excerpts from large documents based on a query. Uses BM25 relevance to return relevant sections with surrounding context.
Instructions
Get relevant excerpts from a large document matching a query.
Use this instead of get_doc for large documents. Returns targeted excerpts based on BM25 relevance to your query.
Args: url: The URL of the document. query: Query to find relevant sections within the document. max_chunks: Maximum number of chunks to return (default: 5). context_chars: Extra context characters around each chunk (default: 500).
Returns: Document metadata with list of relevant excerpts, each containing content, position, and relevance score.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | Yes | The URL of the document | |
| query | Yes | Query to find relevant sections within the document | |
| max_chunks | No | Maximum chunks to return | |
| context_chars | No | Extra context chars around each chunk |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | Yes | ||
| title | Yes | ||
| source | Yes | ||
| excerpts | Yes | ||
| source_url | Yes | ||
| total_length | Yes |