langchain_community.retrievers.kendra.QueryResultItem¶

class langchain_community.retrievers.kendra.QueryResultItem[source]¶

Bases: ResultItem

Query API result item.

Create a new model by parsing and validating input data from keyword arguments.

Raises ValidationError if the input data cannot be parsed to form a valid model.

param AdditionalAttributes: Optional[List[AdditionalResultAttribute]] = []¶

One or more additional attributes associated with the result.

param DocumentAttributes: Optional[List[DocumentAttribute]] = []¶

The document attributes.

param DocumentExcerpt: Optional[TextWithHighLights] = None¶

Excerpt of the document text.

param DocumentId: Optional[str] = None¶

The document ID.

param DocumentTitle: TextWithHighLights [Required]¶

The document title.

param DocumentURI: Optional[str] = None¶

The document URI.

param FeedbackToken: Optional[str] = None¶

Identifies a particular result from a particular query.

param Format: Optional[str] = None¶
If the Type is ANSWER, then format is either:
  • TABLE: a table excerpt is returned in TableExcerpt;

  • TEXT: a text excerpt is returned in DocumentExcerpt.

param Id: Optional[str] = None¶

The ID of the relevant result item.

param ScoreAttributes: Optional[dict] = None¶

The kendra score confidence

param Type: Optional[str] = None¶

Type of result: DOCUMENT or QUESTION_ANSWER or ANSWER

get_additional_metadata() dict[source]¶

Document additional metadata dict. This returns any extra metadata except these:

  • result_id

  • document_id

  • source

  • title

  • excerpt

  • document_attributes

Return type

dict

get_attribute_value() str[source]¶
Return type

str

get_document_attributes_dict() Dict[str, Optional[Union[str, int, List[str]]]]¶

Document attributes dict.

Return type

Dict[str, Optional[Union[str, int, List[str]]]]

get_excerpt() str[source]¶

Document excerpt or passage original content as retrieved by Kendra.

Return type

str

get_score_attribute() str¶

Document Score Confidence

Return type

str

get_title() str[source]¶

Document title.

Return type

str

to_doc(page_content_formatter: ~typing.Callable[[~langchain_community.retrievers.kendra.ResultItem], str] = <function combined_text>) Document¶

Converts this item to a Document.

Parameters

page_content_formatter (Callable[[ResultItem], str]) –

Return type

Document