Agent Introduction

An agent helps you process user sentences (unstructure data) into structure data that you can use to return an appropriate response.

Agent is a collection that contains prompt words and function Json Schema definitions, few-shot examples and knowledge base data. You can create multiple different Agents to perform specific operations in specific domains. BotSharp has built-in maintenance for Agents, including creating, updating and deleting, importing and exporting. Agents are divided into task agents, routing (non-task) agents, evaluating agents and static agents. Business domain agents belong to task agents, and routers belong to non-task agents, static agents don’t have capabilities to interact with external environment.

My Agent

After creating the platform account, you can start to enter the steps of creating the Agent.

Agent creation

Suppose we need to write a Pizza restaurant order AI Bot. First, specify a name and description, then call the Agent creation API to create a new robot, and the system will return an internally used Agent Id. This Id needs to be used in subsequent interactions.

Alt text

Agent instruction

BotSharp uses the latest large language model in natural language understanding, can interact with OpenAI’s ChatGPT, and also supports the most widely used open source large language model LLaMA and its fine-tuning model. In this example, we use Azure OpenAI as the LLM engine.

"LlmProviders": [
    {
        "Provider": "azure-openai",
        "Models": [{
            "Name": "gpt-35-turbo",
            "ApiKey": "",
            "Endpoint": "https://gpt-35-turbo.openai.azure.com/",
            "Type": "chat",
            "PromptCost": 0.0015,
            "CompletionCost": 0.002
        }]
    }
]

If you use the installation package to run, please ensure that the BotSharp.Plugin.AzureOpenAI plugin package is installed.

Now we can update the prompt to the chatbot definition through the Agent Update API.

Alt text

After the update is successful, the robot will have a system prompt, and the subsequent dialogue will interact with the user based on the background knowledge of the system prompt. So far, the creation of the Agent has been completed, but the real dialogue has not yet started. The following will continue to introduce the last step, the Agent Conversation part.