Skip to content

Constructor Model API usage example

See how to create a session and send a message to get a response:

python
session = create_session(KM_ID)      # Create a new session 
session_id = session["id"]           # Get session ID from the response 
text = "Hello"                       # Define the text you want to send
answer = ask(text, session_id)       # Send message and retrieve the reply
print(answer)                        # Print the reply