POST
/
v1
/
knowledge
curl --request POST \
  --url https://api.valyu.network/v1/knowledge \
  --header 'Content-Type: application/json' \
  --header 'x-api-key: <api-key>' \
  --data '{
  "query": "<string>",
  "search_type": "proprietary",
  "data_sources": [
    "valyu/valyu-arxiv",
    "valyu/valyu-wikipedia",
    "https://www.valyu.network/"
  ],
  "max_num_results": 10,
  "similarity_threshold": 0.4,
  "query_rewrite": true,
  "max_price": 123
}'
{
  "success": true,
  "error": "<string>",
  "tx_id": "<string>",
  "query": "<string>",
  "results": [
    {
      "title": "<string>",
      "url": "<string>",
      "content": "<string>",
      "source": "<string>",
      "price": 123,
      "length": 123,
      "image_url": {},
      "data_type": "unstructured",
      "relevance_score": 0.5
    }
  ],
  "results_by_source": {
    "web": 123,
    "proprietary": 123
  },
  "total_deduction_pcm": 123,
  "total_deduction_dollars": 123,
  "total_characters": 123
}

Authorizations

x-api-key
string
header
required

Body

application/json
Parameters for the context search.
query
string
required

The question or topic the user wants information on.

search_type
enum<string>
required

Defines whether to search in "proprietary", "web", or "all" sources.

Available options:
proprietary,
web,
all
max_price
number
required

The maximum allowed price per thousand queries (CPM).

data_sources
string[]

(Optional) List of index names or URLs to search over. Can include proprietary dataset names (e.g. 'valyu/valyu-arxiv') and/or specific website URLs (e.g. 'https://www.valyu.network/'). If omitted, all relevant indices are used.

Example:
[
  "valyu/valyu-arxiv",
  "valyu/valyu-wikipedia",
  "https://www.valyu.network/"
]
max_num_results
integer
default:10

Number of results returned after reranking.

similarity_threshold
number
default:0.4

(Optional) The minimum similarity score for a result to be included.

query_rewrite
boolean
default:true

(Optional) Whether to rewrite the query to improve query performance.

Response

200
application/json
Successful response.
success
boolean
required

Indicates if the request was successful

error
string
required

Error message if any

tx_id
string
required

Transaction ID for this request. Can be used for providing feedback.

query
string
required

The processed query string

results
object[]
required

Array of result objects

results_by_source
object
required

Count of results by source type

total_deduction_pcm
number
required

Total cost extrapolated to 1000 queries (CPM) for retrieved content.

total_deduction_dollars
number
required

Total cost for the results in USD.

total_characters
integer
required

Total number of characters retrieved across all results.