> For the complete documentation index, see [llms.txt](https://docs.mindee.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.mindee.com/classification-models/sdk-integration/classification-result.md).

# Classification Result

You'll need to have a response object as described in the [Response Processing](/integrations/client-libraries-sdk/process-the-response.md) section.

## Accessing the Classification

A `Classifier` describes the detected class of the entire document.

### `Classifier` Attributes

#### Document Type

The document category assigned to the sub-document. It is always filled.

It is returned as a string and is identical to the value entered on the Mindee platform — case, spaces, and punctuation included.

#### Extraction Response

Optional extraction response associated with the split. This is only filled if extraction chaining is activated for the model.

{% tabs %}
{% tab title="Python" %}

```python
from mindee import ClassificationResponse

def handle_response(response: ClassificationResponse) -> None:
    classification = response.inference.result.classification

    # Document type identified for this file
    document_type: str = classification.document_type
    print(f"Detected type: {document_type}")

    # Optional extraction response, present if extraction chaining was requested
    extraction_response = classification.extraction_response

    if extraction_response is not None:
        # Access extracted fields from the inference result
        fields = extraction_response.inference.result.fields
        print(f"Extraction fields: {fields}")
```

{% endtab %}

{% tab title="Node.js" %}

```javascript
function handleResponse(response) {
  const classification = response.getInference().getResult().getClassification();

  // Document type identified for this file
  const documentType = classification.getDocumentType();
  console.log(`Detected type: ${documentType}`);

  // Optional extraction response, present if extraction chaining was requested
  const extractionResponse = classification.getExtractionResponse();

  if (extractionResponse != null) {
    // Access extracted fields from the split's inference result
    const fields = extractionResponse.getInference().getResult().getFields();
    console.log(`Extraction fields: ${fields.toString()}`);
  }
}
```

{% endtab %}

{% tab title="PHP" %}

```php
use Mindee\V2\Product\Classification\ClassificationResponse;

public function handleResponse(SplitResponse $response)
{
    $classification = $response->inference->result->classification;
}
```

{% endtab %}

{% tab title="Ruby" %}

```ruby
def handle_response(response)
  classification = response.inference.result.classification

  # Document type identified for this file
  document_type = classification.document_type
  puts "Detected type: #{document_type}"

  # Optional extraction response, present if extraction chaining was requested
  extraction_response = classification.extraction_response

  unless extraction_response.nil?
    # Access extracted fields from the split's inference result
    fields = extraction_response.inference.result.fields
    puts "Extraction fields: #{fields}"
  end
end
```

{% endtab %}

{% tab title="Java" %}

```java
import com.mindee.v2.product.classification.ClassificationResponse;

public void handleResponse(ClassificationResponse response) {
  var classification = response.getInference().getResult().getClassification();
  
  // Document type identified for this file
  String documentType = classification.getDocumentType();
  System.out.println("Detected type: " + documentType);

  // Optional extraction response, present if extraction chaining was requested
  var extractionResponse = classification.getExtractionResponse();

  if (extractionResponse != null) {
    // Access extracted fields from the split's inference result
    var fields = extractionResponse.getInference().getResult().getFields();
    System.out.println("Extraction fields: " + fields.toString());
  }
}
```

{% endtab %}

{% tab title=".NET" %}

```csharp
using Mindee.V2.Product.Classification;

public void HandleResponse(ClassificationResponse response)
{
    var classification = response.Inference.Result.Classification;

    // Document type identified for this file
    string documentType = classification.DocumentType;
    Console.WriteLine($"Detected type: {documentType}");

    // Optional extraction response, present if extraction chaining was requested
    var extractionResponse = classification.ExtractionResponse;

    if (extractionResponse != null)
    {
        // Access extracted fields from the classification's inference result
        var fields = extractionResponse.Inference.Result.Fields;
        Console.WriteLine($"Extraction fields: {fields}");
    }
}
```

{% endtab %}
{% endtabs %}

Chained Extraction results will be an `ExtractionResponse` object. This object is identical to the response of an Extraction Model.

Refer to the [Extraction Result](/extraction-models/sdk-integration/extraction-result.md) section for details on processing the Extraction.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.mindee.com/classification-models/sdk-integration/classification-result.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
