chore: initialize EverOS 1.0.0
md-first memory extraction framework for AI agents. Markdown is the single source of truth; SQLite holds state and LanceDB provides the rebuildable vector + BM25 + scalar index. The codebase follows a single-direction DDD layering (entrypoints -> service -> memory -> infra, with component / core / config cross-cutting) enforced by import-linter. Engineering surface: - Coding conventions in .claude/rules/ (path-scoped) and workflows in .claude/skills/ (/commit, /new-branch, /pr). - GitHub Actions CI runs make lint + test + integration; pre-commit mirrors the gates locally (ruff, hygiene hooks, gitlint commit-msg). - Commit messages follow Conventional Commits, enforced by gitlint. - make lint also enforces datetime two-zone discipline and OpenAPI drift.
This commit is contained in:
46
tests/unit/test_component/test_embedding/test_factory.py
Normal file
46
tests/unit/test_component/test_embedding/test_factory.py
Normal file
@ -0,0 +1,46 @@
|
||||
"""``build_embedding_provider`` — settings validation + provider build."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import pytest
|
||||
from pydantic import SecretStr
|
||||
|
||||
from everos.component.embedding import (
|
||||
OpenAIEmbeddingProvider,
|
||||
build_embedding_provider,
|
||||
)
|
||||
from everos.config.settings import EmbeddingSettings
|
||||
|
||||
|
||||
def test_raises_when_model_missing() -> None:
|
||||
s = EmbeddingSettings(model=None, api_key=SecretStr("k"), base_url="https://x")
|
||||
with pytest.raises(ValueError, match="EVEROS_EMBEDDING__MODEL"):
|
||||
build_embedding_provider(s)
|
||||
|
||||
|
||||
def test_raises_when_api_key_missing() -> None:
|
||||
s = EmbeddingSettings(model="m", api_key=None, base_url="https://x")
|
||||
with pytest.raises(ValueError, match="EVEROS_EMBEDDING__API_KEY"):
|
||||
build_embedding_provider(s)
|
||||
|
||||
|
||||
def test_raises_when_base_url_missing() -> None:
|
||||
s = EmbeddingSettings(model="m", api_key=SecretStr("k"), base_url=None)
|
||||
with pytest.raises(ValueError, match="EVEROS_EMBEDDING__BASE_URL"):
|
||||
build_embedding_provider(s)
|
||||
|
||||
|
||||
def test_builds_openai_embedding_provider_with_default_dim() -> None:
|
||||
s = EmbeddingSettings(model="m", api_key=SecretStr("k"), base_url="https://x")
|
||||
p = build_embedding_provider(s)
|
||||
assert isinstance(p, OpenAIEmbeddingProvider)
|
||||
|
||||
|
||||
def test_custom_dim_passes_through() -> None:
|
||||
s = EmbeddingSettings(model="m", api_key=SecretStr("k"), base_url="https://x")
|
||||
p = build_embedding_provider(s, dim=512)
|
||||
assert isinstance(p, OpenAIEmbeddingProvider)
|
||||
# Provider stores dim on a private attr; assert via the public output shape
|
||||
# only if straightforward. Skip introspection if attr name differs.
|
||||
if hasattr(p, "_dim"):
|
||||
assert p._dim == 512
|
||||
Reference in New Issue
Block a user