Integrate with an AI model
curl --request POST \
--url https://api.sol.com/v1/ai/integrate \
--header 'Content-Type: application/json' \
--data '
{
"model": "gpt-4",
"messages": [
{
"role": "user",
"content": "Draft an email welcoming Tara to the platform."
}
],
"tools": [
"create_email_draft"
],
"tool_choice": "auto"
}
'import requests
url = "https://api.sol.com/v1/ai/integrate"
payload = {
"model": "gpt-4",
"messages": [
{
"role": "user",
"content": "Draft an email welcoming Tara to the platform."
}
],
"tools": ["create_email_draft"],
"tool_choice": "auto"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
model: 'gpt-4',
messages: [{role: 'user', content: 'Draft an email welcoming Tara to the platform.'}],
tools: ['create_email_draft'],
tool_choice: 'auto'
})
};
fetch('https://api.sol.com/v1/ai/integrate', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.sol.com/v1/ai/integrate",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'model' => 'gpt-4',
'messages' => [
[
'role' => 'user',
'content' => 'Draft an email welcoming Tara to the platform.'
]
],
'tools' => [
'create_email_draft'
],
'tool_choice' => 'auto'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.sol.com/v1/ai/integrate"
payload := strings.NewReader("{\n \"model\": \"gpt-4\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"Draft an email welcoming Tara to the platform.\"\n }\n ],\n \"tools\": [\n \"create_email_draft\"\n ],\n \"tool_choice\": \"auto\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.sol.com/v1/ai/integrate")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"gpt-4\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"Draft an email welcoming Tara to the platform.\"\n }\n ],\n \"tools\": [\n \"create_email_draft\"\n ],\n \"tool_choice\": \"auto\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sol.com/v1/ai/integrate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"gpt-4\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"Draft an email welcoming Tara to the platform.\"\n }\n ],\n \"tools\": [\n \"create_email_draft\"\n ],\n \"tool_choice\": \"auto\"\n}"
response = http.request(request)
puts response.read_body{
"responseId": "response-45678",
"tool_calls": [
{
"toolId": "tool-6789",
"params": {
"from_email": "noreply@sol.com",
"to_email": "tara@sol.com"
}
}
],
"status": "tools_selected"
}API Reference
Integrate with an AI model
Integrates with an AI model (e.g., GPT-4) to generate responses and select tools in Sol.
POST
/
ai
/
integrate
Integrate with an AI model
curl --request POST \
--url https://api.sol.com/v1/ai/integrate \
--header 'Content-Type: application/json' \
--data '
{
"model": "gpt-4",
"messages": [
{
"role": "user",
"content": "Draft an email welcoming Tara to the platform."
}
],
"tools": [
"create_email_draft"
],
"tool_choice": "auto"
}
'import requests
url = "https://api.sol.com/v1/ai/integrate"
payload = {
"model": "gpt-4",
"messages": [
{
"role": "user",
"content": "Draft an email welcoming Tara to the platform."
}
],
"tools": ["create_email_draft"],
"tool_choice": "auto"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
model: 'gpt-4',
messages: [{role: 'user', content: 'Draft an email welcoming Tara to the platform.'}],
tools: ['create_email_draft'],
tool_choice: 'auto'
})
};
fetch('https://api.sol.com/v1/ai/integrate', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.sol.com/v1/ai/integrate",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'model' => 'gpt-4',
'messages' => [
[
'role' => 'user',
'content' => 'Draft an email welcoming Tara to the platform.'
]
],
'tools' => [
'create_email_draft'
],
'tool_choice' => 'auto'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.sol.com/v1/ai/integrate"
payload := strings.NewReader("{\n \"model\": \"gpt-4\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"Draft an email welcoming Tara to the platform.\"\n }\n ],\n \"tools\": [\n \"create_email_draft\"\n ],\n \"tool_choice\": \"auto\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.sol.com/v1/ai/integrate")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"gpt-4\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"Draft an email welcoming Tara to the platform.\"\n }\n ],\n \"tools\": [\n \"create_email_draft\"\n ],\n \"tool_choice\": \"auto\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sol.com/v1/ai/integrate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"gpt-4\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"Draft an email welcoming Tara to the platform.\"\n }\n ],\n \"tools\": [\n \"create_email_draft\"\n ],\n \"tool_choice\": \"auto\"\n}"
response = http.request(request)
puts response.read_body{
"responseId": "response-45678",
"tool_calls": [
{
"toolId": "tool-6789",
"params": {
"from_email": "noreply@sol.com",
"to_email": "tara@sol.com"
}
}
],
"status": "tools_selected"
}Body
application/json
⌘I