Skip to content

Add embed() for nomic-embed-text - #41

Merged
xquantize merged 2 commits into
developfrom
agent/stage-3-embed
Oct 28, 2026
Merged

xquantize merged 2 commits into
developfrom
agent/stage-3-embed

Conversation

@xquantize

Copy link
Copy Markdown
Owner

XQU-19: Slice 3 embed() via OpenAI-compatible client, with batch count validation.

Acceptance criteria:

  • tests/test_llm.py mocks the OpenAI client. Covers: empty input returns [] and does not call create; prefixes for both kinds (search_document: / search_query: ); batching across 2+ create calls; output order matches input even if indexes are shuffled; dimension mismatch raises ValueError; existing chat tests still pass
  • embed(["first", "second"], "document") raises ValueError matching 1 != expected 2 when create returns one item
  • A matching count still returns the vectors in index order
  • After sorting by index, embed() raises if len(items) != len(batch) before appending; message style matches the dimension check (embedding count {n} != expected {m})
  • No test does I/O, network or real LLM/embedding calls
  • config / .env.example still only the three embedding settings; Slice 3 box ticked only
  • bash scripts/check.sh prints CHECK PASSED
  • Only these files changed vs develop: src/swellsense/llm/embeddings.py, src/swellsense/llm/init.py, src/swellsense/config.py, tests/test_llm.py, .env.example, docs/plans/stage-3.md
  • The new commit 24584f1 touches only embeddings.py and tests/test_llm.py

Review: all checks passed. check.sh: CHECK PASSED locally.

Made with Cursor

xquantize and others added 2 commits October 28, 2026 16:01
Task prefixes, batching, and dimension checks keep later process slices
from hitting the network with wrong vectors or Ollama-incompatible params.

Co-authored-by: Cursor <cursoragent@cursor.com>
Partial API responses previously dropped texts silently; match the
dimension check with an explicit count validation per batch.

Co-authored-by: Cursor <cursoragent@cursor.com>
@xquantize
xquantize merged commit 434ed64 into develop Oct 28, 2026
1 check passed
@xquantize
xquantize deleted the agent/stage-3-embed branch October 28, 2026 03:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant