Skip to main content

Vulavula Knowledge Base - Search

Knowledge Base

This endpoint allows you to create a new knowledge base for storing and querying documents.

BODY PARAMETERS

  • collection (string, required): The name of the knowledge base collection to be created.

HEADERS

  • X-CLIENT-TOKEN (string, required): The authentication token required for accessing the API.

EXAMPLES

from vulavula import VulavulaClient
client = VulavulaClient("<INSERT_TOKEN>")

knowledge_base_result = client.create_knowledgebase("<knowledge base name>")
print("Knowledge Base Creation Result:", knowledge_base_result)

Retrieve all existing knowledge bases.

EXAMPLE

knowledgebases = client.get_knowledgebases()
print("Knowledge Bases:", knowledgebases)

Delete a specified knowledge base.

EXAMPLE

delete_result = client.delete_knowledgebase("<knowledgebase id>")
print("Delete Result:", delete_result)

Upload a file and extract text to create documents within a collection.

BODY PARAMETERS

  • documents (array, required): List of documents to be added.
  • collection (string, required): Name of the knowledge base collection.
  • language (string, required): Language of the documents.

HEADERS

  • X-CLIENT-TOKEN (string, required): The authentication token required for accessing the API.

EXAMPLES

result = client.create_documents("<document name>.pdf", "<knowledgebase id>")
print("Upload and Extract Result:", result)

Retrieve all documents within a specified knowledge base.

EXAMPLE

result = client.get_documents("<knowledgebase id>")
print(result)

Delete a specific document from a knowledge base.

EXAMPLE

delete_result = client.delete_document("<document id>")
print("Delete Result:", delete_result)

Perform a search query within a specific knowledge base and language.

BODY PARAMETERS

  • query (string, required): The query text to search within the knowledge base.
  • language (string, required): The language of the query text.

HEADERS

  • X-CLIENT-TOKEN (string, required): The authentication token required for accessing the API.

EXAMPLES

result = client.query(knowledgebase_id="<knowledgebase id>", query="active learning", language="en_Us")
print(result)

RESPONSES

🟢 200 OK
The request was successful. Below is an example response body:
    {
"search_result": [
{
"text": "Alan Turing was an English mathematician, computer scientist, logician, cryptanalyst, philosopher, and theoretical biologist.",
"score": 0.6250576
},
{
"text": "Compute",
"score": 0.61686873
},
{
"text": "source code.",
"score": 0.5978863
}
]
}

RESPONSE BODY PARAMETERS

Object
responses array required: An array containing the query responses.
response_text string required: Contains the query response text.
🔴 400 Bad Request
The request was malformed or contained invalid data.
🟠 401 Unauthorized
The client token is missing or invalid.
🔴 500 Internal Server Error
An unexpected error occurred on the server.