Skip to content

segment_extract_tool

langroid/agent/tools/segment_extract_tool.py

A tool to extract segment numbers from the last user message, containing numbered segments.

The idea is that when an LLM wants to (or is asked to) simply extract portions of a message verbatim, it should use this tool/function to SPECIFY what should be extracted, rather than actually extracting it. The output will be in the form of a list of segment numbers or ranges. This will usually be much cheaper and faster than actually writing out the extracted text. The handler of this tool/function will then extract the text and send it back.