honcho/src
Eugene Eisenstein b1594089aa
feat(mock-provider): deterministic OpenAI-compatible endpoint for local and CI use
Adds src/mock_provider/, a standalone ASGI app that lets Honcho run with no
model provider, no API key, and no spend. It answers /v1/chat/completions and
/v1/embeddings with obviously-synthetic content derived from the request, so
the same request always produces the same response.

It runs as its own service from the standard Honcho image with a different
entrypoint, the way api and deriver already differ, so there is no second image
to build or keep in digest-sync. The app imports nothing from src.config or
src.db, so it boots even when the rest of the stack is misconfigured.

The chat endpoint generates from the JSON Schema it is sent rather than
answering with prose. That matters because a prose answer does not fail loudly:
repair_response_model_json swallows the parse error and returns an empty
PromptRepresentation, which reads as "the deriver found nothing" rather than
"the mock is wrong". Generation resolves $ref/$defs indirection, caps recursion
for reasoning-tree schemas, and covers json_object mode by recovering the
schema Honcho injects into the prompt. Embeddings are hash-derived, so
identical input yields an identical vector.

Tests drive the production OpenAIBackend and _EmbeddingClient against the app
over ASGI, including the strict json_schema transform that
chat.completions.parse() applies. Verified end to end against a real stack:
messages in, conclusions and 1536-dim embeddings written to pgvector, with no
calls to any real provider.

Mock embeddings carry no semantic similarity, so recall against this provider
must use lexical search. CONTRIBUTING notes that, and the load_dotenv(override=
True) behaviour that lets a stale repo .env win over exported environment
variables.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-03 11:17:44 -04:00
..
cache perf(cache): hash-tag the cache namespace so an instance uses one shard (#1058) 2026-08-25 12:34:42 -04:00
crud feat(api): Export deriver backlog as metrics from API endpoint (#1115) 2026-09-02 13:42:48 -04:00
deriver feat(api): Export deriver backlog as metrics from API endpoint (#1115) 2026-09-02 13:42:48 -04:00
dialectic fix(dialectic): make workspace chat search before it answers (#1120) 2026-09-02 17:27:01 -04:00
dreamer feat(api): Export deriver backlog as metrics from API endpoint (#1115) 2026-09-02 13:42:48 -04:00
llm fix(openai): fix content normalization in openai backend history adapter (#1064) 2026-08-26 12:14:32 -04:00
mock_provider feat(mock-provider): deterministic OpenAI-compatible endpoint for local and CI use 2026-09-03 11:17:44 -04:00
reconciler feat(api): Export deriver backlog as metrics from API endpoint (#1115) 2026-09-02 13:42:48 -04:00
routers feat(api): Export deriver backlog as metrics from API endpoint (#1115) 2026-09-02 13:42:48 -04:00
schemas feat(api): Export deriver backlog as metrics from API endpoint (#1115) 2026-09-02 13:42:48 -04:00
startup Make embeddings configurable (#678) 2026-05-14 15:03:35 -04:00
telemetry feat(api): Export deriver backlog as metrics from API endpoint (#1115) 2026-09-02 13:42:48 -04:00
utils fix(deriver): fix create_documents deadlock (#1033) 2026-09-02 11:07:50 -04:00
vector_store fix: stop top_k=0 from reaching Turbopuffer on message search (#1084) 2026-08-26 17:07:41 -04:00
webhooks Tighten Transaction Scopes (#525) 2026-04-08 11:14:50 -04:00
__init__.py v0.0.8 Documentation Updates (#55) 2024-05-15 00:07:25 -04:00
_version.py feat: add new cloudevents for api routes (#637) 2026-05-20 18:25:30 -04:00
backlog.py feat(api): Export deriver backlog as metrics from API endpoint (#1115) 2026-09-02 13:42:48 -04:00
config.py feat(api): Export deriver backlog as metrics from API endpoint (#1115) 2026-09-02 13:42:48 -04:00
db.py review: fix db_connections_open leak on the detach path; comment/doc polish 2026-08-24 14:37:20 -04:00
dependencies.py add read db (#773) 2026-06-10 13:28:36 -04:00
embedding_client.py fix: only classify genuine oversize input as a token-limit error (#791) 2026-08-25 09:45:01 -04:00
exceptions.py fix(embedding): truncate in batch embed and return results breakdown (#1019) 2026-08-20 11:42:38 -04:00
main.py feat(api): Export deriver backlog as metrics from API endpoint (#1115) 2026-09-02 13:42:48 -04:00
models.py Make embeddings configurable (#678) 2026-05-14 15:03:35 -04:00
security.py Fix scoped JWTs (#679) 2026-06-22 17:30:00 -04:00