Embeddings
TODO:
/api/embeddings/definitions
Returns a list of EmbeddingDefintions. An EmbeddingDefinition combines a specific embedding model and a reference to a Chunker.
| Parameter | Description |
|---|---|
|
Optional. The number of the requested page. |
|
Optional. The number of objects of the requested page. |
$ curl 'http://localhost:8080/api/embeddings/definitions?size=1' -i -X GET
HTTP/1.1 200 OK
X-Rate-Limit-Remaining: 49
Content-Type: application/json
Content-Length: 628
{
"responseHeader" : {
"httpStatus" : null,
"msg" : "",
"query" : "http://localhost:8080/api/embeddings/definitions?size=1",
"state" : "OK"
},
"content" : [ {
"machineName" : "default",
"modelName" : "sentence-transformers/paraphrase-MiniLM-L12-v2",
"dimensions" : 384,
"chunkerMachineName" : "default"
}, {
"machineName" : "tests",
"modelName" : "sentence-transformers/paraphrase-MiniLM-L12-v2",
"dimensions" : 384,
"chunkerMachineName" : "default"
} ],
"page" : {
"size" : 2,
"number" : 0,
"totalElements" : 2,
"totalPages" : 1
},
"links" : { }
}
/api/embeddings/status
Returns a list with status information of the computation and indexing of embeddings of Snapshots. Returns only information of Snapshots the current user has access to.
| Parameter | Description |
|---|---|
|
The machineName of a the EmbeddingDef. Defaults to 'default' |
|
Optional. The machineName of a Panel. Return only Snapshots which embeddings have been started/finalized computing. Either 'panel' or 'snapshot' can be specified. |
|
Optional. The machineName of a Snapshot. Either 'panel' or 'snapshot' can be specified. |
$ curl 'http://localhost:8080/api/embeddings/status' -i -X GET
HTTP/1.1 200 OK
X-Rate-Limit-Remaining: 49
Content-Type: application/json
Content-Length: 434
{
"responseHeader" : {
"httpStatus" : null,
"msg" : "",
"query" : "http://localhost:8080/api/embeddings/status",
"state" : "OK"
},
"content" : [ {
"snapshot" : "20121227_intermediaries",
"embeddingDef" : "default",
"computationStatus" : "STARTED",
"indexStatus" : "STARTED"
} ],
"page" : {
"size" : 1,
"number" : 0,
"totalElements" : 1,
"totalPages" : 1
},
"links" : { }
}
/api/embeddings/search
Creates a list of "nearby" chunks of documents based on the used embedding sorted ascending on the distance. As distance the cosinus similarity is used.
| Parameter | Description |
|---|---|
|
Optional. The EmbeddingIndex to use. Defaults to 'MilvusDiskANNEmbeddingsIndex'. Legacy 'MariaDBEmbeddingsIndex' is online but currently not maintained. |
|
The snapshot |
|
The selection. (currently not used) |
|
A Domain on which the search should be restricted. Can be specified multiple times. |
|
The machineName of the EmbeddingsDef |
|
The text for comparing with embeddings |
|
The maximum distance of text chunks. Defaults to 0.5 |
|
The limit of matching Chunks to return. If active disables paging. Defaults to 1000 |
|
CURRENTLY IGNORED and fixed to 15. Only consider Chunks with more than minTokensCount. Defaults to 15 |
|
MITIGATES a bug in MariaDB with inconsistent results |
$ curl 'http://localhost:8080/api/embeddings/search?snapshot=20121227_intermediaries&embeddingsDef=default&query=Nachhaltigkeit&limit=2' -i -X GET
HTTP/1.1 200 OK
X-Rate-Limit-Remaining: 48
Content-Type: application/json
Content-Length: 1437
{
"responseHeader" : {
"httpStatus" : null,
"msg" : "",
"query" : "http://localhost:8080/api/embeddings/search?snapshot=20121227_intermediaries&embeddingsDef=default&query=Nachhaltigkeit&limit=2",
"state" : "OK"
},
"content" : [ {
"domain" : "www.dfg.de",
"reference" : "/dfg_magazin/wissenschaft_oeffentlichkeit/dfg_wissenschaftsjahre/2012_nachhaltigkeit/index.jsp",
"textChunk" : "Das \"Wissenschaftsjahr 2012 – Zukunftsprojekt Erde\" beschäftigt sich mit Forschung für nachhaltige Entwicklung. Alle Aspekte der Nachhaltigkeit werden angesprochen: Im Fokus stehen Möglichkeiten und Realisierbarkeit wirtschaftlichen, ökologischen und sozial nachhaltigen Handelns.",
"embedding" : [ ],
"similarity" : 0.6509945,
"dist" : 0.34900552
}, {
"domain" : "www.dfg.de",
"reference" : "/service/presse/das_neueste/index.html",
"textChunk" : "(30.05.12) Am 30. Mai startet die MS Wissenschaft ihre Tour 2012. An Bord präsentieren auch von der DFG unterstützte Projekte ihre Forschung für nachhaltige Entwicklungen. Zum Start des Schiffes erscheint auch „Das blaue ABC. Forschung – Wissen – Nachhaltigkeit“, das DFG-geförderte Forschung zur Nachhaltigkeit vorstellt.",
"embedding" : [ ],
"similarity" : 0.52392614,
"dist" : 0.47607386
} ],
"page" : {
"size" : 2,
"number" : 0,
"totalElements" : 2,
"totalPages" : 1
},
"links" : { }
}
/api/embeddings/searchForStream
Content-Type: application/x-ndjson
Creates a list of "nearby" chunks of documents based on the used embedding sorted ascending on the distance. As distance the cosinus similarity is used.
| Parameter | Description |
|---|---|
|
The snapshot |
|
The selection. (currently not used) |
|
A Domain on which the search should be restricted. Can be specified multiple times. |
|
The machineName of the EmbeddingsDef |
|
The text for comparing with embeddings |
|
The maximum distance of text chunks. Defaults to 0.5 |
|
The limit of matching Chunks to return. If active disables paging. Defaults to 1000 |
|
CURRENTY IGNORED and fixed to 15. Only consider Chunks with more than minTokensCount. Defaults to 15 |
|
MITIGATES a bug in MariaDB with inconsistent results |
$ curl 'http://localhost:8080/api/embeddings/searchForStream?snapshot=20121227_intermediaries&embeddingsDef=default&query=Nachhaltigkeit&limit=2' -i -X GET
HTTP/1.1 200 OK
X-Rate-Limit-Remaining: 49
Content-Type: application/x-ndjson
Content-Length: 1039
{
"domain" : "www.dfg.de",
"reference" : "/dfg_magazin/wissenschaft_oeffentlichkeit/dfg_wissenschaftsjahre/2012_nachhaltigkeit/index.jsp",
"textChunk" : "Das \"Wissenschaftsjahr 2012 – Zukunftsprojekt Erde\" beschäftigt sich mit Forschung für nachhaltige Entwicklung. Alle Aspekte der Nachhaltigkeit werden angesprochen: Im Fokus stehen Möglichkeiten und Realisierbarkeit wirtschaftlichen, ökologischen und sozial nachhaltigen Handelns.",
"embedding" : [ ],
"similarity" : 0.6509945,
"dist" : 0.34900552
}
{
"domain" : "www.dfg.de",
"reference" : "/service/presse/das_neueste/index.html",
"textChunk" : "(30.05.12) Am 30. Mai startet die MS Wissenschaft ihre Tour 2012. An Bord präsentieren auch von der DFG unterstützte Projekte ihre Forschung für nachhaltige Entwicklungen. Zum Start des Schiffes erscheint auch „Das blaue ABC. Forschung – Wissen – Nachhaltigkeit“, das DFG-geförderte Forschung zur Nachhaltigkeit vorstellt.",
"embedding" : [ ],
"similarity" : 0.52392614,
"dist" : 0.47607386
}