Skip to content

Self-evolving Context Database for AI Agents. Unify Agent Memory, Knowledge RAG and Skills.

feat(config): expose embedding.max_concurrent and vlm.max_concurrent in ov.conf (#282)

yangxinxin-77c6bebefb9f0
diff --git a/README.md b/README.md
index fa5b5b65f..862d23bfa 100644
--- a/README.md
+++ b/README.md
@@ -238,13 +238,15 @@ Create a configuration file `~/.openviking/ov.conf`, remove the comments before
"provider" : "<provider-type>", // Provider type: "volcengine" or "openai" (currently supported)
"dimension": 1024, // Vector dimension
"model" : "<model-name>" // Embedding model name (e.g., doubao-embedding-vision-250615 or text-embedding-3-large)
- }
+ },
+ "max_concurrent": 10 // Max concurrent embedding requests (default: 10)
},
"vlm": {
"api_base" : "<api-endpoint>", // API endpoint address
"api_key" : "<your-api-key>", // Model service API Key
"provider" : "<provider-type>", // Provider type (volcengine, openai, deepseek, anthropic, etc.)
- "model" : "<model-name>" // VLM model name (e.g., doubao-seed-1-8-251228 or gpt-4-vision-preview)
+ "model" : "<model-name>", // VLM model name (e.g., doubao-seed-1-8-251228 or gpt-4-vision-preview)
+ "max_concurrent": 100 // Max concurrent LLM calls for semantic processing (default: 100)
}
}
```
@@ -274,13 +276,15 @@ Create a configuration file `~/.openviking/ov.conf`, remove the comments before
"provider" : "volcengine",
"dimension": 1024,
"model" : "doubao-embedding-vision-250615"
- }
+ },
+ "max_concurrent": 10
},
"vlm": {
"api_base" : "https://ark.cn-beijing.volces.com/api/v3",
"api_key" : "your-volcengine-api-key",
"provider" : "volcengine",
- "model" : "doubao-seed-1-8-251228"
+ "model" : "doubao-seed-1-8-251228",
+ "max_concurrent": 100
}
}
```
@@ -306,13 +310,15 @@ Create a configuration file `~/.openviking/ov.conf`, remove the comments before
"provider" : "openai",
"dimension": 3072,
"model" : "text-embedding-3-large"
- }
+ },
+ "max_concurrent": 10
},
"vlm": {
"api_base" : "https://api.openai.com/v1",
"api_key" : "your-openai-api-key",
"provider" : "openai",
- "model" : "gpt-4-vision-preview"
+ "model" : "gpt-4-vision-preview",
+ "max_concurrent": 100
}
}
```
diff --git a/README_CN.md b/README_CN.md
index 3c55e6bb4..5310b456a 100644
--- a/README_CN.md
+++ b/README_CN.md
@@ -101,13 +101,15 @@ OpenViking 支持多种模型服务:
"provider" : "<provider-type>", // 提供商类型(volcengine、openai 或 jina)
"dimension": 1024, // 向量维度
"model" : "<model-name>" // Embedding 模型名称(如 doubao-embedding-vision-250615 或 text-embedding-3-large)
- }
+ },
+ "max_concurrent": 10 // Embedding 最大并发请求数(默认:10)
},
"vlm": {
"api_base" : "<api-endpoint>", // API 服务端点地址
"api_key" : "<your-api-key>", // 模型服务的 API 密钥
"provider" : "<provider-type>", // 提供商类型(volcengine、openai 或 jina)
- "model" : "<model-name>" // VLM 模型名称(如 doubao-seed-1-8-251228 或 gpt-4-vision-preview)
+ "model" : "<model-name>", // VLM 模型名称(如 doubao-seed-1-8-251228 或 gpt-4-vision-preview)
+ "max_concurrent": 100 // 语义处理最大并发 LLM 调用数(默认:100)
}
}
```
@@ -135,13 +137,15 @@ OpenViking 支持多种模型服务:
"provider" : "volcengine",
"dimension": 1024,
"model" : "doubao-embedding-vision-250615"
- }
+ },
+ "max_concurrent": 10
},
"vlm": {
"api_base" : "https://ark.cn-beijing.volces.com/api/v3",
"api_key" : "your-volcengine-api-key",
"provider" : "volcengine",
- "model" : "doubao-seed-1-8-251228"
+ "model" : "doubao-seed-1-8-251228",
+ "max_concurrent": 100
}
}
```
@@ -167,13 +171,15 @@ OpenViking 支持多种模型服务:
"provider" : "openai",
"dimension": 3072,
"model" : "text-embedding-3-large"
- }
+ },
+ "max_concurrent": 10
},
"vlm": {
"api_base" : "https://api.openai.com/v1",
"api_key" : "your-openai-api-key",
"provider" : "openai",
- "model" : "gpt-4-vision-preview"
+ "model" : "gpt-4-vision-preview",
+ "max_concurrent": 100
}
}
```
diff --git a/openviking/service/core.py b/openviking/service/core.py
index 59d81163a..cab39dfe9 100644
--- a/openviking/service/core.py
+++ b/openviking/service/core.py
@@ -89,7 +89,9 @@ class OpenVikingService:
self._initialized = False
# Initialize storage
- self._init_storage(config.storage, config.embedding.max_concurrent)
+ self._init_storage(
+ config.storage, config.embedding.max_concurrent, config.vlm.max_concurrent
+ )
# Initialize embedder
self._embedder = config.embedding.get_embedder()
@@ -97,7 +99,12 @@ class OpenVikingService:
f"Initialized embedder (dim {config.embedding.dimension}, sparse {self._embedder.is_sparse})"
)
- def _init_storage(self, config: StorageConfig, max_concurrent_embedding: int = 1) -> None:
+ def _init_storage(
+ self,
+ config: StorageConfig,
+ max_concurrent_embedding: int = 10,
+ max_concurrent_semantic: int = 100,
+ ) -> None:
"""Initialize storage resources."""
if config.agfs.backend == "local":
self._agfs_manager = AGFSManager(config=config.agfs)
@@ -113,6 +120,7 @@ class OpenVikingService:
agfs_url=self._agfs_url,
timeout=config.agfs.timeout,
max_concurrent_embedding=max_concurrent_embedding,
+ max_concurrent_semantic=max_concurrent_semantic,
)
else:
logger.warning("AGFS URL not configured, skipping queue manager initialization")
@@ -196,7 +204,11 @@ class OpenVikingService:
return
if self._vikingdb_manager is None:
- self._init_storage(self._config.storage, self._config.embedding.max_concurrent)
+ self._init_storage(
+ self._config.storage,
+ self._config.embedding.max_concurrent,
+ self._config.vlm.max_concurrent,
+ )
if self._embedder is None:
self._embedder = self._config.embedding.get_embedder()
diff --git a/openviking/storage/queuefs/queue_manager.py b/openviking/storage/queuefs/queue_manager.py
index 7ceab4dfe..3c5de9c01 100644
--- a/openviking/storage/queuefs/queue_manager.py
+++ b/openviking/storage/queuefs/queue_manager.py
@@ -30,7 +30,8 @@ def init_queue_manager(
agfs_url: str = "http://localhost:8080",
timeout: int = 10,
mount_point: str = "/queue",
- max_concurrent_embedding: int = 1,
+ max_concurrent_embedding: int = 10,
+ max_concurrent_semantic: int = 100,
) -> "QueueManager":
"""Initialize QueueManager singleton."""
global _instance
@@ -39,6 +40,7 @@ def init_queue_manager(
timeout=timeout,
mount_point=mount_point,
max_concurrent_embedding=max_concurrent_embedding,
+ max_concurrent_semantic=max_concurrent_semantic,
)
return _instance
@@ -66,13 +68,15 @@ class QueueManager:
agfs_url: str = "http://localhost:8080",
timeout: int = 10,
mount_point: str = "/queue",
- max_concurrent_embedding: int = 1,
+ max_concurrent_embedding: int = 10,
+ max_concurrent_semantic: int = 100,
):
"""Initialize QueueManager."""
self._agfs_url = agfs_url
self.timeout = timeout
self.mount_point = mount_point
self._max_concurrent_embedding = max_concurrent_embedding
+ self._max_concurrent_semantic = max_concurrent_semantic
self._agfs: Optional[Any] = None
self._queues: Dict[str, NamedQueue] = {}
self._started = False
@@ -124,7 +128,7 @@ class QueueManager:
logger.info("Embedding queue initialized with TextEmbeddingHandler")
# Semantic Queue
- semantic_processor = SemanticProcessor()
+ semantic_processor = SemanticProcessor(max_concurrent_llm=self._max_concurrent_semantic)
self.get_queue(
self.SEMANTIC,
dequeue_handler=semantic_processor,
diff --git a/openviking_cli/utils/config/embedding_config.py b/openviking_cli/utils/config/embedding_config.py
index 5184ddab6..2d4f1164b 100644
--- a/openviking_cli/utils/config/embedding_config.py
+++ b/openviking_cli/utils/config/embedding_config.py
@@ -105,7 +105,7 @@ class EmbeddingConfig(BaseModel):
hybrid: Optional[EmbeddingModelConfig] = Field(default=None)
max_concurrent: int = Field(
- default=1, description="Maximum number of concurrent embedding requests"
+ default=10, description="Maximum number of concurrent embedding requests"
)
model_config = {"extra": "forbid"}
diff --git a/openviking_cli/utils/config/vlm_config.py b/openviking_cli/utils/config/vlm_config.py
index e3ce672ed..4e5942075 100644
--- a/openviking_cli/utils/config/vlm_config.py
+++ b/openviking_cli/utils/config/vlm_config.py
@@ -28,6 +28,10 @@ class VLMConfig(BaseModel):
thinking: bool = Field(default=False, description="Enable thinking mode for VolcEngine models")
+ max_concurrent: int = Field(
+ default=100, description="Maximum number of concurrent LLM calls for semantic processing"
+ )
+
_vlm_instance: Optional[Any] = None
model_config = {"arbitrary_types_allowed": True, "extra": "forbid"}