Semantic Listener

This endpoint allows subscribers to listen for data that matches specific criteria defined semantically (using natural language queries) across various indexes. It supports complex queries, including filtering and sorting, to fine-tune the data stream received.

Listening to Index Updates

The Index Client SDK allows you to listen for updates to multiple indexes in real-time. This is useful for applications that need to react to new data events, using natural language.

Here is an example of how you can use the listenToIndexUpdates method to handle real-time updates in a conversation:

const sources = ["did:pkh:eip155:1:0x1b9Aceb609a62bae0c0a9682A9268138Faff4F5f"];

const query = "if it is relevant to decentralized AI";

const handleMessage = (data: any) => {
  console.log("New event received:", data);
  // Handle the new message data
};

const handleError = (error: any) => {
  console.error("Error receiving updates:", error);
  // Handle the error
};

const stopListening = indexClient.listenToIndexUpdates(
  sources,
  query
  handleMessage,
  handleError,
);

Endpoints

This section provides details about the available API endpoints.

Last updated