[ad_1]

Ask a bot for document-related questions. Image generated with Stable Diffusion.
I will ask you questions based on the following context:
— Start of Context —

YOUR DOCUMENT CONTENT

— End of Context—
My question is: “What features do users want to see in the app?”

Extract relevant parts from the documents and then feed them to the prompt. Icons from https://www.flaticon.com/

Prerequisites

Workflow

!pip install llama-index
!pip install openai
# Import necessary packages
from llama_index import GPTSimpleVectorIndex, Document, SimpleDirectoryReader
import os

os.environ['OPENAI_API_KEY'] = 'sk-YOUR-API-KEY'

# Loading from a directory
documents = SimpleDirectoryReader('your_directory').load_data()

# Loading from strings, assuming you saved your data to strings text1, text2, ...
text_list = [text1, text2, ...]
documents = [Document(t) for t in text_list]

# Construct a simple vector index
index = GPTSimpleVectorIndex(documents)
# Save your index to a index.json file
index.save_to_disk('index.json')
# Load the index from your saved index.json file
index = GPTSimpleVectorIndex.load_from_disk('index.json')
# Querying the index
response = index.query("What features do users want to see in the app?")
print(response)
An example response.

[ad_2]

Source link

Leave a Reply

Your email address will not be published. Required fields are marked *