Datasource Query
Getting Started
To get started, you need to have the API_BASE_URL
and the API_KEY
issued from the NEXTgpt backend.
Datasource Query
To query a datasource, you need to have an existing datasource created on NEXTgpt backend.
# name of datasource
datasource_name = "sample_datasource"
# query to send
query = "sample_query"
# page to show
page = 1
# number of top most matching results to show
size = 5
import requests
url = f"{API_BASE_URL}/api/v1/datasources/{datasource_name}/query"
headers={"Authorization": f"Bearer {API_KEY}"}
params = {
"query": query,
"page": page,
"size": size
}
# call the API
response = requests.get(url=url, params=params, headers=headers)
if response.status_code == 200:
print("Success! Response data:")
print(response.json())
else:
print(f"Error: {response.status_code}, {response.reason}")
Getting Help
Please contact NEXTgpt development team with your issues/suggestions using this form.