curl --request POST \
--url https://api-talk.saninternet.com/v1/api/rag/retrieve \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"queryText": "Qual a politica de devolucao?",
"filters": {
"sourceTypes": [
"document",
"qa"
],
"audience": "ai_agent"
},
"scoreThreshold": 0.7,
"returnMode": "ai_generated_answer",
"limit": 10,
"useRerank": true,
"companyName": "Acme Corporation",
"companyProductsNames": [
"Produto Premium",
"Produto Basic"
],
"clientName": "Joao Silva",
"clientServices": "Plano Premium, Suporte 24/7",
"clientCurrentChatHistory": "<string>",
"clientOlderChatHistory": "<string>",
"clientPaymentHistory": "<string>",
"clientLogs": "<string>"
}
'import requests
url = "https://api-talk.saninternet.com/v1/api/rag/retrieve"
payload = {
"queryText": "Qual a politica de devolucao?",
"filters": {
"sourceTypes": ["document", "qa"],
"audience": "ai_agent"
},
"scoreThreshold": 0.7,
"returnMode": "ai_generated_answer",
"limit": 10,
"useRerank": True,
"companyName": "Acme Corporation",
"companyProductsNames": ["Produto Premium", "Produto Basic"],
"clientName": "Joao Silva",
"clientServices": "Plano Premium, Suporte 24/7",
"clientCurrentChatHistory": "<string>",
"clientOlderChatHistory": "<string>",
"clientPaymentHistory": "<string>",
"clientLogs": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
queryText: 'Qual a politica de devolucao?',
filters: {sourceTypes: ['document', 'qa'], audience: 'ai_agent'},
scoreThreshold: 0.7,
returnMode: 'ai_generated_answer',
limit: 10,
useRerank: true,
companyName: 'Acme Corporation',
companyProductsNames: ['Produto Premium', 'Produto Basic'],
clientName: 'Joao Silva',
clientServices: 'Plano Premium, Suporte 24/7',
clientCurrentChatHistory: '<string>',
clientOlderChatHistory: '<string>',
clientPaymentHistory: '<string>',
clientLogs: '<string>'
})
};
fetch('https://api-talk.saninternet.com/v1/api/rag/retrieve', 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-talk.saninternet.com/v1/api/rag/retrieve",
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([
'queryText' => 'Qual a politica de devolucao?',
'filters' => [
'sourceTypes' => [
'document',
'qa'
],
'audience' => 'ai_agent'
],
'scoreThreshold' => 0.7,
'returnMode' => 'ai_generated_answer',
'limit' => 10,
'useRerank' => true,
'companyName' => 'Acme Corporation',
'companyProductsNames' => [
'Produto Premium',
'Produto Basic'
],
'clientName' => 'Joao Silva',
'clientServices' => 'Plano Premium, Suporte 24/7',
'clientCurrentChatHistory' => '<string>',
'clientOlderChatHistory' => '<string>',
'clientPaymentHistory' => '<string>',
'clientLogs' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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-talk.saninternet.com/v1/api/rag/retrieve"
payload := strings.NewReader("{\n \"queryText\": \"Qual a politica de devolucao?\",\n \"filters\": {\n \"sourceTypes\": [\n \"document\",\n \"qa\"\n ],\n \"audience\": \"ai_agent\"\n },\n \"scoreThreshold\": 0.7,\n \"returnMode\": \"ai_generated_answer\",\n \"limit\": 10,\n \"useRerank\": true,\n \"companyName\": \"Acme Corporation\",\n \"companyProductsNames\": [\n \"Produto Premium\",\n \"Produto Basic\"\n ],\n \"clientName\": \"Joao Silva\",\n \"clientServices\": \"Plano Premium, Suporte 24/7\",\n \"clientCurrentChatHistory\": \"<string>\",\n \"clientOlderChatHistory\": \"<string>\",\n \"clientPaymentHistory\": \"<string>\",\n \"clientLogs\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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-talk.saninternet.com/v1/api/rag/retrieve")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"queryText\": \"Qual a politica de devolucao?\",\n \"filters\": {\n \"sourceTypes\": [\n \"document\",\n \"qa\"\n ],\n \"audience\": \"ai_agent\"\n },\n \"scoreThreshold\": 0.7,\n \"returnMode\": \"ai_generated_answer\",\n \"limit\": 10,\n \"useRerank\": true,\n \"companyName\": \"Acme Corporation\",\n \"companyProductsNames\": [\n \"Produto Premium\",\n \"Produto Basic\"\n ],\n \"clientName\": \"Joao Silva\",\n \"clientServices\": \"Plano Premium, Suporte 24/7\",\n \"clientCurrentChatHistory\": \"<string>\",\n \"clientOlderChatHistory\": \"<string>\",\n \"clientPaymentHistory\": \"<string>\",\n \"clientLogs\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-talk.saninternet.com/v1/api/rag/retrieve")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"queryText\": \"Qual a politica de devolucao?\",\n \"filters\": {\n \"sourceTypes\": [\n \"document\",\n \"qa\"\n ],\n \"audience\": \"ai_agent\"\n },\n \"scoreThreshold\": 0.7,\n \"returnMode\": \"ai_generated_answer\",\n \"limit\": 10,\n \"useRerank\": true,\n \"companyName\": \"Acme Corporation\",\n \"companyProductsNames\": [\n \"Produto Premium\",\n \"Produto Basic\"\n ],\n \"clientName\": \"Joao Silva\",\n \"clientServices\": \"Plano Premium, Suporte 24/7\",\n \"clientCurrentChatHistory\": \"<string>\",\n \"clientOlderChatHistory\": \"<string>\",\n \"clientPaymentHistory\": \"<string>\",\n \"clientLogs\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"aiGeneratedAnswer": "Com base nos documentos, a politica de devolucao permite devolucoes em ate 30 dias...",
"results": [
{
"id": "result-uuid-123",
"score": 0.85,
"payload": {
"companyId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"audience": [
"ai_agent",
"copilot"
],
"contentCategory": "policy",
"content": "Nossa politica de devolucao permite devolucoes em ate 30 dias...",
"sourceType": "document",
"sourceId": "doc-123",
"title": "Politica de Devolucao",
"path": [
"politicas",
"devolucoes"
],
"metadata": {}
}
}
],
"total": 5,
"retrievalTimeMs": 150
}{
"statusCode": 401,
"error": "Unauthorized",
"message": "Invalid or expired API key"
}{
"statusCode": 403,
"error": "SubscriptionInactive",
"message": "Sua assinatura nao esta ativa",
"subscriptionStatus": "CANCELLED"
}RAG Retrieve
Busca chunks relevantes no banco de dados vetorial usando RAG (Retrieval-Augmented Generation). Pode retornar uma resposta gerada por IA ou apenas os chunks brutos, dependendo do returnMode.
curl --request POST \
--url https://api-talk.saninternet.com/v1/api/rag/retrieve \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"queryText": "Qual a politica de devolucao?",
"filters": {
"sourceTypes": [
"document",
"qa"
],
"audience": "ai_agent"
},
"scoreThreshold": 0.7,
"returnMode": "ai_generated_answer",
"limit": 10,
"useRerank": true,
"companyName": "Acme Corporation",
"companyProductsNames": [
"Produto Premium",
"Produto Basic"
],
"clientName": "Joao Silva",
"clientServices": "Plano Premium, Suporte 24/7",
"clientCurrentChatHistory": "<string>",
"clientOlderChatHistory": "<string>",
"clientPaymentHistory": "<string>",
"clientLogs": "<string>"
}
'import requests
url = "https://api-talk.saninternet.com/v1/api/rag/retrieve"
payload = {
"queryText": "Qual a politica de devolucao?",
"filters": {
"sourceTypes": ["document", "qa"],
"audience": "ai_agent"
},
"scoreThreshold": 0.7,
"returnMode": "ai_generated_answer",
"limit": 10,
"useRerank": True,
"companyName": "Acme Corporation",
"companyProductsNames": ["Produto Premium", "Produto Basic"],
"clientName": "Joao Silva",
"clientServices": "Plano Premium, Suporte 24/7",
"clientCurrentChatHistory": "<string>",
"clientOlderChatHistory": "<string>",
"clientPaymentHistory": "<string>",
"clientLogs": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
queryText: 'Qual a politica de devolucao?',
filters: {sourceTypes: ['document', 'qa'], audience: 'ai_agent'},
scoreThreshold: 0.7,
returnMode: 'ai_generated_answer',
limit: 10,
useRerank: true,
companyName: 'Acme Corporation',
companyProductsNames: ['Produto Premium', 'Produto Basic'],
clientName: 'Joao Silva',
clientServices: 'Plano Premium, Suporte 24/7',
clientCurrentChatHistory: '<string>',
clientOlderChatHistory: '<string>',
clientPaymentHistory: '<string>',
clientLogs: '<string>'
})
};
fetch('https://api-talk.saninternet.com/v1/api/rag/retrieve', 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-talk.saninternet.com/v1/api/rag/retrieve",
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([
'queryText' => 'Qual a politica de devolucao?',
'filters' => [
'sourceTypes' => [
'document',
'qa'
],
'audience' => 'ai_agent'
],
'scoreThreshold' => 0.7,
'returnMode' => 'ai_generated_answer',
'limit' => 10,
'useRerank' => true,
'companyName' => 'Acme Corporation',
'companyProductsNames' => [
'Produto Premium',
'Produto Basic'
],
'clientName' => 'Joao Silva',
'clientServices' => 'Plano Premium, Suporte 24/7',
'clientCurrentChatHistory' => '<string>',
'clientOlderChatHistory' => '<string>',
'clientPaymentHistory' => '<string>',
'clientLogs' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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-talk.saninternet.com/v1/api/rag/retrieve"
payload := strings.NewReader("{\n \"queryText\": \"Qual a politica de devolucao?\",\n \"filters\": {\n \"sourceTypes\": [\n \"document\",\n \"qa\"\n ],\n \"audience\": \"ai_agent\"\n },\n \"scoreThreshold\": 0.7,\n \"returnMode\": \"ai_generated_answer\",\n \"limit\": 10,\n \"useRerank\": true,\n \"companyName\": \"Acme Corporation\",\n \"companyProductsNames\": [\n \"Produto Premium\",\n \"Produto Basic\"\n ],\n \"clientName\": \"Joao Silva\",\n \"clientServices\": \"Plano Premium, Suporte 24/7\",\n \"clientCurrentChatHistory\": \"<string>\",\n \"clientOlderChatHistory\": \"<string>\",\n \"clientPaymentHistory\": \"<string>\",\n \"clientLogs\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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-talk.saninternet.com/v1/api/rag/retrieve")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"queryText\": \"Qual a politica de devolucao?\",\n \"filters\": {\n \"sourceTypes\": [\n \"document\",\n \"qa\"\n ],\n \"audience\": \"ai_agent\"\n },\n \"scoreThreshold\": 0.7,\n \"returnMode\": \"ai_generated_answer\",\n \"limit\": 10,\n \"useRerank\": true,\n \"companyName\": \"Acme Corporation\",\n \"companyProductsNames\": [\n \"Produto Premium\",\n \"Produto Basic\"\n ],\n \"clientName\": \"Joao Silva\",\n \"clientServices\": \"Plano Premium, Suporte 24/7\",\n \"clientCurrentChatHistory\": \"<string>\",\n \"clientOlderChatHistory\": \"<string>\",\n \"clientPaymentHistory\": \"<string>\",\n \"clientLogs\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-talk.saninternet.com/v1/api/rag/retrieve")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"queryText\": \"Qual a politica de devolucao?\",\n \"filters\": {\n \"sourceTypes\": [\n \"document\",\n \"qa\"\n ],\n \"audience\": \"ai_agent\"\n },\n \"scoreThreshold\": 0.7,\n \"returnMode\": \"ai_generated_answer\",\n \"limit\": 10,\n \"useRerank\": true,\n \"companyName\": \"Acme Corporation\",\n \"companyProductsNames\": [\n \"Produto Premium\",\n \"Produto Basic\"\n ],\n \"clientName\": \"Joao Silva\",\n \"clientServices\": \"Plano Premium, Suporte 24/7\",\n \"clientCurrentChatHistory\": \"<string>\",\n \"clientOlderChatHistory\": \"<string>\",\n \"clientPaymentHistory\": \"<string>\",\n \"clientLogs\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"aiGeneratedAnswer": "Com base nos documentos, a politica de devolucao permite devolucoes em ate 30 dias...",
"results": [
{
"id": "result-uuid-123",
"score": 0.85,
"payload": {
"companyId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"audience": [
"ai_agent",
"copilot"
],
"contentCategory": "policy",
"content": "Nossa politica de devolucao permite devolucoes em ate 30 dias...",
"sourceType": "document",
"sourceId": "doc-123",
"title": "Politica de Devolucao",
"path": [
"politicas",
"devolucoes"
],
"metadata": {}
}
}
],
"total": 5,
"retrievalTimeMs": 150
}{
"statusCode": 401,
"error": "Unauthorized",
"message": "Invalid or expired API key"
}{
"statusCode": 403,
"error": "SubscriptionInactive",
"message": "Sua assinatura nao esta ativa",
"subscriptionStatus": "CANCELLED"
}Authorizations
API key no formato pyp_live_*. Enviada como Bearer token no header Authorization.
Body
O texto da consulta para busca semantica.
"Qual a politica de devolucao?"
Filtros para refinar a busca.
Show child attributes
Show child attributes
Score minimo de similaridade para incluir um resultado. Valores mais altos retornam resultados mais relevantes.
0 <= x <= 10.7
ai_generated_answer retorna uma resposta gerada por IA alem dos chunks. chunks_only retorna apenas os chunks brutos.
ai_generated_answer, chunks_only "ai_generated_answer"
Numero maximo de resultados. Padrao: 10.
1 <= x <= 10010
Ativar reranking dos resultados para melhorar a relevancia.
true
Nome da empresa para contexto na geracao de resposta.
"Acme Corporation"
Nomes dos produtos da empresa para contexto.
["Produto Premium", "Produto Basic"]
Nome do cliente para personalizacao da resposta.
"Joao Silva"
Servicos ativos do cliente para contexto.
"Plano Premium, Suporte 24/7"
Historico de chat atual do cliente para contexto.
Historico de chat anterior do cliente.
Historico de pagamentos do cliente.
Logs do cliente para contexto adicional.
Response
Resultados recuperados com sucesso
Resposta gerada por IA. Presente apenas quando returnMode e ai_generated_answer.
"Com base nos documentos, a politica de devolucao permite devolucoes em ate 30 dias..."
Chunks recuperados do banco vetorial.
Show child attributes
Show child attributes
Numero total de resultados encontrados.
5
Tempo de busca em milissegundos.
150