Skip to content

Classifier

azure_openai_classifier_search(classifier, file_name, content, metadata=None, image_url=None, max_characters=8000, system_prompt=None, api_key=None, azure_endpoint=None, api_version=None, model=None, max_retries=5)

Searches a document to find any free-text content that matches a query. Typically used in conjunction with a subsequent reranker step to match the plain-text result to a classifier picklist option.

Parameters:

Name Type Description Default
classifier dict

Dictionary with fields:

  • name (str): Classifier title (e.g. Authoring Party)
  • query (str): Query to search (e.g. "Which organization authored the document?")
required
file_name str

File name of the document

required
content str

The main-body of the prompt

required
metadata dict

Any additional information describing the content

None
image_url str

A signed or public URL where an image can be found

None
max_characters int

Maximum number of text characters (excluding images) from content to be included in the prompt. Any additional characters are trimmed from content.

8000
system_prompt str

Overrides the default prompt

None
api_key str

Access key for the Azure OpenAI resource

None
azure_endpoint str

Your Azure endpoint, including the resource, e.g. https://example-resource.azure.openai.com/. if not provided will default to environment variable AZURE_OPENAI_ENDPOINT.

None
api_version str

API version for Azure resource.

None
model str

Model deployment name within the Azure resource. If not provided will default to environment variable AZURE_OPENAI_DEPLOYMENT.

None
max_retries int

Maximum number of unsuccessful call attempts to the OpenAI service before returning an error.

5

Returns:

Type Description
str

Plain-text answer to the query, or an empty string if no answer found in the document.