Creating knowledge models
If you need to create a new knowledge model, do it as follows:
Define the constants:
python
import requests
KM_ID = '{YOUR_KM_ID}'
API_URL = 'https://constructor.app/api/platform-kmapi/v1'
API_KEY = '{YOUR_API_KEY}'Define the headers:
python
# Define the headers
headers = {
'X-KM-AccessKey': f'Bearer {API_KEY}'
}Create a new knowledge model:
python
def create_model(name, description, shared_type):
data = {
"name": name,
"description": description,
"shared_type": shared_type
}
response = requests.post(f'{API_URL}/knowledge-models', headers=headers, json=data)
return response.json()After that, you can create and manage chat sessions or chat with the model without creating a session.