Quick Start
Get talking to your agent ASAP.
Let's just dive right in. To get started with Carter in your project you need
Now you want to chat with your agent right? This is pretty simple as Carter agents live behind a standard REST API endpoint.
1
using UnityEngine.Networking;
2
3
...
4
5
WWWForm form = new WWWForm();
6
form.AddField("query", "YOUR MESSAGE TO CARTER!);
7
form.AddField("api_key", "YOUR-API-KEY);
8
form.AddField("uuid", "USER-ID");
9
form.AddField("scene", "level-1"); //optional!
10
11
UnityWebRequest www = UnityWebRequest.Post("https://api.carterapi.com/v0/chat", form);
12
yield return www.SendWebRequest();
13
14
if (www.result != UnityWebRequest.Result.Success) {
15
Debug.Log(www.error);
16
}
17
else {
18
var response = www.downloadHandler.text;
19
Debug.Log(response);
20
}
21
import requests
import json
url = "https://api.carterapi.com/v0/chat"
payload = json.dumps({
"api_key": "MY API KEY",
"query": "MY MESSAGE TO CARTER",
"uuid": "A UNIQUE USER ID",
"scene": "level-1", # optional!
})
headers = {
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
You probably want to get your head around the JSON response right? See here for a full breakdown or skip to:
Show us what you're building via our community on Discord!
Last modified 2mo ago