1+ > [ !CAUTION]
2+ > These design documents are generated by AI and may not be fully accurate or complete. They are intended to provide a starting point for understanding the system architecture and design patterns used in the template-fastapi application.
3+
14# External API Specification
25
36## Overview
@@ -13,6 +16,7 @@ The template-fastapi application provides a comprehensive REST API built with Fa
1316** Purpose** : Core CRUD operations for item management with Azure CosmosDB backend.
1417
1518** Endpoints** :
19+
1620- ` GET /items/ ` - List all items with pagination
1721- ` GET /items/{item_id} ` - Retrieve specific item
1822- ` POST /items/ ` - Create new item
@@ -21,10 +25,11 @@ The template-fastapi application provides a comprehensive REST API built with Fa
2125- ` GET /items/search/?q={query} ` - Search items by text
2226
2327** Data Model** :
28+
2429``` json
2530{
2631 "id" : " string" ,
27- "name" : " string" ,
32+ "name" : " string" ,
2833 "description" : " string" ,
2934 "price" : 0.0 ,
3035 "tax" : 0.0
@@ -38,6 +43,7 @@ The template-fastapi application provides a comprehensive REST API built with Fa
3843** Purpose** : File upload, storage, and retrieval using Azure Blob Storage.
3944
4045** Endpoints** :
46+
4147- ` GET /files/ ` - List files with optional prefix filter
4248- ` POST /files/upload ` - Upload single file
4349- ` POST /files/upload-multiple ` - Upload multiple files
@@ -47,6 +53,7 @@ The template-fastapi application provides a comprehensive REST API built with Fa
4753- ` DELETE /files/ ` - Delete multiple files (request body)
4854
4955** Features** :
56+
5057- Automatic content type detection
5158- File metadata tracking
5259- Bulk operations support
@@ -58,6 +65,7 @@ The template-fastapi application provides a comprehensive REST API built with Fa
5865** Purpose** : Restaurant management with geospatial search capabilities.
5966
6067** Endpoints** :
68+
6169- ` GET /restaurants/ ` - List restaurants with pagination
6270- ` GET /restaurants/{id} ` - Get restaurant details
6371- ` POST /restaurants/ ` - Create new restaurant
@@ -67,6 +75,7 @@ The template-fastapi application provides a comprehensive REST API built with Fa
6775- ` GET /restaurants/near/?latitude={lat}&longitude={lng} ` - Geospatial proximity search
6876
6977** Search Features** :
78+
7079- Text-based vector search using embeddings
7180- Location-based proximity search with configurable radius
7281- Pagination support for all list operations
@@ -78,6 +87,7 @@ The template-fastapi application provides a comprehensive REST API built with Fa
7887** Purpose** : Batch audio transcription using Azure AI Speech Services.
7988
8089** Endpoints** :
90+
8191- ` GET /transcriptions/ ` - List all transcription jobs
8292- ` POST /transcriptions/ ` - Create transcription job
8393- ` GET /transcriptions/{job_id} ` - Get job status
@@ -86,38 +96,45 @@ The template-fastapi application provides a comprehensive REST API built with Fa
8696- ` DELETE /transcriptions/{job_id} ` - Delete job
8797
8898** Workflow** :
99+
891001 . Submit audio URLs for batch processing
901012 . Monitor job status (Created → Running → Succeeded/Failed)
911023 . Retrieve transcription results when complete
92103
93104### 5. Agent-Based Conversation API
94105
95106#### LangGraph Agents
107+
96108** Base Path** : ` /agents/langgraph/ `
97109
98110** Purpose** : AI agents with custom tools for mathematical calculations, web search, and time queries.
99111
100112** Endpoints** :
113+
101114- ` GET /tools ` - List available agent tools
102115
103116** Available Tools** :
117+
104118- Calculator: Mathematical expression evaluation
105119- Current Time: Timezone-aware time queries
106120- Search: Web search capabilities
107121
108122#### Azure AI Foundry Agents
123+
109124** Base Path** : ` /agents/azure-ai-foundry/ `
110125
111126** Purpose** : Thread-based conversational AI using Azure AI Foundry platform.
112127
113128** Agent Management** :
129+
114130- ` GET / ` - List agents
115131- ` POST / ` - Create agent
116132- ` GET /{agent_id} ` - Get agent details
117133- ` DELETE /{agent_id} ` - Delete agent
118134- ` POST /{agent_id}/chat ` - Chat with agent
119135
120136** Thread Management** :
137+
121138- ` GET /threads/ ` - List conversation threads
122139- ` POST /threads/ ` - Create new thread
123140- ` GET /threads/{thread_id} ` - Get thread details
@@ -130,10 +147,12 @@ The template-fastapi application provides a comprehensive REST API built with Fa
130147** Purpose** : WebSocket-based real-time chat with HTML interface.
131148
132149** Endpoints** :
150+
133151- ` GET / ` - Chat interface (HTML page)
134152- ` WebSocket /ws/{client_id} ` - Real-time messaging
135153
136154** Features** :
155+
137156- Real-time bidirectional communication
138157- Multi-client support
139158- Agent integration capabilities
@@ -145,6 +164,7 @@ The template-fastapi application provides a comprehensive REST API built with Fa
145164** Purpose** : Demonstration endpoints for testing and monitoring.
146165
147166** Endpoints** :
167+
148168- ` GET /roll_dice ` - Random dice roll (1-6)
149169- ` GET /flaky/{failure_rate} ` - Configurable failure simulation (0-100%)
150170- ` GET /flaky/exception ` - Guaranteed exception endpoint
@@ -153,43 +173,51 @@ The template-fastapi application provides a comprehensive REST API built with Fa
153173## Azure Cloud Services Integration
154174
155175### Azure CosmosDB
176+
156177- ** Purpose** : Primary database for items and restaurant data
157178- ** Features** : Global distribution, automatic scaling, vector search support
158179- ** Configuration** : Connection string in ` AZURE_COSMOSDB_CONNECTION_STRING `
159180
160181### Azure Blob Storage
182+
161183- ** Purpose** : File storage and management
162184- ** Features** : Hierarchical namespace, metadata support, CDN integration
163185- ** Configuration** : Connection string in ` AZURE_BLOB_STORAGE_CONNECTION_STRING `
164186
165187### Azure OpenAI Service
188+
166189- ** Purpose** : LLM capabilities for agents and embeddings
167190- ** Models** : GPT-4o for chat, text-embedding-3-small for search
168191- ** Configuration** : Endpoint and API key in environment variables
169192
170193### Azure AI Speech
194+
171195- ** Purpose** : Batch audio transcription
172196- ** Features** : Multi-language support, custom vocabulary, speaker diarization
173197- ** Configuration** : API key and endpoint in environment variables
174198
175199### Azure AI Foundry
200+
176201- ** Purpose** : Enterprise AI agent platform
177202- ** Features** : Thread-based conversations, tool integration, model selection
178203- ** Configuration** : Project endpoint and API key
179204
180205### Azure Application Insights
206+
181207- ** Purpose** : Application monitoring and telemetry
182208- ** Features** : Request tracing, performance monitoring, custom metrics
183209- ** Configuration** : Connection string enables automatic instrumentation
184210
185211## Authentication & Security
186212
187213### Current Implementation
214+
188215- No authentication required (template/development setup)
189216- Internal service-to-service authentication via API keys
190217- Azure services authenticate via connection strings
191218
192219### Production Recommendations
220+
193221- Implement OAuth 2.0 / JWT authentication
194222- Use Azure Active Directory integration
195223- Enable API rate limiting
@@ -199,6 +227,7 @@ The template-fastapi application provides a comprehensive REST API built with Fa
199227## Error Handling
200228
201229### Standard HTTP Status Codes
230+
202231- ` 200 ` - Success
203232- ` 201 ` - Created
204233- ` 400 ` - Bad Request (validation errors)
@@ -207,6 +236,7 @@ The template-fastapi application provides a comprehensive REST API built with Fa
207236- ` 500 ` - Internal Server Error
208237
209238### Error Response Format
239+
210240``` json
211241{
212242 "detail" : " Error description in Japanese/English" ,
@@ -218,28 +248,33 @@ The template-fastapi application provides a comprehensive REST API built with Fa
218248## Monitoring & Observability
219249
220250### Structured Logging
251+
221252- Configurable log levels via ` LOG_LEVEL ` environment variable
222253- JSON-structured logs for production deployment
223254- Request/response logging with correlation IDs
224255
225256### Metrics & Tracing
257+
226258- OpenTelemetry integration with Azure Application Insights
227259- Custom metrics for business operations
228260- Distributed tracing across service boundaries
229261
230262### Health Checks
263+
231264- Built-in FastAPI health monitoring
232265- Azure service dependency health checks
233266- Container readiness and liveness probes
234267
235268## API Versioning & Compatibility
236269
237270### Current Version
271+
238272- API Version: 1.0
239273- No explicit versioning in URLs (future consideration)
240274- Backward compatibility maintained for minor updates
241275
242276### Future Considerations
277+
243278- URL-based versioning (` /v1/ ` , ` /v2/ ` )
244279- Header-based versioning
245- - Feature flags for gradual rollouts
280+ - Feature flags for gradual rollouts
0 commit comments