Message Endpoints

Create a new search message

POST /api/messages/search

Sends the user question to the backend and returns the search message.

Headers

Name
Value

Content-Type

application/json

Authorization

Bearer <token>

Body

Name
Type
Description

user

user

user object from the current logged in user

room

room

room object of the current room

role

string

role of the message author

content

string

content of the message

Response

{
    "user": {
        "id": 8,
        "auth0_id": "auth0|663853106fa7baf42014492e",
        "username": "user@example.com",
        "email": "user@example.com",
        "lang": "en",
        "max_api_calls": 46
    },
    "room": {
        "id": 10,
        "user": {
            "id": 8,
            "auth0_id": "auth0|663853106fa7baf42014492e",
            "username": "user@example.com",
            "email": "user@example.com",
            "lang": "en",
            "max_api_calls": 46
        },
        "name": "New Room",
        "anonymizeCompleteContext": true,
        "messages": [],
        "files": [
            {
                "id": 53,
                "filename": "Example.txt",
                "text": "example text ...",
                "user": 8,
                "fileSize": 6799,
                "lang": "en",
                "uploadedAt": "2024-03-30T13:28:18.721243Z"
            }
        ],
        "created_at": "2024-03-30T13:34:21.930509Z",
        "settings": {
            "templates": {
                "de": "Beantworten Sie die Frage anhand des unten stehenden Kontextes. Wenn die\nFrage nicht mit den angegebenen Informationen beantwortet werden kann, antworten Sie\nmit \"Ich weiß es nicht\".\n\"\"",
                "en": "Answer the question using the context below. If the\nquestion cannot be answered with the information provided, answer with \"I don't know\".\n\"\""
            },
            "prompt_template": "Answer the question using the context below. If the\nquestion cannot be answered with the information provided, answer with \"I don't know\".\n\"\"",
            "pre_phrase_count": 2,
            "post_phrase_count": 2
        },
        "anonymizationMappings": [
            {
                "roomID": 10,
                "anonymized": "LOC_0",
                "deanonymized": "example_location",
                "entityType": "LOC"
            }
        ]
    },
    "role": "system",
    "content": [
        {
            "content": "example search result 1 ... ",
            "fileName": "Example.txt",
            "accuracy": 0.15407638251781464,
            "context_before": " ",
            "context_after": " "
        },
        {
            "content": "example search result 2 ... ",
            "fileName": "Example.txt",
            "accuracy": 0.10192305594682693,
            "context_before": " ",
            "context_after": " "
        },
        {
            "content": "example search result 3 ... ",
            "fileName": "Example.txt",
            "accuracy": 0.10118090361356735,
            "context_before": " ",
            "context_after": " "
        }
    ],
    "created_at": "2024-03-30T15:25:16.589801Z",
    "entities": [
        {
            "roomID": 10,
            "anonymized": "LOC_0",
            "deanonymized": "example_location",
            "entityType": "LOC"
        }
    ]
}

Create a new message send to chatgpt

POST /api/messages/chatgpt

Sends the user question and the search results to the backend and returns the answer by chatgpt.

Headers

Name
Value

Content-Type

application/json

Authorization

Bearer <token>

Body

Name
Type
Description

user

user

user object from the current logged in user

room

room

room object of the current room

role

string

role of the message author

content

string

content of the message

Response

Last updated