Aller au contenu principal

Synchronous Generation Endpoint

Endpoint Overview

Endpoint: POST /api/companies/{companyCuid}/orchestrators/{orchestratorCuid}/generation

Request Body

The request body consists of the following fields:

FieldDescriptionTypeRequiredExample
subjectThe subject of the customer’s message. (Optional)StringNo"Demande de remboursement suite à un accident de voiture"
bodyThe main content of the customer's inquiry. (Required)StringYes"Je vous écris pour déclarer un sinistre suite à un accident de voiture..."
metadataAdditional context or information about the inquiry, such as the sender's email or policy details. (Optional)ObjectNo{ "date": "2024-09-11", "policy_number": "123456789", "sender": "jean.dupont@mail.com" }
templateA template to structure the generated response. If not provided, the system will generate a flexible response. (Optional)StringNo"Bonjour [Nom du Client], Merci de nous avoir contactés..."

Example Request

Here’s an example of a request to the generation endpoint:

{
"subject": "Demande de remboursement suite à un accident de voiture",
"body": "Bonjour,\n\nJe vous écris pour déclarer un sinistre suite à un accident de voiture survenu le 10 septembre 2024. Mon véhicule a été gravement endommagé, et je souhaiterais obtenir un remboursement pour les réparations.\n\nVoici les détails :\n- Numéro de contrat : 123456789\n- Date de l'accident : 10/09/2024\n- Lieu : Paris, France\n\nMerci de m'indiquer les démarches à suivre pour la prise en charge du sinistre.\n\nCordialement,\nJean Dupont",
"metadata": {
"date": "2024-09-11",
"policy_number": "123456789",
"sender": "jean.dupont@mail.com"
},
"template": "Bonjour [Nom du Client],\n\nMerci de nous avoir contactés. Nous sommes désolés d'apprendre l'accident et espérons que tout le monde est en sécurité. Pour déclarer un accident auprès de nos services, veuillez suivre les étapes ci-dessous :\n\n..."
}

Response

The response from the Generation endpoint contains the generated text based on the input content. The system will fill in dynamic placeholders from the metadata or content provided.

Example Response

{
"response": "Bonjour Jean Dupont,\n\nMerci de nous avoir contactés. Nous sommes désolés d'apprendre l'accident et espérons que tout le monde est en sécurité. Pour déclarer un accident auprès de nos services, veuillez suivre les étapes ci-dessous :\n\n..."
}

The generated response will be returned in the response field, where any placeholders (such as [Nom du Client]) will be replaced by the relevant data.


Optional Fields

subject (Optional) {#subject-optional}

The subject of the customer’s message. If provided, this can help provide context for the response.

metadata (Optional) {#metadata-optional}

Additional metadata related to the request. Common metadata fields could include:

  • date: The date the inquiry was made.
  • policy_number: A related policy number, if applicable.
  • sender: The sender’s email address.

This metadata can be used to dynamically populate placeholders in the response template.

template (Optional) {#template-optional}

A template to structure the generated response. If not provided, the system will generate a flexible response that may not follow a predefined structure.