Orchardcore ai documents azureai

From CrestApps/CrestApps.AgentSkills · View interactive version

Orchardcore ai documents azureai is an AI agent skill from the GitHub repository CrestApps/CrestApps.AgentSkills. Skill for indexing CrestApps Orchard Core AI Documents with Azure AI Search. Covers Azure AI Search index profiles, managed chunk mappings, the embedding deployment picked from the embedding slot (textEmbedding capability), vector retrieval, and scoped RAG results. Use this skill when requests menti

How to use this skill

Skill file

Orchard Core AI Documents Azure AI Search

Configure Azure AI Search document retrieval

You are an Orchard Core expert. Configure Azure AI Search as the vector indexing and

retrieval backend for CrestApps AI Documents. Preserve the provider-managed mappings

and configure an embedding deployment before creating an index.

Guidelines

Feature registration

| Registration | Purpose |

|---|---|

| AIDocumentAzureAISearchIndexProfileHandler | Establishes and normalizes provider-specific Azure AI Search mappings. |

| AIDocumentAzureAISearchDocumentIndexHandler | Builds the provider document from document chunk records. |

| AzureAISearchVectorSearchService | Performs filtered vector similarity search for RAG. |

| AddAzureAISearchIndexingSource | Adds AI Documents (Azure AI Search) to Search → Indexing. |

Enable document indexing

{
  "steps": [
    {
      "name": "Feature",
      "enable": [
        "CrestApps.OrchardCore.AI.Documents.ChatInteractions",
        "CrestApps.OrchardCore.AI.Documents.AzureAI",
        "OrchardCore.AzureAI"
      ],
      "disable": []
    }
  ]
}

Enable the PDF or OpenXml features separately when those file formats must be extracted.

They are optional processors and not dependencies of this index provider.

Create the index profile

  1. Configure an Azure AI Search connection in the Orchard Core Azure AI Search feature.
  2. Create an embedding deployment that declares the textEmbedding capability. The

picker lists deployments in the embedding slot only (see orchardcore-ai-model-capabilities).

  1. Go to Search → Indexing and create AI Documents (Azure AI Search).
  2. Select the embedding deployment. It is stored in

DataSourceIndexProfileMetadata.EmbeddingDeploymentName and locked once the index exists.

  1. Select the profile as the Index profile in the documents section of

Settings → Artificial Intelligence.

  1. Upload a document and verify chunks appear in the Azure AI Search index.

The embedding deployment determines vector dimensions: the handler embeds a sample text

to measure them, and falls back to 1536 when it cannot. A model dimension change requires

a compatible new index and reindexing.

Managed Azure AI Search mappings

AIDocumentAzureAISearchIndexProfileHandler owns these fields:

| Field | Mapping |

|---|---|

| chunkId | Text, key, and filterable |

| documentId | Text and filterable |

| content | Text and searchable |

| fileName | Text and filterable |

| referenceId | Text and filterable |

| referenceType | Text and filterable |

| chunkIndex | Integer |

| embedding | Vector, searchable, HNSW profile default |

The handler computes embedding dimensions from the selected deployment. It configures

the default vector profile to use default-hnsw, preserves custom mappings, and

normalizes duplicate managed mappings when an existing profile is loaded or saved.

Do not manually add a second managed mapping to work around an index issue.

Retrieval behavior

AzureAISearchVectorSearchService converts the prompt embedding to a

VectorizedQuery against the embedding field. Every search is constrained by:

It selects the chunk ID, document ID, content, file name, and chunk index, orders the

returned chunks by descending Azure score, and returns at most the requested topN.

These reference filters prevent document chunks from unrelated chat, profile, or

session contexts from entering the RAG prompt.

Query flow

  1. The current user prompt is embedded with the deployment associated with the index.
  2. AI Documents resolves the Azure-keyed IVectorSearchService.
  3. The service runs k-nearest-neighbor vector search with the current reference ID and type filters.
  4. Relevant chunks and source file metadata are supplied as private context to the model.
  5. Azure request failures are logged and return no chunks rather than exposing stale or unscoped results.

Configuration example

Azure AI Search connection details belong in secure Orchard Core Azure AI Search

configuration. Then use the index profile UI to select a connection and embedding

deployment; avoid hard-coding an index name into application code.

{
  "steps": [
    {
      "name": "Feature",
      "enable": [
        "CrestApps.OrchardCore.AI.Documents.Profiles",
        "CrestApps.OrchardCore.AI.Documents.AzureAI"
      ],
      "disable": []
    }
  ]
}

This example enables profile-scoped documents plus the backend. It intentionally does

not require Azure Blob Storage because file storage and vector indexing are independent.

Troubleshooting

| Symptom | Check |

|---|---|

| No AI Documents index source | Confirm OrchardCore.Indexing, OrchardCore.AzureAI, and the exact backend feature are enabled. |

| Index creation cannot select embeddings | Declare textEmbedding on an embedding deployment; chat deployments are not offered. |

| Search returns no chunks | Verify indexed chunks exist, the vector dimensions match the profile, and the reference ID and type match the requesting context. |

| Managed fields duplicate after editing | Reopen and save the profile. The handler normalizes duplicate managed mappings while retaining custom fields. |

| Azure request failure | Check endpoint, credential, network access, index name, and Azure Search service logs. |

| Documents upload but do not answer questions | Confirm an active document index profile and a valid context feature, then reprocess or reindex existing documents. |

Operational and security notes

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.