REST ClientDatasphere

search

View as MarkdownOpen in Claude

Perform a semantic search across all documents in the Datasphere.

Request

query_stringstringRequired
Search term.
tagslist of stringsOptional
Document tags.
document_idstringOptionalformat: "uuid"
Unique ID of a Document.
distancedoubleOptional0-78.3836717690617
Specifies how closely related the query is to the document. Low distance means high relevance and similarity. High distance means low relevance and similarity.
countintegerOptional>=1Defaults to 5
Specifies number of returned Chunks.
languagestringOptionalDefaults to en
Language of the Document.
pos_to_expandlist of stringsOptional
Part of Speech considered for expansion or analysis.
max_synonymsintegerOptional>=1Defaults to 10
Maximum number of synonyms to consider.

Response

chunkslist of objectsRequired
A list of search result chunks.

Response Example

Response
1{
2 "chunks": [
3 {
4 "text": "Cristiano Ronaldo is the highest-paid football player in the world in 2024",
5 "document_id": "acaa5c49-be5e-4477-bce0-48f4b23b7720"
6 }
7 ]
8}

Example

1from signalwire.rest import RestClient
2
3client = RestClient(
4 project="your-project-id",
5 token="your-api-token",
6 host="your-space.signalwire.com",
7)
8
9results = client.datasphere.documents.search(
10 query_string="How do I reset my password?",
11 count=5,
12)
13for chunk in results.get("chunks", []):
14 print(chunk.get("text"), "score:", chunk.get("score"))