azure.ai.language.questionanswering.aio.operations package

class azure.ai.language.questionanswering.aio.operations.QuestionAnsweringClientOperationsMixin[source]
async query_knowledgebase(knowledge_base_query_options: _models.KnowledgeBaseQueryOptions, *, project_name: str, deployment_name: Optional[str] = 'None', **kwargs: Any)_models.KnowledgeBaseAnswers[source]
async query_knowledgebase(*, project_name: str, deployment_name: Optional[str] = 'None', qna_id: Optional[int] = 'None', question: Optional[str] = 'None', top: Optional[int] = 'None', user_id: Optional[str] = 'None', confidence_score_threshold: Optional[float] = 'None', context: Optional[_models.KnowledgeBaseAnswerRequestContext] = 'None', ranker_type: Optional[Union[str, _models.RankerType]] = 'None', strict_filters: Optional[_models.StrictFilters] = 'None', answer_span_request: Optional[_models.AnswerSpanRequest] = 'None', include_unstructured_sources: Optional[bool] = 'None', **kwargs: Any)_models.KnowledgeBaseAnswers

Answers the specified question using your knowledge base.

Parameters

knowledge_base_query_options (KnowledgeBaseQueryOptions) – Post body of the request. Provide either knowledge_base_query_options, OR individual keyword arguments. If both are provided, only the options object will be used.

Keyword Arguments
  • project_name (str) – The name of the project to use.

  • deployment_name (str) – The name of the specific deployment of the project to use.

  • qna_id (int) – Exact QnA ID to fetch from the knowledge base, this field takes priority over question.

  • question (str) – User question to query against the knowledge base. Provide either knowledge_base_query_options, OR individual keyword arguments. If both are provided, only the options object will be used.

  • top (int) – Max number of answers to be returned for the question.

  • user_id (str) – Unique identifier for the user.

  • confidence_score_threshold (float) – Minimum threshold score for answers, value ranges from 0 to 1.

  • context (KnowledgeBaseAnswerRequestContext) – Context object with previous QnA’s information.

  • ranker_type (str or RankerType) – (Optional) Set to ‘QuestionOnly’ for using a question only Ranker. Possible values include: “Default”, “QuestionOnly”.

  • strict_filters (StrictFilters) – Filter QnAs based on give metadata list and knowledge base source names.

  • answer_span_request (AnswerSpanRequest) – To configure Answer span prediction feature.

  • include_unstructured_sources (bool) – (Optional) Flag to enable Query over Unstructured Sources.

  • cls (callable) – A custom type or function that will be passed the direct response

Returns

KnowledgeBaseAnswers, or the result of cls(response)

Return type

KnowledgeBaseAnswers

Raises

~azure.core.exceptions.HttpResponseError

async query_text(text_query_options: _models.TextQueryOptions, **kwargs: Any)_models.TextAnswers[source]
async query_text(*, question: str, records: List[_models.TextRecord], language: Optional[str] = 'None', string_index_type: Optional[Union[str, _models.StringIndexType]] = "'TextElements_v8'", **kwargs: Any)_models.TextAnswers

Answers the specified question using the provided text in the body.

Parameters

text_query_options (TextQueryOptions) – Post body of the request. Provide either text_query_options, OR individual keyword arguments. If both are provided, only the options object will be used.

Keyword Arguments
  • question (str) – User question to query against the given text records. Provide either text_query_options, OR individual keyword arguments. If both are provided, only the options object will be used.

  • records (list[TextRecord]) – Text records to be searched for given question. Provide either text_query_options, OR individual keyword arguments. If both are provided, only the options object will be used.

  • language (str) – Language of the text records. This is BCP-47 representation of a language. For example, use “en” for English; “es” for Spanish etc. If not set, use “en” for English as default.

  • string_index_type (str or StringIndexType) – Specifies the method used to interpret string offsets. Defaults to Text Elements (Graphemes) according to Unicode v8.0.0. For additional information see https://aka.ms/text-analytics-offsets. Possible values include: “TextElements_v8”, “UnicodeCodePoint”, “Utf16CodeUnit”. Default value: “TextElements_v8”.

  • cls (callable) – A custom type or function that will be passed the direct response

Returns

TextAnswers, or the result of cls(response)

Return type

TextAnswers

Raises

~azure.core.exceptions.HttpResponseError