Quick start
Before starting
In order to access the API, you will need a Seirime account.
Note: Seirime is currently in closed beta. If you'd like to get early access, you can request it from our contact assistant.
Authenticating to the API
Alright, let's kick things off by authenticating to the API by making a POST /auth/login
request using our login credentials.
Now that we have a bearer token, we can use it to authorize the requests in the next steps.
Creating your assistant
In this step, we're setting up a customer support agent for Acme Inc.
The name
we give it will show up in the assistant widget when we'll talk to it later.
The instruction
provides the context in which the assistant operates.
Use it describe your company, who it serves and talks to, which tone and formality to speak in.
Talking to the assistant
With the assistant ready, you can start talking to it. Head over to the Playground!
You can also load the assistant on your own website by bootstrapping it.
Feeding in a snippet
Besides the instruction, your assistant doesn't yet know a whole lot about your company and the products you offer. That is where snippets come in. They are pieces of information the assistant will use to answer questions and perform actions. For best results, we keep each snippet short and centered around a single topic. We can add as many snippets as we'd like to fill out its domain knowledge.
Let's get to snipping! Take the snippets
property we received back from the response when creating the assistant, and fill it in as URL:
Our assistant now knows of our product:
Tip: Having the snippet content by in a question-answer structure usually works very well. For example:
Question: What is the purpose of Acme's 'blurp' product?
Answer: Blurp is a colossal cotton ball drenched in oil, perfect for rolling around in spots in order to make victims of the prank slip!
Time for action
Your assistant can't do more than just talk right now. Let's change that by creating an action. Let's say Acme offers many more products than the one we described in the snippet. Their available products and prices change a lot though. We want the assistant to fetch the data from an API so that it always has the latest, greatest ones.
Creating an action client
In order to execute actions, the assistant needs an action client
to make the API calls.
It specifies the base_url
at which the requests are made, as well as the HTTP headers
to pass in.
For our demo purposes, we are going to make use of the public API https://www.acme-api.com/
, which accepts JSON data.
Creating the action
We will set up our action to make a GET /products
call with base URL https://www.acme-api.com/api/products
(defined on our client).
Now we can use this client to set up our action.
The assistant takes the name
and description
into consideration to determine whether
the user wants to execute an action, so it's important that they are descriptive.
Acme's product lineup is very special and the customer needs to be prepared to handle it.
By settingrequires_confirmation
to true
, the action is only triggered when the customer gives confirmation.
Take the actions
property we received back from the response when creating the assistant and
use it as the request URL, with the client
being the url
of the client creation
response from the last step, and send the request:
Bringing it together
Let's give our action-ready assistant a spin! Once we show interest in learning more about Acme's product offering, the assistant will request confirmation to execute the action. Let's ask it about a product it doesn't yet know about to trigger the action:
Once confirmation is given, it will make the API call to fetch the products and formulate an answer based on the API response:
Note: Requiring confirmation is usually not necessary for calls that don't make any changes, but are a great safeguard for calls that have consequences, such as ordering a product, changing an appointment, etc.