@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.cjs CHANGED
@@ -1531,13 +1531,13 @@ const addRowEmbeddings = (socket, add, remove) => (entities) => {
1531
1531
  const act = "Embeddings " + text.substring(0, 20);
1532
1532
  add(act);
1533
1533
  return socket
1534
- .embeddings(text)
1534
+ .embeddings([text])
1535
1535
  .then((x) => {
1536
- if (x && x.length > 0) {
1536
+ if (x && x.length > 0 && x[0].length > 0) {
1537
1537
  remove(act);
1538
1538
  return {
1539
1539
  ...ent,
1540
- embeddings: x[0],
1540
+ embeddings: x[0][0],
1541
1541
  };
1542
1542
  }
1543
1543
  else {
@@ -1575,7 +1575,8 @@ const vectorSearch = (socket, flowId, addActivity, removeActivity, term, collect
1575
1575
  const searchAct = "Search: " + term;
1576
1576
  addActivity(searchAct);
1577
1577
  return api
1578
- .embeddings(term)
1578
+ .embeddings([term])
1579
+ .then((vecs) => vecs[0])
1579
1580
  .then(getGraphEmbeddings(api, addActivity, removeActivity, limit || 10, collection))
1580
1581
  .then(addRowLabels(api, addActivity, removeActivity, collection))
1581
1582
  .then(addRowDefinitions(api, addActivity, removeActivity, collection))
@@ -1756,7 +1757,8 @@ const useInference = ({ flow } = {}) => {
1756
1757
  })
1757
1758
  : await socket.flow(effectiveFlow).graphRag(input, options || {}, collection);
1758
1759
  // Get embeddings for entity discovery
1759
- const embeddings = await socket.flow(effectiveFlow).embeddings(input);
1760
+ const allEmbeddings = await socket.flow(effectiveFlow).embeddings([input]);
1761
+ const embeddings = allEmbeddings[0];
1760
1762
  // Query graph embeddings to find entities
1761
1763
  const entities = await socket
1762
1764
  .flow(effectiveFlow)
@@ -2314,7 +2316,7 @@ const useEmbeddings = ({ flow, term }) => {
2314
2316
  queryFn: () => {
2315
2317
  return socket
2316
2318
  .flow(effectiveFlow)
2317
- .embeddings(term)
2319
+ .embeddings([term])
2318
2320
  .then((x) => {
2319
2321
  if (x["error"]) {
2320
2322
  console.log("Error:", x);