Skip to content

Chat

Send a message to the chatbot based on documents previously uploaded.

Parameters:

Name Type Description Default
chat_id int

The ID of the chat that has had documents uploaded.

required
message str

The message to send to the chatbot.

required
finetuned_model_key str

An optional custom model OpenAI key. If provided, the chatbot uses this finetuned model for the response.

None

Returns:

Name Type Description
response dict

The JSON response from the API containing answer, message_id and sources (which contains the document name and the relevant chunk).

Sample usage:

from anoteai import Anote

api_key = 'INSERT_API_KEY_HERE'
Anote = Anote(api_key, isPrivate=False) #You can select isPrivate=True if you want to use private models

chat_id = 5
response = privategpt.chat(chat_id, "What is this paper about?", finetuned_model_key="ft:gpt-35-turbo-0613:personal:anote:8DO8V2LB")

Response is given as a JSON in this format:

{
    'answer': 'The paper on classification performance is about utilizing few-shot and active learning to enhance artificial intelligence models.,
    'message_id': 10,
    'sources': [
        ['doc2.pdf', 'To address this, we delve into few-shot and active learning, where our goal is to improve AI models with human feedback.'],
        ['doc1.pdf', 'Improving Classification Performance With Human Feedback: \n\Label a few, we label the rest']
    ]
}