Download OpenAPI specification:Download
Welcome to the Rainbird API documentation for the v2.0 engine. It contains details of the API calls required to perform Rainbird queries against a Knowledge Map
Authentication with the Rainbird API uses a user key, passed in the header. This can be found on the Account page or with the controls for publishing a Knowledge Map.
Our legacy authentication method of HTTP BasicAuth continues to be supported, but we highly advise transitioning to the new method.
Security Scheme Type | API Key |
---|---|
Header parameter name: | X-API-Key |
This endpoint starts a new session that can be used in subsequent API calls. By default it will start a session using the live version of the given knowledge map. If no version has been set live it will default to using the draft version. Alternatively the query parameters “useDraft” or “version” can be used as an override to request either the draft or a specific version.
kmID required | string The knowledge map ID to start a session against |
useDraft | boolean Flag to use the draft version of the knowledge map, cannot be used simultaneously with 'version' parameter |
version | integer Parameter to use a specific version of the map, cannot be used simultaneously with 'useDraft' parameter |
curl -i -X GET \ 'https://api.rainbird.ai/start/:kmID?useDraft=true&version=0' \ -H 'X-API-Key: YOUR_API_KEY_HERE'
{- "id": "12345678-1234-1234-1234567890ac",
- "kmVersion": {
- "id": "abcdefgh-abcd-abcd-abcdefghijkl"
}
}
sessionID required | string The session to inject facts into |
Array of facts to inject
subject required | string (Subject) The subject side concept instance or value |
relationship required | string (Relationship) The relationship between subject and object |
required | string or number or boolean (Object) The object side concept instance or value |
certainty required | number (Certainty) [ 1 .. 100 ] How certain this fact or answer is |
[- {
- "subject": "John",
- "relationship": "lives in",
- "object": "England",
- "certainty": 100
}, - {
- "subject": "Will",
- "relationship": "lives in",
- "object": "England",
- "certainty": 100
}, - {
- "subject": "Ellie",
- "relationship": "lives in",
- "object": "England",
- "certainty": 100
}, - {
- "subject": "David",
- "relationship": "lives in",
- "object": "England",
- "certainty": 100
}
]
{- "result": "OK"
}
sessionID required | string The session to query against |
Query for the engine to try to answer
subject | string (Subject) The subject side concept instance or value |
relationship required | string (Relationship) The relationship between subject and object |
string or number or boolean (Object) The object side concept instance or value |
{- "subject": "John",
- "relationship": "speaks"
}
{- "result": [
- {
- "subject": "string",
- "relationshipType": "string",
- "object": "string",
- "certainty": 1,
- "factID": "string",
- "relationship": "string",
- "subjectMetadata": { },
- "objectMetadata": { }
}
], - "queryProfile": [ ],
- "sid": "string",
- "stats": { }
}
sessionID required | string The session to send responses to |
Items to send as a response
Array of objects |
{- "answers": [
- {
- "subject": "John",
- "relationship": "lives in",
- "object": "England",
- "certainty": 100
}
]
}
{- "result": [
- {
- "subject": "string",
- "relationshipType": "string",
- "object": "string",
- "certainty": 1,
- "factID": "string",
- "relationship": "string",
- "subjectMetadata": { },
- "objectMetadata": { }
}
], - "queryProfile": [ ],
- "sid": "string",
- "stats": { }
}
sessionID required | string The session to step back with an undo |
An empty object
{ }
{- "result": [
- {
- "subject": "string",
- "relationshipType": "string",
- "object": "string",
- "certainty": 1,
- "factID": "string",
- "relationship": "string",
- "subjectMetadata": { },
- "objectMetadata": { }
}
], - "queryProfile": [ ],
- "sid": "string",
- "stats": { }
}
factID required | string The factID for which to retrieve evidence |
sessionID required | string The sessionID where the fact was created |
curl -i -X GET \ https://api.rainbird.ai/analysis/evidence/:factID/:sessionID
{- "factID": "WA:RF:46270715221c02dca319bd10",
- "source": "rule",
- "fact": {
- "subject": {
- "type": "person",
- "value": "Bob",
- "dataType": "string"
}, - "relationship": {
- "type": "speaks"
}, - "object": {
- "type": "language",
- "dataType": "string",
- "value": "English"
}, - "certainty": 75
}, - "time": 1522060091106,
- "rule": {
- "bindings": {
- "S": "Bob",
- "O": "English",
- "COUNTRY": "England"
}, - "conditions": [
- {
- "subject": "England",
- "relationship": "national language",
- "object": "English",
- "salience": 100,
- "certainty": 100,
- "impact": 37.5,
- "factID": "WA:KF:7ccf0415f3af204b5eb3",
- "objectType": "string",
- "alt": "alternative text",
- "factKey": "1a1a1a1a-1a1a-1a1a-1a1a-1a1a1a1a1a1a1"
}, - {
- "subject": "Bob",
- "relationship": "lives in",
- "object": "England",
- "salience": 100,
- "certainty": 100,
- "impact": 37.5,
- "factID": "WA:AF:8e5b2c204b5eb3b24ba1",
- "objectType": "string",
- "alt": "alternative text",
- "factKey": "1b1b1b1b-1b1b-1b1b-1b1b-1b1b1b1b1b1b1"
}
], - "ruleMaxCertainty": 75
}
}
sessionID required | string The session id to access the interaction logs |
format | string Format of the retrieved data. CSV or JSON |
curl -i -X GET \ 'https://api.rainbird.ai/analysis/interactions/:sessionID?format=string'
{- "values": {
- "start": {
- "useDraft": true,
- "kmVersionID": "fb215245-4be2-4d23-a64c-97c50530684f",
- "sessionID": "b77cdb34-5904-4dac-9fe9-3697ed1d73e3"
}
}, - "event": "start",
- "created": "2022-03-04T10:13:04.224Z"
}
sessionID required | string The sessionID of the session |
filter | Array of strings Default: ["version"] The type of information requested. |
relationships | Array of strings A comma-separated list of relationships to filter the session data by. |
curl -i -X GET \ 'https://api.rainbird.ai/analysis/session/:sessionID?filter=version&relationships=string' \ -H 'X-API-Key: YOUR_API_KEY_HERE'
{- "km": {
- "id": "abcdefgh-abcd-abcd-abcdefghijkl",
- "name": "speaks",
- "versionID": "abcdefgh-abcd-abcd-abcdefghijkl",
- "versionNumber": 1,
- "versionCreated": "2022-01-01T12:00:00.000Z",
- "versionStatus": "Draft"
}, - "facts": {
- "global": [
- {
- "id": "WA:KF:abcdefgh-abcd-abcd-abcdefghijkl",
- "subject": {
- "concept": "Country",
- "value": "France",
- "dataType": "string"
}, - "relationship": "has language",
- "object": {
- "concept": "Language",
- "value": "French",
- "dataType": "string"
}, - "certainty": 100,
- "source": "knowledgemap"
}
], - "context": [ ],
- "local": [
- {
- "id": "WA:KF:abcdefgh-abcd-abcd-abcdefghijkl",
- "subject": {
- "concept": "Person",
- "value": "Mat",
- "dataType": "string"
}, - "relationship": "lives in",
- "object": {
- "concept": "Country",
- "value": "France",
- "dataType": "string"
}, - "certainty": 100,
- "source": "knowledgemap"
}
]
}
}
The Natural Language APIs are currently in beta. They are unsupported and are subject to change. They rely on an external service provided by OpenAI. The knowledge map and any data you provide will be processed by them. By using this API you will be bound by OpenAI’s terms and conditions. To protect your data we recommend the following:
Given a body of text, the endpoint will return a question, result or an error.
If a question response is received, the question prompt can be displayed in a UI or used to embed and search a vector store to solicit an answer. The data containing the answer can be resubmitted in a new interact request, ensuring the same session ID is used. Please note: when a question response has been received, the session is locked to the current query in progress. Therefore, if any additional requests contain a new question asked to Rainbird, the new question will be ignored until a result is received.
If a result response is received, this contains the answer to the user's original question and can be presented as required. Once a result response is received, the session is unlocked and further queries can be made in that session.
If an error response is received, this may be due to an internal error, but it can also be caused by such things as not being able to detect the query, the question being asked in an unfamiliar way, or the knowledge map not being designed to answer it. A suggested error response is included that can be used in chat interfaces. Alternatively, the error code can be mapped to your own custom error messages.
Version required | string Default: v1 Version of the natural language API |
User prompt for natural language processing
sessionID required | string The session ID needed to access that specific session |
userPrompt required | string The user's prompt for natural language processing |
{- "sessionID": "string",
- "userPrompt": "string"
}
{- "responseType": "question",
- "query": {
- "subject": "string",
- "relationship": "string",
- "object": "string"
}, - "questions": {
- "subject": "string",
- "object": "string",
- "objectType": "string",
- "objectMetadata": { },
- "dataType": "string",
- "relationship": "string",
- "type": "string",
- "plural": true,
- "allowCF": true,
- "allowUnknown": true,
- "canAdd": true,
- "prompt": "string",
- "knownAnswers": [ ],
- "concepts": [
- {
- "conceptType": "string",
- "name": "string",
- "type": "string",
- "value": "string",
- "invalidResponse": true
}
]
}, - "results": [
- {
- "Certainty": 0,
- "FactID": "string",
- "Object": "string",
- "ObjectMetadata": { },
- "ObjectValue": "string",
- "Relationship": "string",
- "Subject": "string",
- "SubjectMetadata": { },
- "SubjectValue": "string"
}
], - "error": {
- "code": 0,
- "message": "string",
- "suggestedChatResponse": "string",
- "statusCode": "string"
}, - "metadata": {
- "querySubmittedAt": "2019-08-24T14:15:22Z",
- "languageEngineResponseTime": 0,
- "llmTokens": {
- "completionTokens": 0,
- "promptTokens": 0,
- "totalTokens": 0
}, - "apiVersion": "string",
- "endpoint": "string"
}, - "facts": {
- "injected": [
- {
- "subject": "string",
- "relationship": "string",
- "object": "string",
- "certainty": 1
}
], - "invalid": [
- {
- "subject": "string",
- "relationship": "string",
- "object": "string",
- "certainty": 1
}
], - "unmatched": [
- "string"
]
}
}
The 'explain' endpoint processes a body of text, generating a natural language exposition of the evidence based on the user-provided session and fact.
Version required | string Default: v1 Version of the natural language API |
Language, factID, and sessionID for natural language processing
language required | string The users preferred language setting i.e. "en", "za" |
sessionID required | string The session ID needed to access that specific session |
factID required | string The ID of a fact specific to that session to retrieve data from |
{- "language": "string",
- "sessionID": "string",
- "factID": "string"
}
{- "explanation": "string",
- "error": {
- "code": 0,
- "message": "string",
- "suggestedChatResponse": "string",
- "statusCode": "string"
}, - "metadata": {
- "querySubmittedAt": "2019-08-24T14:15:22Z",
- "languageEngineResponseTime": 0,
- "llmTokens": {
- "completionTokens": 0,
- "promptTokens": 0,
- "totalTokens": 0
}, - "apiVersion": "string",
- "endpoint": "string"
}
}