deepwiki-open icon indicating copy to clipboard operation
deepwiki-open copied to clipboard

Support DashScope OpenAI-compatible API

Open Layau-code opened this issue 7 months ago • 1 comments

Hi, thanks for the great project.

I noticed that the current model/API configuration does not seem to support Qwen models through Alibaba Cloud DashScope / Model Studio.

Qwen provides an OpenAI-compatible API endpoint, for example:

OPENAI_API_KEY=<DASHSCOPE_API_KEY>
OPENAI_BASE_URL=https://dashscope.aliyuncs.com/compatible-mode/v1

Layau-code avatar Apr 24 '26 11:04 Layau-code

Update: I was able to get DeepWiki-Open working with a self-hosted OpenAI-compatible vLLM backend.

My setup is using:

  • DeepWiki-Open Docker image
  • AdalFlow 1.1.3
  • vLLM for both generation and embeddings
  • An OpenAI-compatible /v1 endpoint
  • DEEPWIKI_EMBEDDER_TYPE=openai

I found two separate compatibility issues.

1. Embeddings

For the OpenAI-compatible embedding endpoint, OPENAI_BASE_URL was not automatically passed to AdalFlow's OpenAIClient.

Adding initialize_kwargs to embedder.json fixed this:

"embedder": {
  "client_class": "OpenAIClient",
  "initialize_kwargs": {
    "api_key": "${OPENAI_API_KEY}",
    "base_url": "${OPENAI_BASE_URL}"
  },
  "batch_size": 4,
  "model_kwargs": {
    "model": "embedding/bge-m3-Q8_0.gguf",
    "dimensions": 1024,
    "encoding_format": "float"
  }
}

After this change DeepWiki successfully loaded the existing database and validated the embeddings:

Loaded 4022 documents from existing database
embeddings: 4018 non-empty
sample_dims=[1024]
Embedding validation complete: 4018/4022 documents have valid embeddings.
Using 4018 documents with valid embeddings for retrieval
FAISS retriever created successfully
Retrieved 20 documents

2. Generation

The remaining problem was with the generation API.

DeepWiki's OpenAI chat streamer expects Chat Completions streaming chunks and accesses:

chunk.choices[0].delta.content

However, AdalFlow 1.1.3's OpenAIClient.acall() uses the OpenAI Responses API:

self.async_client.responses.create(...)

This produced:

'ResponseCreatedEvent' object has no attribute 'choices'

My vLLM endpoint supports /v1/chat/completions, so I patched the DeepWiki OpenAI-compatible streamer to use:

self.async_client.chat.completions.create(...)

and convert DeepWiki's generated input into a Chat Completions messages payload.

I also explicitly pass:

api_key=OPENAI_API_KEY
base_url=os.environ.get("OPENAI_BASE_URL", "https://api.openai.com/v1/")

to the OpenAI client.

After that change, DeepWiki is successfully getting through RAG retrieval and starting generation:

Retrieved 20 documents
Using openai with model: nvidia/Qwen3.6-35B-A3B-NVFP4

The previous ResponseCreatedEvent / .choices error is no longer occurring.

So it appears the main issue is that OpenAI-compatible endpoints currently need a little more configuration/compatibility handling when used with the AdalFlow/OpenAI Responses API path.

I believe this could be addressed upstream by allowing an OpenAI-compatible base_url to be configured for the generation client and by using Chat Completions for compatible endpoints that expect chat.completions.create() rather than the Responses API.

derpderpington avatar Oct 01 '26 19:10 derpderpington