The age of programming via natural language has come to pass.
Today we use sk and typechat to code a .net sample.
Example 1: Controlling Computers with Natural Language
In this code, OpenAI will provide a snippet of executable code.
Demonstration of creating a directory, writing the string "hello" into a file named b.txt, and then inquiring about the contents of the newly created b.txt file:
Create a directory named "test" in the current directory, within which create a file named b.txt and write the string "hello" into it.
def program(api: IPluginApi):
step1 = api.get_current_directory()
step2 = api.concatenate(step1, "/test")
step3 = api.make_directory(step2)
step4 = api.concatenate(step2, "/b.txt")
step5 = api.write_file(step4, "hello")
return step5
Display the contents of the b.txt file located in the "test" directory.
def program(api: IPluginApi):
step1 = api.set_current_directory("test")
step2 = api.read_file("b.txt")
step3 = api.output(step2)
return step3
Executing the program will yield the output:
hello
In conclusion, programming control over the computer has been achieved through the use of natural language.
Example 2: Ordering with Natural Language, a cappuccino with added sugar
Feature: Natural language generates JSON
I'll have a cappuccino, and please add sugar.
##YOUR ORDER
{
"items": [
{
"$type": "LatteDrinks",
"productName": "cappuccino",
"options": [
{
"$type": "Sweetners",
"optionName": "sugar"
}
],
"quantity": 1
}
]
}
Success!
It's possible that we could then transmit the resulting JSON to a food delivery API, thereby actualizing the order process.
For an in-depth understanding of how to utilize this feature:
Create AI agents with Semantic Kernel
learn.microsoft.com/zh-cn/semantic-kernel/overview/
TypeChat
microsoft.github.io/TypeChat/
Top comments (0)