The Deep Thought API is a REST API that provides access to the Deep Thought.
Endpoint specifications are defined in the OpenAPI spec. Each version of the API has its own spec. The specs can be found in the /specs
directory.
Description: Find sources for a given query
With curl:
curl -X 'POST' 'http://127.0.0.1:8000/v1/find_sources' -H 'Content-Type: application/json' -d '{"query": "test_query", "num_results": 2}'
Description: Find the most likely fact for a given query
With curl:
curl -X 'POST' 'http://127.0.0.1:8000/v1/' -H 'Content-Type: application/json' -d '{"user_input": "whats for dinner"}'
Description: Ask a question and get an answer with links to sources
With curl:
curl -X 'POST' 'http://127.0.0.1:8000/v1/ask' -H 'Content-Type: application/json' -d '{"query": "step by step instructions to install a new operator", "num_results": 1}'
The API is documented using OpenAPI. The OpenAPI UI can be accessed at /docs
.
The OpenAPI specification can be found at /spec
.
The OpenAPI spec is defined in `/spec/openapi.json' and is to be regarded as the source of truth for the API. Both API developers and consumers should refer to this file for the API definition. Developers should update this file prior to making changes to the API, keeping in mind that the API is versioned.
The API is versioned and endpoints will always be available under the version number (e.g. /v1/
).
This API follows Semantic Versioning, but only the major version number is included in the URL. Minor and patch versions can be found in the OpenAPI spec.
To test versioning, you can hit two separate endpoints:
curl -X 'GET' 'http://127.0.0.1:8000/v1/items/' -H 'Content-Type: application/json' -d '{"query": "test_query", "num_results": 2}'
Which should return:
[
{
"version": "V1"
}
]
And then:
curl -X 'GET' 'http://127.0.0.1:8000/v2/api_version_test/' -H 'Content-Type: application/json' -d '{"query": "test_query", "num_results": 2}'
Which should return:
[
{
"version": "V2"
}
]