@trustgraph/react-state 1.4.6 → 1.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.esm.js CHANGED
@@ -1530,13 +1530,13 @@ const addRowEmbeddings = (socket, add, remove) => (entities) => {
1530
1530
  const act = "Embeddings " + text.substring(0, 20);
1531
1531
  add(act);
1532
1532
  return socket
1533
- .embeddings(text)
1533
+ .embeddings([text])
1534
1534
  .then((x) => {
1535
- if (x && x.length > 0) {
1535
+ if (x && x.length > 0 && x[0].length > 0) {
1536
1536
  remove(act);
1537
1537
  return {
1538
1538
  ...ent,
1539
- embeddings: x[0],
1539
+ embeddings: x[0][0],
1540
1540
  };
1541
1541
  }
1542
1542
  else {
@@ -1574,7 +1574,8 @@ const vectorSearch = (socket, flowId, addActivity, removeActivity, term, collect
1574
1574
  const searchAct = "Search: " + term;
1575
1575
  addActivity(searchAct);
1576
1576
  return api
1577
- .embeddings(term)
1577
+ .embeddings([term])
1578
+ .then((vecs) => vecs[0])
1578
1579
  .then(getGraphEmbeddings(api, addActivity, removeActivity, limit || 10, collection))
1579
1580
  .then(addRowLabels(api, addActivity, removeActivity, collection))
1580
1581
  .then(addRowDefinitions(api, addActivity, removeActivity, collection))
@@ -1755,7 +1756,8 @@ const useInference = ({ flow } = {}) => {
1755
1756
  })
1756
1757
  : await socket.flow(effectiveFlow).graphRag(input, options || {}, collection);
1757
1758
  // Get embeddings for entity discovery
1758
- const embeddings = await socket.flow(effectiveFlow).embeddings(input);
1759
+ const allEmbeddings = await socket.flow(effectiveFlow).embeddings([input]);
1760
+ const embeddings = allEmbeddings[0];
1759
1761
  // Query graph embeddings to find entities
1760
1762
  const entities = await socket
1761
1763
  .flow(effectiveFlow)
@@ -2313,7 +2315,7 @@ const useEmbeddings = ({ flow, term }) => {
2313
2315
  queryFn: () => {
2314
2316
  return socket
2315
2317
  .flow(effectiveFlow)
2316
- .embeddings(term)
2318
+ .embeddings([term])
2317
2319
  .then((x) => {
2318
2320
  if (x["error"]) {
2319
2321
  console.log("Error:", x);