# Create resource group with Azure CLI
azgroupcreate\--namerg-ai-foundry-prod\--locationeastus2
# Create AI Foundry Hub
azmlworkspacecreate\--resource-grouprg-ai-foundry-prod\--nameai-foundry-hub\--kindproject
fromazure.ai.mlimportMLClientfromazure.ai.ml.entitiesimportModelDeployment# Deployment with security settingsdeployment=ModelDeployment(name="gpt5-production",model="azureml://registries/gpt-5/models/gpt-5-standard/versions/1",instance_type="Standard_DS4_v2",instance_count=2,request_settings={"max_concurrent_requests_per_instance":50,"request_timeout_ms":30000},environment_variables={"CONTENT_SAFETY_ENABLED":"true","AUDIT_LOGGING":"enabled"})
defsmart_chunking(text,max_tokens=200000):"""Semantic chunking to preserve context"""paragraphs=text.split('\n\n')chunks=[]current_chunk=""forparainparagraphs:estimated_tokens=len(current_chunk+para)//3.5ifestimated_tokens>max_tokens:ifcurrent_chunk:chunks.append(current_chunk.strip())current_chunk=paraelse:# Force split if single paragraph exceeds limitchunks.extend(force_split_paragraph(para,max_tokens))current_chunk=""else:current_chunk+="\n\n"+paraifcurrent_chunk:chunks.append(current_chunk.strip())returnchunks