Commit d7f20d7
committed
BE-622: Move semantic search embedding generation into the graph
Add a hash-graph-embeddings crate exposing a provider-agnostic EmbeddingGenerator trait and an OpenAI-backed client (reqwest + reqwest-retry). The graph now resolves a search request's semanticString to an embedding itself, configured via HASH_GRAPH_OPENAI_API_KEY and wired in like the Temporal client, removing the Temporal roundtrip from the Node SDK search path.
The /entities/search and /entity-types/search endpoints accept embedding xor semanticString; the Node SDK searchEntities/searchEntityTypes forward semanticString directly and no longer take a temporalClient. Provider failures are classified (auth/rate-limit/outage) and mapped to appropriate HTTP statuses rather than a blanket 500, a caller-supplied embedding is validated against Embedding::DIM, and startup logs whether semantic search is enabled.
Regenerate the OpenAPI spec, document the sync:turborepo task in AGENTS.md, and wire HASH_GRAPH_OPENAI_API_KEY into the compose graph service.1 parent a162311 commit d7f20d7
27 files changed
Lines changed: 1339 additions & 135 deletions
File tree
- apps/hash-graph
- src/subcommand
- infra/compose
- libs/@local/graph
- api
- openapi
- src/rest
- embeddings
- docs
- src
- sdk/typescript/src
- types/src
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
7 | 7 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
84 | 94 | | |
85 | 95 | | |
86 | 96 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
16 | 17 | | |
17 | 18 | | |
18 | 19 | | |
| |||
75 | 76 | | |
76 | 77 | | |
77 | 78 | | |
| 79 | + | |
78 | 80 | | |
79 | 81 | | |
80 | 82 | | |
| |||
228 | 230 | | |
229 | 231 | | |
230 | 232 | | |
| 233 | + | |
231 | 234 | | |
232 | 235 | | |
233 | 236 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| 30 | + | |
30 | 31 | | |
31 | 32 | | |
32 | 33 | | |
| |||
0 commit comments