Search Policy Context

Overview

search_policy_context retrieves specific chunks from an insurance policy document by their sequential chunk index, given a chunk_group_id. Use this tool when a previously returned policy chunk has incomplete context — for example, it starts mid-sentence, references a section header that isn't visible, or mentions exclusions that continue beyond the chunk boundary. search_insurance_policy (or search_clinical_notes with note_category set to "Insurance Policy") must be called first in the conversation to obtain a valid chunk_group_id; this identifier must never be fabricated or guessed. A typical usage pattern: if a search result returned chunk_index=57 of total_chunks=130, request start_index=54, end_index=60 to see the surrounding context, checking total_chunks first to avoid requesting out-of-range indices.

Required Parameters

chunk_group_id (string)

  • The chunk group identifier from the meta fields of a search_insurance_policy or search_clinical_notes result.

Optional Parameters

person_id (string)

  • Default: None
  • The identifier of the person whose policy documents are to be retrieved.
  • If not provided, it is extracted from the caller's access token.

start_index (integer)

  • Default: 0
  • Inclusive, zero-based start index of the chunk range to retrieve.

end_index (integer)

  • Default: 4
  • Inclusive, zero-based end index of the chunk range to retrieve.

debug (boolean)

  • Default: False
  • Whether to display debugging information.

Returns

Returns a PolicyContextOutput with the following fields:

  • chunks (array) — sequential chunks from the policy document in reading order, each a note with note_id, patient_id, text, data_availability_reason, data_availability_message, and meta. If a chunk's text is unavailable, text contains an explanatory message instead of clinical content.
  • chunk_group_id (string) — the chunk group identifier used to retrieve these chunks.
  • start_index (integer) — the inclusive start index that was requested.
  • end_index (integer) — the inclusive end index that was requested.
  • total_chunks (integer, optional) — total number of chunks in this document group, if known.
  • truncated (boolean) — True if the requested end_index exceeded total_chunks and the result was capped at the last available chunk.

PolicyContextOutput also inherits common result fields: result (summary text), error (error message — populated when the requested range exceeds total_chunks, i.e. truncation), urls, and meta. A chunk_group_id/range that matches zero chunks returns an error response rather than populating the error field on an otherwise-successful result.

Notes

Both start_index and end_index are inclusive and zero-based. If the requested range exceeds the document's total chunk count, the response is truncated to the available chunks and truncated is set to True, with an explanatory message. Relies on a chunk_group_id obtained from search_insurance_policy, search_clinical_notes, or list_available_insurance_docs.



Did this page help you?