Skip to content

feat(client): typed relationship extraction + model-aware semantic cache#20

Merged
Patel230 merged 5 commits into
mainfrom
feat/cocoindex-adoption
Jun 8, 2026
Merged

feat(client): typed relationship extraction + model-aware semantic cache#20
Patel230 merged 5 commits into
mainfrom
feat/cocoindex-adoption

Conversation

@Patel230

@Patel230 Patel230 commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Changes

  • ExtractRelationships (client/extract.go, new): typed S-P-O triple extractor over ChatWithStructuredOutput, modeled on cocoindex ExtractByLlm(output_type=list[Relationship]). Noun-constrained entities + optional predicate allowlist.
  • Semantic cache (client/embedding_cache.go): tag entries with their embedding model and skip cross-model entries before cosine — a model swap can no longer serve a response from an incomparable embedding space.

Tests

extract_test.go + TestEmbeddingCache_ModelIsolation; full client suite passes; gofumpt v0.7.0 clean.

🤖 Generated with Claude Code

Patel230 and others added 5 commits June 8, 2026 14:46
ExtractRelationships (client/extract.go): typed subject-predicate-object
triple extractor over ChatWithStructuredOutput, modeled on cocoindex's
ExtractByLlm(output_type=list[Relationship]). Noun-constrained entities with
an optional predicate allowlist; knowledge-graph consumers can call it
instead of hand-rolling extraction prompts and JSON parsing.

Semantic embedding cache (client/embedding_cache.go): tag each cache entry
with the embedding model that produced its vector and skip cross-model
entries in lookup() before computing cosine similarity. Previously a model
swap could serve a response cached under a different (incomparable)
embedding space.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The tok v0.1.0 tag was moved to its current main HEAD, changing the
module hash. Refresh the recorded go.sum hashes so module verification
and the CI tidy check pass. No code change; tok's public API is unchanged.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The tok v0.1.0 tag was moved; the public module proxy can cache the old
zip for that immutable version, causing checksum mismatches against the
refreshed go.sum. Fetching GrayCodeAI modules directly from VCS keeps CI
consistent with the committed hashes.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
GOPROXY=direct forced the entire module graph (incl. golangci-lint and its
deps) off the public proxy, breaking 'go install golangci-lint'. GOPRIVATE
already fetches GrayCodeAI modules directly from VCS, and the public proxy
has since refreshed tok@v0.1.0 to the moved-tag content, so both paths now
yield the go.sum hash. Reverting the over-broad proxy override.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
eyrie resolves tok via 'go.work replace => ../tok' (CI clones tok locally),
so the tok@v0.1.0 hash in go.sum is not exercised — the original hash was
correct and hygiene passed with it. The earlier hand-edit to the moved-tag
hash made 'go mod tidy' report go.sum out of date. Restoring the original.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@Patel230 Patel230 force-pushed the feat/cocoindex-adoption branch from 0c80e3c to 9feb00f Compare June 8, 2026 09:17
@Patel230 Patel230 merged commit b702dea into main Jun 8, 2026
15 checks passed
@Patel230 Patel230 deleted the feat/cocoindex-adoption branch June 8, 2026 09:35
Patel230 added a commit that referenced this pull request Jun 8, 2026
…che (#20)

* feat(client): typed relationship extraction + model-aware semantic cache

ExtractRelationships (client/extract.go): typed subject-predicate-object
triple extractor over ChatWithStructuredOutput, modeled on cocoindex's
ExtractByLlm(output_type=list[Relationship]). Noun-constrained entities with
an optional predicate allowlist; knowledge-graph consumers can call it
instead of hand-rolling extraction prompts and JSON parsing.

Semantic embedding cache (client/embedding_cache.go): tag each cache entry
with the embedding model that produced its vector and skip cross-model
entries in lookup() before computing cosine similarity. Previously a model
swap could serve a response cached under a different (incomparable)
embedding space.


* fix(deps): update tok@v0.1.0 checksum in go.sum

The tok v0.1.0 tag was moved to its current main HEAD, changing the
module hash. Refresh the recorded go.sum hashes so module verification
and the CI tidy check pass. No code change; tok's public API is unchanged.


* ci: set GOPROXY=direct to bypass stale-proxy go.sum mismatch

The tok v0.1.0 tag was moved; the public module proxy can cache the old
zip for that immutable version, causing checksum mismatches against the
refreshed go.sum. Fetching GrayCodeAI modules directly from VCS keeps CI
consistent with the committed hashes.


* ci: drop GOPROXY=direct; GOPRIVATE already routes GrayCodeAI direct

GOPROXY=direct forced the entire module graph (incl. golangci-lint and its
deps) off the public proxy, breaking 'go install golangci-lint'. GOPRIVATE
already fetches GrayCodeAI modules directly from VCS, and the public proxy
has since refreshed tok@v0.1.0 to the moved-tag content, so both paths now
yield the go.sum hash. Reverting the over-broad proxy override.


* Revert unnecessary go.sum tok hash edit

eyrie resolves tok via 'go.work replace => ../tok' (CI clones tok locally),
so the tok@v0.1.0 hash in go.sum is not exercised — the original hash was
correct and hygiene passed with it. The earlier hand-edit to the moved-tag
hash made 'go mod tidy' report go.sum out of date. Restoring the original.


---------
Patel230 added a commit that referenced this pull request Jun 8, 2026
…che (#20)

* feat(client): typed relationship extraction + model-aware semantic cache

ExtractRelationships (client/extract.go): typed subject-predicate-object
triple extractor over ChatWithStructuredOutput, modeled on cocoindex's
ExtractByLlm(output_type=list[Relationship]). Noun-constrained entities with
an optional predicate allowlist; knowledge-graph consumers can call it
instead of hand-rolling extraction prompts and JSON parsing.

Semantic embedding cache (client/embedding_cache.go): tag each cache entry
with the embedding model that produced its vector and skip cross-model
entries in lookup() before computing cosine similarity. Previously a model
swap could serve a response cached under a different (incomparable)
embedding space.

* fix(deps): update tok@v0.1.0 checksum in go.sum

The tok v0.1.0 tag was moved to its current main HEAD, changing the
module hash. Refresh the recorded go.sum hashes so module verification
and the CI tidy check pass. No code change; tok's public API is unchanged.

* ci: set GOPROXY=direct to bypass stale-proxy go.sum mismatch

The tok v0.1.0 tag was moved; the public module proxy can cache the old
zip for that immutable version, causing checksum mismatches against the
refreshed go.sum. Fetching GrayCodeAI modules directly from VCS keeps CI
consistent with the committed hashes.

* ci: drop GOPROXY=direct; GOPRIVATE already routes GrayCodeAI direct

GOPROXY=direct forced the entire module graph (incl. golangci-lint and its
deps) off the public proxy, breaking 'go install golangci-lint'. GOPRIVATE
already fetches GrayCodeAI modules directly from VCS, and the public proxy
has since refreshed tok@v0.1.0 to the moved-tag content, so both paths now
yield the go.sum hash. Reverting the over-broad proxy override.

* Revert unnecessary go.sum tok hash edit

eyrie resolves tok via 'go.work replace => ../tok' (CI clones tok locally),
so the tok@v0.1.0 hash in go.sum is not exercised — the original hash was
correct and hygiene passed with it. The earlier hand-edit to the moved-tag
hash made 'go mod tidy' report go.sum out of date. Restoring the original.

---------
Patel230 added a commit that referenced this pull request Jun 8, 2026
…che (#20)

* feat(client): typed relationship extraction + model-aware semantic cache

ExtractRelationships (client/extract.go): typed subject-predicate-object
triple extractor over ChatWithStructuredOutput, modeled on cocoindex's
ExtractByLlm(output_type=list[Relationship]). Noun-constrained entities with
an optional predicate allowlist; knowledge-graph consumers can call it
instead of hand-rolling extraction prompts and JSON parsing.

Semantic embedding cache (client/embedding_cache.go): tag each cache entry
with the embedding model that produced its vector and skip cross-model
entries in lookup() before computing cosine similarity. Previously a model
swap could serve a response cached under a different (incomparable)
embedding space.

* fix(deps): update tok@v0.1.0 checksum in go.sum

The tok v0.1.0 tag was moved to its current main HEAD, changing the
module hash. Refresh the recorded go.sum hashes so module verification
and the CI tidy check pass. No code change; tok's public API is unchanged.

* ci: set GOPROXY=direct to bypass stale-proxy go.sum mismatch

The tok v0.1.0 tag was moved; the public module proxy can cache the old
zip for that immutable version, causing checksum mismatches against the
refreshed go.sum. Fetching GrayCodeAI modules directly from VCS keeps CI
consistent with the committed hashes.

* ci: drop GOPROXY=direct; GOPRIVATE already routes GrayCodeAI direct

GOPROXY=direct forced the entire module graph (incl. golangci-lint and its
deps) off the public proxy, breaking 'go install golangci-lint'. GOPRIVATE
already fetches GrayCodeAI modules directly from VCS, and the public proxy
has since refreshed tok@v0.1.0 to the moved-tag content, so both paths now
yield the go.sum hash. Reverting the over-broad proxy override.

* Revert unnecessary go.sum tok hash edit

eyrie resolves tok via 'go.work replace => ../tok' (CI clones tok locally),
so the tok@v0.1.0 hash in go.sum is not exercised — the original hash was
correct and hygiene passed with it. The earlier hand-edit to the moved-tag
hash made 'go mod tidy' report go.sum out of date. Restoring the original.

---------
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