Poser une question à un assistant intelligent
Listez vos assistants intelligents, puis posez une question à l’un d’eux via l’API et lisez ses sources.
Un assistant intelligent répond aux questions à partir d’une sélection de contenus, avec ses propres instructions. Via l’API, vous pouvez poser une question à l’un d’eux et lire les sources qu’il a utilisées.
Trouver l’assistant
Listez les assistants disponibles pour l’utilisateur :
query listAssistants {
me {
smartAssistants(first: 10) {
edges {
node {
id
label
}
}
}
}
}
La réponse :
{
"data": {
"me": {
"smartAssistants": {
"edges": [
{ "node": { "id": "U21hcnRBc3Npc3RhbnQ6MQ==", "label": "Security Advisor" } },
{ "node": { "id": "U21hcnRBc3Npc3RhbnQ6Mg==", "label": "Product Documentation" } },
{ "node": { "id": "U21hcnRBc3Npc3RhbnQ6Mw==", "label": "Customer Success Agent" } }
]
}
}
}
}
Poser la question
Récupérez l’assistant par son identifiant avec node, puis appelez answer sur ce nœud :
query askAssistant {
node(id: "U21hcnRBc3Npc3RhbnQ6Mg==") {
... on SmartAssistant {
answer(query: "What is a tag in Elium?") {
text
sources {
... on Story {
slug
version {
title
}
}
... on AnswerAssetSource {
asset {
__typename
... on FileAsset {
filename
}
}
}
}
}
}
}
}
La réponse :
{
"data": {
"node": {
"answer": {
"text": "In Elium, a tag is a keyword or label used to classify and organise information. Tags are grouped into families, called categories, and they help to filter content within the platform. Tags make it easier to find specific information and create dynamic entry points to it.",
"sources": [
{
"asset": {
"__typename": "FileAsset",
"filename": "product documentation export.pdf"
}
}
]
}
}
}
}
La réponse a la même forme que celle d’Elium Answer : un text et une liste de sources, où chaque source est une Story ou un AnswerAssetSource.