NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

import os
from langchain.chains import RetrievalQA
from langchain.document_loaders import PyPDFLoader
from langchain.text_splitter import RecursiveCharacterTextSplitter
from langchain.vectorstores import Chroma
from pdf2image import convert_from_path
from langchain.chains import ConversationalRetrievalChain
from langchain.memory import ConversationBufferMemory
from langchain.document_loaders import PyPDFDirectoryLoader
from langchain.chains.question_answering import load_qa_chain
from langchain.document_loaders import DirectoryLoader
from langchain.embeddings import OpenAIEmbeddings
from langchain.prompts import PromptTemplate
from langchain.text_splitter import CharacterTextSplitter
from langchain.vectorstores import Chroma
from langchain.chat_models import ChatOpenAI
from langchain.embeddings import HuggingFaceEmbeddings
OPENAI_API_KEY = "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"
os.environ["OPENAI_API_KEY"] = OPENAI_API_KEY
chat_gpt = ChatOpenAI(temperature=0.7, model_name="gpt-4")


# texts = text_splitter.split_documents(docs)
loader = PyPDFDirectoryLoader("alpesh")
docs = loader.load()
len(docs)
text_splitter = RecursiveCharacterTextSplitter(chunk_size=1024, chunk_overlap = 200)
context = text_splitter.split_documents(docs)

# retriever=db.as_retriever(),
len(context)
template = """
### Instruction: Act as a H2H movers consultant.I provide you article whe
your task is ask question for gathering information from user as based fo
<article>{context}</article>.
Please follow the instruction before questioning to the user.
1. Ask at least 10 questions.
2. your question based only above article. do not asked question outside
3. Ask question as like a friendly consultant.
``` After gathering information your task is share information like billi
1. Keep remember your giving information based on gathering information f
2. If any suggestion or another option asked to user to alternate option
^^^
I'll give an example as following.
### Input : What day were you looking to move?
### Answer : sunday 12 nov 2023
### Input : And what is the size of your current home, is it 1, 2, 3 bedroom?
### Answer : 3
### Input : Are you going to move by yourself or with somebody else?
### Answer : somebody else
### Input : Do you have anything over 200 lbs that can not be disassemble
specific item and weight, if they don't know ask if it is over 300 lbs)
### Answer : yes
### Input : Is there anything else that you think would be important for
your move? (if no the move on cost or busget information)
### Answer :yes, I have an dj set.
[
Step 1. Make a report like, money, arrival time,etc
Step 2. PAINT a picture like I can estimate you will need (xxx) small, (
(xxx) large boxes. So the total together including the packing paper will
When it comes to moving, I would recommend ___# men and a truck. The hour
team is $____.
STEP 3 - GIVE THE RATES
STEP 4 - GIVE THE QUOTES
]
### Input : Have you heard enough to make a decision?
### Answer : If yes - OK, SO I've got you down for –(DATE) —-.
IF NO...
STEP 5 rebuttals (from the texts article)
^^^
### Input: {question}
### Response:
""".strip()
prompt = PromptTemplate(template=template, input_variables=["context", "question"])
qa_chain = RetrievalQA.from_chain_type(
llm=chat_gpt,
chain_type="stuff",

# retriever=db.as_retriever(search_kwargs={"k": 2}),
# retriever=retriever,
return_source_documents=True,
chain_type_kwargs={"prompt": prompt},
)
print(qa_chain('hi')['result'])
     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.