Skip to content

Commit d3941da

Browse files
mmlmt2604szl97
andauthored
feat: integrate Azure OpenAI support (#221)
* feat: integrate Azure OpenAI support with client implementation and update documentation - Added AzureAIClient for interacting with Azure OpenAI models. - Updated README.md to include Azure OpenAI API key, endpoint, and version setup instructions. - Modified configuration to support Azure as a model provider. - Enhanced chat completion handling to include Azure API calls in websocket and streaming contexts. - Updated generator configuration to define Azure models and their parameters. * refactor: remove temporary ollma embedding for azure in testing phase * fix: compatible for old version wiki cache #215 (#218) --------- Co-authored-by: 赛卓林 <[email protected]>
1 parent a4951e1 commit d3941da

File tree

6 files changed

+677
-9
lines changed

6 files changed

+677
-9
lines changed

README.md

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,10 @@ echo "OPENAI_API_KEY=your_openai_api_key" >> .env
4343
echo "OPENROUTER_API_KEY=your_openrouter_api_key" >> .env
4444
# Optional: Add Ollama host if not local. defaults to http://localhost:11434
4545
echo "OLLAMA_HOST=your_ollama_host" >> .env
46-
46+
# Optional: Add Azure API key, endpoint and version if you want to use azure openai models
47+
echo "AZURE_OPENAI_API_KEY=your_azure_openai_api_key" >> .env
48+
echo "AZURE_OPENAI_ENDPOINT=your_azure_openai_endpoint" >> .env
49+
echo "AZURE_OPENAI_VERSION=your_azure_openai_version" >> .env
4750
# Run with Docker Compose
4851
docker-compose up
4952
```
@@ -53,6 +56,7 @@ For detailed instructions on using DeepWiki with Ollama and Docker, see [Ollama
5356
> 💡 **Where to get these keys:**
5457
> - Get a Google API key from [Google AI Studio](https://makersuite.google.com/app/apikey)
5558
> - Get an OpenAI API key from [OpenAI Platform](https://platform.openai.com/api-keys)
59+
> - Get Azure OpenAI credentials from [Azure Portal](https://portal.azure.com/) - create an Azure OpenAI resource and get the API key, endpoint, and API version
5660
5761
### Option 2: Manual Setup (Recommended)
5862

@@ -65,6 +69,10 @@ GOOGLE_API_KEY=your_google_api_key
6569
OPENAI_API_KEY=your_openai_api_key
6670
# Optional: Add this if you want to use OpenRouter models
6771
OPENROUTER_API_KEY=your_openrouter_api_key
72+
# Optional: Add this if you want to use Azure OpenAI models
73+
AZURE_OPENAI_API_KEY=your_azure_openai_api_key
74+
AZURE_OPENAI_ENDPOINT=your_azure_openai_endpoint
75+
AZURE_OPENAI_VERSION=your_azure_openai_version
6876
# Optional: Add Ollama host if not local. default: http://localhost:11434
6977
OLLAMA_HOST=your_ollama_host
7078
```
@@ -106,7 +114,7 @@ DeepWiki uses AI to:
106114

107115
1. Clone and analyze the GitHub, GitLab, or Bitbucket repository (including private repos with token authentication)
108116
2. Create embeddings of the code for smart retrieval
109-
3. Generate documentation with context-aware AI (using Google Gemini, OpenAI, OpenRouter, or local Ollama models)
117+
3. Generate documentation with context-aware AI (using Google Gemini, OpenAI, OpenRouter, Azure OpenAI, or local Ollama models)
110118
4. Create visual diagrams to explain code relationships
111119
5. Organize everything into a structured wiki
112120
6. Enable intelligent Q&A with the repository through the Ask feature
@@ -126,11 +134,13 @@ graph TD
126134
M -->|OpenAI| E2[Generate with OpenAI]
127135
M -->|OpenRouter| E3[Generate with OpenRouter]
128136
M -->|Local Ollama| E4[Generate with Ollama]
137+
M -->|Azure| E5[Generate with Azure]
129138
130139
E1 --> E[Generate Documentation]
131140
E2 --> E
132141
E3 --> E
133142
E4 --> E
143+
E5 --> E
134144
135145
D --> F[Create Visual Diagrams]
136146
E --> G[Organize as Wiki]
@@ -144,7 +154,7 @@ graph TD
144154
145155
class A,D data;
146156
class AA,M decision;
147-
class B,C,E,F,G,AB,E1,E2,E3,E4 process;
157+
class B,C,E,F,G,AB,E1,E2,E3,E4,E5 process;
148158
class H result;
149159
```
150160

@@ -179,6 +189,7 @@ DeepWiki now implements a flexible provider-based model selection system support
179189
- **Google**: Default `gemini-2.0-flash`, also supports `gemini-1.5-flash`, `gemini-1.0-pro`, etc.
180190
- **OpenAI**: Default `gpt-4o`, also supports `o4-mini`, etc.
181191
- **OpenRouter**: Access to multiple models via a unified API, including Claude, Llama, Mistral, etc.
192+
- **Azure OpenAI**: Default `gpt-4o`, also supports `o4-mini`, etc.
182193
- **Ollama**: Support for locally running open-source models like `llama3`
183194

184195
### Environment Variables
@@ -190,6 +201,9 @@ Each provider requires its corresponding API key environment variables:
190201
GOOGLE_API_KEY=your_google_api_key # Required for Google Gemini models
191202
OPENAI_API_KEY=your_openai_api_key # Required for OpenAI models
192203
OPENROUTER_API_KEY=your_openrouter_api_key # Required for OpenRouter models
204+
AZURE_OPENAI_API_KEY=your_azure_openai_api_key #Required for Azure OpenAI models
205+
AZURE_OPENAI_ENDPOINT=your_azure_openai_endpoint #Required for Azure OpenAI models
206+
AZURE_OPENAI_VERSION=your_azure_openai_version #Required for Azure OpenAI models
193207
194208
# OpenAI API Base URL Configuration
195209
OPENAI_BASE_URL=https://custom-api-endpoint.com/v1 # Optional, for custom OpenAI API endpoints
@@ -206,7 +220,7 @@ DEEPWIKI_CONFIG_DIR=/path/to/custom/config/dir # Optional, for custom config fi
206220
DeepWiki uses JSON configuration files to manage various aspects of the system:
207221

208222
1. **`generator.json`**: Configuration for text generation models
209-
- Defines available model providers (Google, OpenAI, OpenRouter, Ollama)
223+
- Defines available model providers (Google, OpenAI, OpenRouter, Azure, Ollama)
210224
- Specifies default and available models for each provider
211225
- Contains model-specific parameters like temperature and top_p
212226

@@ -300,6 +314,9 @@ docker-compose up
300314
| `GOOGLE_API_KEY` | Google Gemini API key for AI generation | No | Required only if you want to use Google Gemini models
301315
| `OPENAI_API_KEY` | OpenAI API key for embeddings | Yes | Note: This is required even if you're not using OpenAI models, as it's used for embeddings. |
302316
| `OPENROUTER_API_KEY` | OpenRouter API key for alternative models | No | Required only if you want to use OpenRouter models |
317+
| `AZURE_OPENAI_API_KEY` | Azure OpenAI API key | No | Required only if you want to use Azure OpenAI models |
318+
| `AZURE_OPENAI_ENDPOINT` | Azure OpenAI endpoint | No | Required only if you want to use Azure OpenAI models |
319+
| `AZURE_OPENAI_VERSION` | Azure OpenAI version | No | Required only if you want to use Azure OpenAI models |
303320
| `OLLAMA_HOST` | Ollama Host (default: http://localhost:11434) | No | Required only if you want to use external Ollama server |
304321
| `PORT` | Port for the API server (default: 8001) | No | If you host API and frontend on the same machine, make sure change port of `SERVER_BASE_URL` accordingly |
305322
| `SERVER_BASE_URL` | Base URL for the API server (default: http://localhost:8001) | No |
@@ -336,6 +353,10 @@ docker run -p 8001:8001 -p 3000:3000 \
336353
-e OPENAI_API_KEY=your_openai_api_key \
337354
-e OPENROUTER_API_KEY=your_openrouter_api_key \
338355
-e OLLAMA_HOST=your_ollama_host \
356+
-e AZURE_OPENAI_API_KEY=your_azure_openai_api_key \
357+
-e AZURE_OPENAI_ENDPOINT=your_azure_openai_endpoint \
358+
-e AZURE_OPENAI_VERSION=your_azure_openai_version \
359+
339360
-v ~/.adalflow:/root/.adalflow \
340361
ghcr.io/asyncfuncai/deepwiki-open:latest
341362
```
@@ -365,6 +386,9 @@ You can also mount a .env file to the container:
365386
echo "GOOGLE_API_KEY=your_google_api_key" > .env
366387
echo "OPENAI_API_KEY=your_openai_api_key" >> .env
367388
echo "OPENROUTER_API_KEY=your_openrouter_api_key" >> .env
389+
echo "AZURE_OPENAI_API_KEY=your_azure_openai_api_key" >> .env
390+
echo "AZURE_OPENAI_ENDPOINT=your_azure_openai_endpoint" >> .env
391+
echo "AZURE_OPENAI_VERSION=your_azure_openai_version" >>.env
368392
echo "OLLAMA_HOST=your_ollama_host" >> .env
369393

370394
# Run the container with the .env file mounted
@@ -398,6 +422,9 @@ docker run -p 8001:8001 -p 3000:3000 \
398422
-e GOOGLE_API_KEY=your_google_api_key \
399423
-e OPENAI_API_KEY=your_openai_api_key \
400424
-e OPENROUTER_API_KEY=your_openrouter_api_key \
425+
-e AZURE_OPENAI_API_KEY=your_azure_openai_api_key \
426+
-e AZURE_OPENAI_ENDPOINT=your_azure_openai_endpoint \
427+
-e AZURE_OPENAI_VERSION=your_azure_openai_version \
401428
-e OLLAMA_HOST=your_ollama_host \
402429
deepwiki-open
403430
```
@@ -497,6 +524,7 @@ To use DeepResearch, simply toggle the "Deep Research" switch in the Ask interfa
497524
- **"Missing environment variables"**: Make sure your `.env` file is in the project root and contains the required API keys
498525
- **"API key not valid"**: Check that you've copied the full key correctly with no extra spaces
499526
- **"OpenRouter API error"**: Verify your OpenRouter API key is valid and has sufficient credits
527+
- **"Azure OpenAI API error"**: Verify your Azure OpenAI credentials (API key, endpoint, and version) are correct and the service is properly deployed
500528

501529
### Connection Problems
502530
- **"Cannot connect to API server"**: Make sure the API server is running on port 8001

0 commit comments

Comments
 (0)