Skip to content

Search

This example assumes using GroundX; is in scope and apiKey contains your GroundX API key.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
using var client = new GroundXClient(apiKey);

var bucketId =
    Environment.GetEnvironmentVariable("GROUNDX_BUCKET_ID") is { Length: > 0 } bucketIdValue
        ? int.Parse(bucketIdValue)
        : throw new AssertInconclusiveException("GROUNDX_BUCKET_ID environment variable is not found.");

// Search for relevant content in a bucket:
var response = await client.Search.SearchContentAsync(
    id: bucketId,
    query: "What is RAG?",
    n: 5);