Knowledge Bases
Use knowledge bases to find legal information related to a query.
Last updated
Use knowledge bases to find legal information related to a query.
Last updated
A Knowledge Base (KB) is a database of legal information stored using an embedding database. You can use the retrieve API to query the Knowledge Base for items of legal data that match a query.
Our legislation Knowledge Bases contain the full text of all the digitised legislation that is available through the . The legislation is split into portions (chapters, sections, paragraphs, etc.) and embeddings are calculated for each portion. These embeddings make it possible to perform semantic queries against the data to find portions relevant to a keyword, phrase or question.
Our judgments Knowledge Bases contain the full text of all the court judgments (case law) that is available from our various Legal Information Institute (LII) partner websites. The judgments are split into chunks of text (along page boundaries, if pages are available) and embeddings are calculated for each chunk. These embeddings make it possible to perform semantic queries against the judgment dataset.
Use the retrieve API to query a Knowledge Base for information matching keywords or phrases.
When you query a knowledge base, you must submit a POST request:
Identify the Knowledge Base to query using its code in the URL of the request.
Specify the text to search the Knowledge Base for using the text
parameter.
The API will return matching items (portions of legislation) that match your query, including a score, the text of the portion, and metadata.
The Retrieve API for legislation Knowledge Bases returns the text of the matched provision, the score of the match (a lower score is better), and metadata for the portion. This provides very precise details on the portion of legislation that matched the query, allowing you to provide concrete citation information to your user.
The metadata includes a combination of:
For example:
The Retrieve API for judgment Knowledge Bases returns the text of the matched chunk, the score of the match (a lower score is better), and metadata for the chunk.
Up to three chunks will be returned for the same judgment.
The metadata for each chunk includes a combination of:
The 1-based page number, where available.
For example:
Details of the legislative work, including information.
information for the portion of that work.
Details of the legislative work, including information.
Get details of Laws.Africa's Knowledge Bases.
Note: this API is a preview and may change in future.
A page number within the paginated result set.
Number of results to return per page.
Retrieve items from the knowledge base that match your query.
Unique code identifying this knowledge base
Details to retrieve items from a knowledge base.
The text to find matching items for
Number of results to return
10