> ## Documentation Index
> Fetch the complete documentation index at: https://io.net/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Extract entities and relationships

> Extracts entities and relationships from a document.

The entities and relationships extraction process involves:

1. Parsing documents into semantic chunks
2. Extracting entities and relationships using LLMs


## OpenAPI

````yaml /openapi/rag-collections/trigger-extraction-for-a-collection.json POST /api/r2r/v3/collections/{id}/extract
openapi: 3.1.0
info:
  title: IO Intelligence
  version: '1.0'
servers:
  - url: https://api.intelligence.io.solutions
security:
  - sec0: []
paths:
  /api/r2r/v3/collections/{id}/extract:
    post:
      summary: Extract entities and relationships
      description: Extracts entities and relationships from a document.
      operationId: trigger-extraction-for-a-collection
      parameters:
        - name: id
          in: path
          description: Collection ID
          schema:
            type: string
          required: true
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                graph_extraction_prompt:
                  type: string
                  description: The prompt to use for knowledge graph extraction.
                  default: graph_extraction
                graph_entity_description_prompt:
                  type: string
                  description: The prompt to use for entity description generation.
                  default: graph_entity_description
                entity_types:
                  type: string
                  description: The types of entities to extract.
                relation_types:
                  type: string
                  description: The types of relations to extract.
                chunk_merge_count:
                  type: integer
                  description: >-
                    The number of extractions to merge into a single graph
                    extraction.
                  default: 2
                  format: int32
                max_knowledge_relationships:
                  type: integer
                  description: >-
                    The maximum length of the description for a node in the
                    graph.
                  default: 65536
                  format: int32
                generation_config:
                  type: object
                  properties:
                    model:
                      type: string
                    temperature:
                      type: number
                      format: double
                    top_p:
                      type: number
                      format: double
                    max_tokens_to_sample:
                      type: integer
                      format: int32
                    stream:
                      type: boolean
                    functions:
                      type: array
                    tools:
                      type: array
                    add_generation_kwargs:
                      type: array
                    api_base:
                      type: string
                    response_format:
                      type: array
                      items:
                        properties:
                          Base Model:
                            type: object
                        type: object
                    extended_thinking:
                      type: boolean
                      description: >-
                        Flag to enable extended thinking mode (for Anthropic
                        providers)
                      default: false
                    thinking_budget:
                      type: integer
                      description: >-
                        Token budget for internal reasoning when extended
                        thinking mode is enabled. Must be less than
                        max_tokens_to_sample.
                      format: int32
                    reasoning_effort:
                      type: string
                      description: >-
                        Effort level for internal reasoning when extended
                        thinking mode is enabled, low, medium, or high.Only
                        applicable to OpenAI providers.
                automatic_deduplication:
                  type: boolean
                  description: Whether to automatically deduplicate entities.
                  default: false
      responses:
        '200':
          description: '200'
          content:
            application/json:
              examples:
                Result:
                  value:
                    results:
                      message: message
              schema:
                type: object
                properties:
                  results:
                    type: object
                    properties:
                      message:
                        type: string
                        example: message
        '404':
          description: '404'
          content:
            application/json:
              examples:
                Result:
                  value: {}
              schema:
                type: object
                properties: {}
        '422':
          description: '422'
          content:
            text/plain:
              examples:
                Result:
                  value: ''
      deprecated: false
components:
  securitySchemes:
    sec0:
      type: oauth2
      flows: {}

````