@procedure

Overview

The @procedure decorator is used to denote a method within a Book class as a procedure. This links a method to a specific procedure in the Kognitos platform.

Syntax

@procedure(name: str, **kwargs)

Guidelines

1. Naming Conventions

Names must begin with to. This defines the action or intent of the procedure. For example:

  • @procedure("to capitalize a (string)"

  • @procedure("to get the (current temperature)")

  • @procedure("to send an *SMS* message")

2. Output Concepts

Output concepts are wrapped in parentheses (). For example:

@procedure("to capitalize a (string)")

3. Proper Nouns

Proper nouns are wrapped between asterisks **. For example:

In this example, office365 is considered a proper noun. The procedure is referred to as 'get some users from office365' rather than the office365.

Parameters

Parameter
Type
Required
Description

name

str

Yes

A description that reflects the action or purpose of the procedure. See the syntax guidelines for details.

Keyword Arguments

Argument
Type
Description

connection_required

bool

A boolean that indicates whether a connection to the service is required to execute the procedure. If not specified, it defaults to None.

noun_phrase

str

A string that represents the noun phrase for the procedure.

Examples

1. Capitalizing a String

This method implements a procedure that capitalizes a string with one input concept and one output concept.

2. Creating an Order in Truckmate

This method implements a procedure that creates an order in Truckmate. It has one input concept and two output concepts.

3. Reading SMS messages using the Twilio API

The following method implements a procedure that reads SMS messages using the Twilio API. In this example, SMS is a proper noun.

Last updated

Was this helpful?