mirror of
https://github.com/tiennm99/DocsGPT.git
synced 2026-10-13 02:14:23 +00:00
The backend import package is now docsgpt, the name it will carry on PyPI; application was far too generic to install into anyone's site-packages. git mv plus a mechanical rewrite of every import, dotted string and path reference: 734 Python files, the compose files, Dockerfile, workflows, docs, setup scripts, devcontainer, k8s manifests, vscode config, pytest and coverage config, .gitignore. Behaviour is unchanged. Kept for one release: - A top-level application package whose meta-path finder resolves application.x.y to the already-imported docsgpt.x.y object, so old imports and entry points (celery -A application.app.celery, uvicorn application.asgi:asgi_app) keep working with a FutureWarning. - Celery registers every application.* task name as an alias of its docsgpt.* task on start-up, so messages queued by the previous release still run. The redbeat key prefix moves to redbeat:docsgpt:v2: so schedule entries the previous release wrote are left unread instead of firing twice. The backend image builds from the repository root (docker build -f docsgpt/Dockerfile .) so it can ship the alias package; a root .dockerignore allow-lists docsgpt/ and application/ and keeps caches, local data, .env files, the sample index files and the Dockerfile out. Compose and the image workflows point at the new context.
46 lines
1.7 KiB
Python
46 lines
1.7 KiB
Python
"""Provider plugin registry.
|
|
|
|
Plugins are imported eagerly so import errors surface at app boot rather
|
|
than at first request. ``ALL_PROVIDERS`` is the canonical ordered list;
|
|
``PROVIDERS_BY_NAME`` is a name-keyed lookup for LLMCreator and the
|
|
model registry.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
from typing import Dict, List
|
|
|
|
from docsgpt.llm.providers.anthropic import AnthropicProvider
|
|
from docsgpt.llm.providers.base import Provider
|
|
from docsgpt.llm.providers.docsgpt import DocsGPTProvider
|
|
from docsgpt.llm.providers.google import GoogleProvider
|
|
from docsgpt.llm.providers.groq import GroqProvider
|
|
from docsgpt.llm.providers.huggingface import HuggingFaceProvider
|
|
from docsgpt.llm.providers.llama_cpp import LlamaCppProvider
|
|
from docsgpt.llm.providers.novita import NovitaProvider
|
|
from docsgpt.llm.providers.openai import OpenAIProvider
|
|
from docsgpt.llm.providers.openai_compatible import OpenAICompatibleProvider
|
|
from docsgpt.llm.providers.openrouter import OpenRouterProvider
|
|
|
|
# Order here is the order the registry iterates providers (and therefore
|
|
# the order ``/api/models`` reports them). Match the historical order
|
|
# from the old ModelRegistry._load_models for byte-stable output during
|
|
# the migration. ``openai_compatible`` slots in right after ``openai``
|
|
# so legacy ``OPENAI_BASE_URL`` models keep landing in the same place.
|
|
ALL_PROVIDERS: List[Provider] = [
|
|
DocsGPTProvider(),
|
|
OpenAIProvider(),
|
|
OpenAICompatibleProvider(),
|
|
AnthropicProvider(),
|
|
GoogleProvider(),
|
|
GroqProvider(),
|
|
OpenRouterProvider(),
|
|
NovitaProvider(),
|
|
HuggingFaceProvider(),
|
|
LlamaCppProvider(),
|
|
]
|
|
|
|
PROVIDERS_BY_NAME: Dict[str, Provider] = {p.name: p for p in ALL_PROVIDERS}
|
|
|
|
__all__ = ["ALL_PROVIDERS", "PROVIDERS_BY_NAME", "Provider"]
|