Chat with docs
Connecting the chatbot to external data enriches the conversation with context-specific knowledge, making responses more relevant to your usecase. The intellinode cloud facilitates this by indexing your documents and generating a One Key for secure access using the Chatbot
functionality.
Steps
Uploading Documents:
- Navigate to the Intellinode app.
- Create a new project with the Document option - available for free.
- Upload your desired documents or images.
- Copy the generated One Key.
Implementation:
from intelli.model.input.chatbot_input import ChatModelInput
from intelli.function.chatbot import Chatbot
# initialize the chatbot with your API key and the One Key
chatbot = Chatbot(api_key=YOUR_API_KEY, provider="mistral", options={"one_key": INTELLI_ONE_KEY})
# prepare the input with attachment references
chat_input = ChatModelInput(system="You are a helpful assistant.", model="mistral-medium")
chat_input.attach_reference = True
chat_input.add_user_message("Explain the concept of relativity.")
response = chatbot.chat(chat_input)
# parse the response
print("the responses: ", response["result"])
print("the referenced documents: ", response["references"])
The attach_reference
parameter instructs the chatbot to append the used data sources to generate the response.