ai-search
Skill2 starsChanged 4 months agoMITView on GitHub
Build and debug code-first Azure AI Search indexing for Foundry agents: load local files, chunk text, generate embeddings through the Foundry project endpoint, create vector and semantic indexes, upload idempotently, and inspect the live service. Use for RAG ingestion, reindexing, schema mismatches, empty indexes, and retrieval checks. NOT for runtime retrieval wiring - load maf-foundry-agent.
- Reads credentials
5 other projects use a version of this.
Adopted by
Most recently taken up by
- tingyulu/MyR2D2their own version, first seen Nov 10, 2026
- ZoolCoder/findabletheir own version, first seen Nov 1, 2026
- manifoldmcp/marketing-skillstheir own version, first seen Oct 17, 2026
- SanHsien/agent-astromechtheir own version, first seen Sep 27, 2026
- ZanderRuss/obsidian-claudetheir own version, first seen Jan 20, 2026
Other versions5 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 5
- tingyulu/MyR2D2★ 20same name
- ZanderRuss/obsidian-claude★ 19same name
- manifoldmcp/marketing-skills★ 5same name
- SanHsien/agent-astromech★ 0same name
- ZoolCoder/findable★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository19 other files it gives its agents.
- .github/copilot-instructions.mdCopilot instructions
- .cursor/rules/repository.mdcCursor rule
- maf-agent-configSkill
- maf-dev-loopSkill
- maf-foundry-agentSkill
- maf-multi-agent-workflowsSkill
- maf-voice-agentSkill
- mermaid-diagramsSkill
- skill-pack-auditSkill
- voicelive-realtimeSkill
- ai-searchSkill
- maf-agent-configSkill
- maf-dev-loopSkill
- maf-foundry-agentSkill
- maf-multi-agent-workflowsSkill
- maf-voice-agentSkill
- mermaid-diagramsSkill
- skill-pack-auditSkill
- voicelive-realtimeSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
15 rules. 0 are common, 9 are distinctive, and 6 are very specific to this project.
0
Common
Most of the 3 edited versions we read keep these.
9
Distinctive
This author's own choices. Worth a look.
6
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 28
Do not add Blob Storage, ADLS, Cosmos DB, indexers, skillsets, Content Understanding, project connections, managed identities, or a second …
- Very specific: line 46
Read deployment coordinates from the repository-root .env.
- Very specific: line 58
Do not reuse the chat deployment for embeddings unless it actually is an embedding model.
- Very specific: line 59
Call load_dotenv() once at the process entry point, before settings are read.
- Distinctive: line 69
Do not delete or rebuild a live index just because a desired schema differs.
- Very specific: line 82
Create one embedding for a short non-empty string and derive the dimension from len(response.data[0].embedding).
- Distinctive: line 91
Use one Azure AI Search document per chunk.
- Very specific: line 103
Use HNSW with cosine distance for Azure OpenAI embeddings.
- Distinctive: line 131
every input is non-empty and below the model's per-input token limit,
- Distinctive: line 132
no request contains more than the endpoint's input-count limit,
- Distinctive: line 141
After Search reports the upload complete:
- Very specific: line 149
Only after those checks pass should runtime retrieval be wired through maf-foundry-agent.
- Distinctive: line 157
Every uploaded vector length matches the live vector field dimension.
- Distinctive: line 158
Every upload result is checked, not merely submitted.
- Distinctive: line 160
No credential value or document body appears in diagnostics.
“Common” is measured: kept by at least 6 in 10 of the 3 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Azure AI Search Indexing for Foundry Agents
Build a repeatable push pipeline that reads content in Python, chunks it in Python, creates embeddings with the existing Foundry resource, and writes vectors plus readable text directly to the existing Azure AI Search index.
The resource boundary is deliberate:
local or application-readable files
-> Python loader and token-aware chunker
-> Foundry embedding deployment
-> Azure AI Search push APIDo not add Blob Storage, ADLS, Cosmos DB, indexers, skillsets, Content Understanding, project connections, managed identities, or a second model resource. The local MAF agent consumes the finished index directly; this workflow ends at a live, verified search index.
Runtime retrieval belongs to maf-foundry-agent. Agent and voice behaviour belongs in YAML and is owned by maf-agent-config.
Load only the depth you need
| Task | Reference |
Establish packages, .env, credentials, and first connection | references/setup.md |
| Implement chunking, stable keys, embeddings, schema, and uploads | references/indexing-pipeline.md |
| Inspect and query the live index without exposing secrets | references/live-checks.md |
Environment contract
Read deployment coordinates from the repository-root .env. Never print key values.
| Variable | Purpose |
FOUNDRY_PROJECT_ENDPOINT | Existing project endpoint, ending in /api/projects/<project> |
FOUNDRY_MODEL | Chat deployment used by the reasoning and VoiceLive paths |
FOUNDRY_EMBEDDING_MODEL | Embedding deployment name, not the model family guessed from it |
AZURE_SEARCH_ENDPOINT | Existing Azure AI Search service endpoint |
AZURE_SEARCH_API_KEY | Admin key in the indexing process; query key in read-only runtime processes |
AZURE_SEARCH_INDEX_NAME | The exact index to inspect, create, populate, and query |
AZURE_SEARCH_API_VERSION | Pinned Search API version used by the installed SDK |
Do not reuse the chat deployment for embeddings unless it actually is an embedding model.
Call load_dotenv() once at the process entry point, before settings are read.
Procedure
1. Inspect before mutating
Load .env, construct SearchIndexClient, and call get_index() plus
get_index_statistics() for AZURE_SEARCH_INDEX_NAME. Record names, field types, vector
dimensions, vector profile, semantic configuration, document count, and vector index size.
Do not delete or rebuild a live index just because a desired schema differs. Classify the difference first:
| Live state | Action |
| Index absent | Create it after the embedding probe |
| Schema compatible | Keep it and upload |
| New optional field only | Apply an additive update deliberately |
| Vector dimensions, key, field type, or analyzer differs | Stop; create a versioned index and switch intentionally |
| Existing documents use an unknown key strategy | Stop; determine ownership before writing |
2. Probe the embedding deployment
Create one embedding for a short non-empty string and derive the dimension from
len(response.data[0].embedding). The response is the source of truth. Never infer dimensions
from a deployment name.
The vector field's vector_search_dimensions must equal that value exactly. The ingestion
and query paths must use the same embedding deployment and dimension setting.
3. Define the minimum useful schema
Use one Azure AI Search document per chunk. Keep both readable content and its vector:
| Field | Shape | Why it exists |
id | key string | Stable chunk identity and upserts |
parent_id | filterable string | Groups chunks from one source and supports stale-chunk cleanup |
title | searchable string | Result display and semantic title |
content | searchable string | Grounding text, keyword search, and semantic ranking |
source_uri | filterable string | Citation and source traceability |
chunk_index | filterable integer | Deterministic ordering and diagnostics |
content_vector | Collection(Edm.Single) | Vector similarity, using the probed dimensions |
Use HNSW with cosine distance for Azure OpenAI embeddings. Add a semantic configuration whose
content field is content and whose title field is title. Keep content_vector out of
normal result payloads.
4. Normalize and chunk in code
Give each source a canonical source_uri, title, and normalized text. Preserve paragraph and
heading boundaries where possible, then enforce the embedding model's token limit with a
token-aware splitter. Make chunk size and overlap checked-in ingestion settings, not secret
environment values.
Reject empty chunks. Store enough metadata to trace every chunk back to its source. Do not use character count as a claim about token count.
5. Generate deterministic keys
Derive parent_id from the canonical source identity and id from parent_id plus the chunk
ordinal. Use a URL-safe hash. The same corpus and settings must produce the same keys on every
run.
An upsert alone does not remove chunks left behind when a document becomes shorter. Compare
the expected key set with the live key set for each parent_id, then delete only stale keys.
6. Embed and upload in bounded batches
Batch chunk texts in source order. Preserve the embedding response's item indexes when joining vectors back to chunks. Enforce all three limits before each request:
- every input is non-empty and below the model's per-input token limit,
- no request contains more than the endpoint's input-count limit,
- aggregate tokens stay below the request limit and deployment quota.
Upload with SearchClient.upload_documents(). Treat any returned IndexingResult whose
succeeded value is false as a failed run; report its key and error message without dumping
document content.
7. Verify the live index
After Search reports the upload complete:
get_index_statistics()reports the expected document count and positive vector storage.- An empty or keyword query returns readable
title,content, andsource_urifields. - A vector query built with the same embedding deployment returns a known relevant chunk.
- A hybrid plus semantic query returns useful ranking for a corpus-specific question.
- A negative query does not produce a misleadingly strong known-answer result.
Only after those checks pass should runtime retrieval be wired through maf-foundry-agent.
Completion criteria
- The pipeline runs from a clean environment using only
.envdeployment values and checked-in ingestion settings. - Rerunning unchanged input produces the same keys and document count.
- Removing or shortening a source removes stale chunks from the index.
- Every uploaded vector length matches the live vector field dimension.
- Every upload result is checked, not merely submitted.
- Live keyword, vector, and hybrid checks return readable source metadata.
- No credential value or document body appears in diagnostics.
Failure signatures
| Symptom | First check |
Embedding call returns 404 | FOUNDRY_EMBEDDING_MODEL is a deployment in FOUNDRY_PROJECT_ENDPOINT |
Upload rejects content_vector | Compare the probed vector length with the live field dimensions |
| Upload returns partial success | Inspect every IndexingResult; do not rely on the HTTP status alone |
| Document count grows on every run | Chunk keys are random or source identities are not canonical |
| Old passages remain searchable | Stale keys were not deleted for the affected parent_id |
| Keyword works but vector search is empty | Vectors are missing, dimensions differ, or the vector profile is not attached |
| Vector results have no usable citations | source_uri, title, or readable content was omitted |
| Portal works but code fails | The code loaded a different .env, endpoint, index name, or API version |
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

