Reorganize core into subpackages, add local KB, ruff/pyright tooling
- Split backend/app/core into weather/, discord/, memory_kb/, search/ subpackages by responsibility, keeping config.py and llm.py as the shared foundation; updated all import sites accordingly. - Add local Markdown knowledge base support (local_knowledge.py, knowledge_base/fgo.md, LOCAL_KB_* settings) that embeds and injects relevant docs into the system prompt by topic similarity. - Add ruff and pyright as backend dev dependencies with basic config in pyproject.toml for linting and type checking. - Document local machine quirks in CLAUDE.md (Postgres on port 8080, SSLKEYLOGFILE breaking litellm/pyright via OPENSSL_Uplink crashes). - Add backend/run_dev.ps1 dev launcher and docs/discord-bot.md.
This commit is contained in:
@@ -7,7 +7,7 @@ from contextlib import asynccontextmanager
|
||||
|
||||
import litellm
|
||||
from app.core.config import DEFAULT_MODEL, DEBUG
|
||||
from app.core.websearch import WEB_SEARCH_TOOL, search_web
|
||||
from app.core.search.websearch import WEB_SEARCH_TOOL, search_web
|
||||
|
||||
litellm.drop_params = True
|
||||
if DEBUG:
|
||||
@@ -97,6 +97,12 @@ async def complete(
|
||||
return result
|
||||
|
||||
|
||||
async def embed(texts: list[str], model: str) -> list[list[float]]:
|
||||
"""テキスト群を埋め込みベクトルに変換する。"""
|
||||
response = await litellm.aembedding(model=model, input=texts)
|
||||
return [item["embedding"] for item in response.data]
|
||||
|
||||
|
||||
async def resolve_web_search(
|
||||
messages: list[dict],
|
||||
model: str | None = None,
|
||||
|
||||
Reference in New Issue
Block a user