Discovery (Search)

Overview

Discovery (Search) provides functionality to perform search operations within the assistant context, based on specific configuration. It enables config-based search operations and chunk retrieval for comprehensive document discovery and content retrieval.

Discovery operations are managed via the Assistant API at [http|https]://[hostname]:[port]/v1.0/tenants/[tenant-guid]/assistant/search and [http|https]://[hostname]:[port]/v1.0/tenants/[tenant-guid]/assistant/chunks and support comprehensive search functionality including configuration-based searches and chunk retrieval by GUIDs.

API Endpoints

Discovery operations are managed via the Assistant server API at:

  • Search: [http|https]://[hostname]:[port]/v1.0/tenants/[tenant-guid]/assistant/search/[config-guid]
  • Chunks: [http|https]://[hostname]:[port]/v1.0/tenants/[tenant-guid]/assistant/chunks/[config-guid]

Supported HTTP Methods: POST

Important: All discovery operations require appropriate authentication tokens.

Perform Config Search

Performs a config-based search operation using POST /v1.0/tenants/[tenant-guid]/assistant/search/[config-guid].

Request Parameters

  • config-guid (string, Path, Required): GUID of the assistant configuration to perform the search under

Request Body

{
  "Query": "search query text",
  "MaxResults": 10
}
curl --location --request POST 'http://localhost:8000/v1.0/tenants/00000000-0000-0000-0000-000000000000/assistant/search/22222222-2222-2222-2222-222222222222' \
--header 'content-type: application/json' \
--header 'Authorization: ••••••' \
--data '{
    "Query": "search query text",
    "MaxResults": 10
}'
import { ViewAssistantSdk } from "view-sdk";

const api = new ViewAssistantSdk(
  "http://localhost:8000/", //endpoint
  "00000000-0000-0000-0000-000000000000", //tenant Id
  "default" //access key
);

const configSearch = async () => {
  try {
    const response = await api.Discovery.configSearch(
      "22222222-2222-2222-2222-222222222222", // configGuid
      {
        Query: "search query text",
        MaxResults: 10
      }
    );
    console.log(response, "Config search completed successfully");
  } catch (err) {
    console.log("Error performing config search:", err);
  }
};

configSearch();
import view_sdk
from view_sdk import assistant
from view_sdk.sdk_configuration import Service

sdk = view_sdk.configure(
    access_key="default",
    base_url="localhost",
    tenant_guid="00000000-0000-0000-0000-000000000000",
    service_ports={Service.DEFAULT: 8000},
)

def configSearch():
    response = assistant.Discovery.config_search(
        config_guid="22222222-2222-2222-2222-222222222222",
        search_request={
            "Query": "search query text",
            "MaxResults": 10
        }
    )
    print("Config Search Response:")
    print(response)

configSearch()
using View.Sdk;
using View.Sdk.Assistant;

ViewAssistantSdk sdk = new ViewAssistantSdk(Guid.Parse("00000000-0000-0000-0000-000000000000"), 
                                            "default", 
                                            "http://localhost:8000/");

var response = await sdk.Discovery.ConfigSearch(
    "22222222-2222-2222-2222-222222222222",
    new {
        Query = "search query text",
        MaxResults = 10
    }
);

Read Chunk by GUIDs

Reads chunks using the specified configuration GUID using POST /v1.0/tenants/[tenant-guid]/assistant/chunks/[config-guid].

Request Parameters

  • config-guid (string, Path, Required): GUID of the assistant configuration to use for the chunk read operation

Request Body

{
  "ChunkGUIDs": [
    "chunk-guid-1",
    "chunk-guid-2"
  ]
}
curl --location --request POST 'http://localhost:8000/v1.0/tenants/00000000-0000-0000-0000-000000000000/assistant/chunks/22222222-2222-2222-2222-222222222222' \
--header 'content-type: application/json' \
--header 'Authorization: ••••••' \
--data '{
    "ChunkGUIDs": [
        "chunk-guid-1",
        "chunk-guid-2"
    ]
}'
import { ViewAssistantSdk } from "view-sdk";

const api = new ViewAssistantSdk(
  "http://localhost:8000/", //endpoint
  "00000000-0000-0000-0000-000000000000", //tenant Id
  "default" //access key
);

const readChunkByGUIDs = async () => {
  try {
    const response = await api.Discovery.readChunkByGUIDs(
      "22222222-2222-2222-2222-222222222222", // configGuid
      {
        ChunkGUIDs: [
          "chunk-guid-1",
          "chunk-guid-2"
        ]
      }
    );
    console.log(response, "Chunks read successfully");
  } catch (err) {
    console.log("Error reading chunks:", err);
  }
};

readChunkByGUIDs();
import view_sdk
from view_sdk import assistant
from view_sdk.sdk_configuration import Service

sdk = view_sdk.configure(
    access_key="default",
    base_url="localhost",
    tenant_guid="00000000-0000-0000-0000-000000000000",
    service_ports={Service.DEFAULT: 8000},
)

def readChunkByGUIDs():
    response = assistant.Discovery.read_chunk_by_guids(
        config_guid="22222222-2222-2222-2222-222222222222",
        request={
            "ChunkGUIDs": [
                "chunk-guid-1",
                "chunk-guid-2"
            ]
        }
    )
    print("Chunk Read Response:")
    print(response)

readChunkByGUIDs()
using View.Sdk;
using View.Sdk.Assistant;

ViewAssistantSdk sdk = new ViewAssistantSdk(Guid.Parse("00000000-0000-0000-0000-000000000000"), 
                                            "default", 
                                            "http://localhost:8000/");

var response = await sdk.Discovery.ReadChunkByGUIDs(
    "22222222-2222-2222-2222-222222222222",
    new {
        ChunkGUIDs = new[] { "chunk-guid-1", "chunk-guid-2" }
    }
);